Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from iloveicedgreentea/new_commands
Browse files Browse the repository at this point in the history
Adding content_type, hdr processing, theater optimizer Attributes. Library bump
  • Loading branch information
iloveicedgreentea authored Jan 20, 2023
2 parents 40c971e + 0ec736c commit 15c58eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
4 changes: 2 additions & 2 deletions custom_components/jvc_projectors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": false,
"documentation": "https://www.home-assistant.io/integrations/jvc_projector",
"requirements": [
"jvc-projector-remote-improved2==3.4.0"
"jvc-projector-remote-improved2==3.4.3"
],
"ssdp": [],
"zeroconf": [],
Expand All @@ -14,5 +14,5 @@
"@iloveicedgreentea"
],
"iot_class": "local_polling",
"version": "3.4.0"
"version": "3.4.3"
}
39 changes: 29 additions & 10 deletions custom_components/jvc_projectors/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def setup_platform(
]
)


class JVCRemote(RemoteEntity):
"""Implements the interface for JVC Remote in HA."""

Expand All @@ -75,6 +76,9 @@ def __init__(
self._eshift = ""
self._color_mode = ""
self._input_level = ""
self._content_type = ""
self._hdr_processing = ""
self._theater_optimizer = ""
# Because we can only have one connection at a time, we need to lock every command
# otherwise JVC's server implementation will cancel the running command
# and just confuse everything, then cause HA to freak out
Expand All @@ -84,9 +88,6 @@ def __init__(
@property
def should_poll(self):
"""Poll."""
#
# Polling is disabled as it is unreliable and will lock up commands at the moment
# Requires adding stronger locking and command buffering
return True

@property
Expand All @@ -105,15 +106,26 @@ def extra_state_attributes(self):
# Useful for making sensors
return {
"power_state": self._state,
"installation_mode": self._installation_mode,
"picture_mode": self._picture_mode,
"installation_mode": self._installation_mode,
"content_type": "Unsupported"
if "NX" in self._model_family
else self._content_type,
"hdr_processing": "Unsupported"
if "NX" in self._model_family
else self._hdr_processing,
"theater_optimizer": "Unsupported"
if "NX" in self._model_family
else "on" in self._theater_optimizer,
"low_latency": self._lowlatency_enabled,
"input_mode": self._input_mode,
"laser_mode": self._laser_mode if "NZ" in self._model_family else "Unsupported",
"eshift": self._eshift if "NZ" in self._model_family else "Unsupported",
"color_mode": self._color_mode,
"laser_mode": self._laser_mode
if "NZ" in self._model_family
else "Unsupported",
"input_level": self._input_level,
"low_latency": self._lowlatency_enabled,
"model_family": self._model_family
"color_mode": self._color_mode,
"eshift": self._eshift if "NZ" in self._model_family else "Unsupported",
"model_family": self._model_family,
}

@property
Expand Down Expand Up @@ -146,8 +158,15 @@ def update(self):
self._input_level = self.jvc_client.get_input_level()
self._picture_mode = self.jvc_client.get_picture_mode()

# Only look at laser for NZ
# NZ specifics
if "NZ" in self._model_family:
self._content_type = self.jvc_client.get_content_type()
# only check HDR if the content type matches else timeout
if any(x in self._content_type for x in ["hdr", "hlg"]):
self._hdr_processing = self.jvc_client.get_hdr_processing()
self._theater_optimizer = (
self.jvc_client.get_theater_optimizer_state()
)
self._laser_mode = self.jvc_client.get_laser_mode()
# Some non-nz models support this but some don't, so easier to just not check
self._eshift = self.jvc_client.get_eshift_mode()
Expand Down

0 comments on commit 15c58eb

Please sign in to comment.