From a4175a058e4f3084951b732981f83ad89e8cd3e6 Mon Sep 17 00:00:00 2001 From: iloveicedgreentea <31193909+iloveicedgreentea@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:07:25 -0500 Subject: [PATCH] add LL status --- Makefile | 2 ++ changelog | 6 ++++++ jvc_projector/jvc_projector.py | 19 ++++++++++--------- setup.py | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 changelog diff --git a/Makefile b/Makefile index 53140d2..b6127dc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ .PHONY: test dev_install build upload dev_install: + python3 -m venv .venv + . .venv/bin/activate && \ pip3 install -r requirements-test.txt test: python -m unittest discover -s tests diff --git a/changelog b/changelog new file mode 100644 index 0000000..99c908e --- /dev/null +++ b/changelog @@ -0,0 +1,6 @@ +# 3.0.0 + +## BREAKING CHANGES + +### Commands +`input` renamed to `input_mode` \ No newline at end of file diff --git a/jvc_projector/jvc_projector.py b/jvc_projector/jvc_projector.py index c4a3cd9..8d6eccb 100644 --- a/jvc_projector/jvc_projector.py +++ b/jvc_projector/jvc_projector.py @@ -5,7 +5,7 @@ import logging from typing import Final, Union import asyncio -from jvc_projector.commands import ACKs, Footer, Header, Commands, PowerStates, Enum +from jvc_projector.commands import ACKs, Footer, Header, Commands, PowerStates, Enum, LowLatencyModes class JVCProjector: @@ -419,16 +419,11 @@ async def async_get_low_latency_state(self) -> bool: None if there was an error """ - state, success = await self._async_do_reference_op( + state, _ = await self._async_do_reference_op( "low_latency", ACKs.picture_ack ) # LL is off, could be disabled - if not success: - return None - if state == b"PM0": - return False - - return True + return LowLatencyModes(state.replace(ACKs.picture_ack.value, b"")).name # async def _async_check_low_latency(self) -> list[str]: # """ @@ -511,8 +506,14 @@ async def async_is_on(self) -> bool: """ True if the current state is on|reserved """ - pw_status = [PowerStates.on.name, PowerStates.reserved.name] + pw_status = [PowerStates.on.name] return await self._async_get_power_state() in pw_status + + async def async_is_ll_on(self) -> bool: + """ + True if LL mode is on + """ + return await self.async_get_low_latency_state() == LowLatencyModes.on.name def print_commands(self) -> str: """ diff --git a/setup.py b/setup.py index b4c8e85..5582c90 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="jvc_projector_remote_improved2", - version="2.4.5", + version="3.0.0", author="iloveicedgreentea", description="A package to control JVC projectors over IP", long_description=long_description,