JVC Projector Component

Is there a way to get the attribute states into a separate entity (like a status entity)?

Maybe try a markdown card.

Thanks for the hint. I have figured out how to use a template sensor like:

platform: template
sensors:
  nz8_power_state:
    value_template: "{{ state_attr('remote.nz8', 'power_state') }}"
    friendly_name: NZ8 Powerstate
    icon_template: mdi:power

Hi everyone, I have released v2.0.0 (stable) of the addon. No big changes from the alpha releases, except a bugfix for the annoying issue where the remote in homeassistant would briefly toggle back to ‘off’ when turning the projector on from the dashboard. This will be the last release that is configured through configuration.yaml

The current master branch contains a mostly working implementation of the component with a config flow based setup, which will be the v2.1.0 release. I aim to have it set up as a JVC projector device, with many entities:

  • the remote entity that we all know and love (same extra state attributes, etc so all existing automations work fine)
  • lots of (configurable) sensors allowing you to expose many of the projector attributes. This really needs to be configurable, as the projector I own (x5900) has issues with trying to access many things in quick succession. See my note below.

Once the config flow system is stable and well documented, I will start the push to integrate it into homeassistant core with all of the required clean up that will go along with that.

Note: if you have an NZ series projector, reduce the delay parameter in your configuration.yaml for the component and let me know the lowest value before the component starts misbehaving. On my projector, the limit approx 600-700ms before I start getting connection errors.

1 Like

Hi @bezmi ,

thanks for the update! i can check the delay setting for my NZ8 and let you know.

Update: set it to 450 yesterday and could not recognize issues while switching lasermode…

Hey @bezmi ,

Saw that I’m supposed to post here instead of as an issue on Github(I opened it before I saw that comment :-X )

I had this working for months, disabled it to troubleshoot something, and now it won’t re-enable :frowning:

Here’s the error showing up in HASS logs:

Error while setting up jvcprojector platform for remote
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvccommands.py", line 109, in __verify_ack
    ACK = sock.recv(COM_ACK_LENGTH)
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/jvcprojector/remote.py", line 40, in setup_platform
    JVCRemote(name, host, password, port, delay, timeout, retries),
  File "/config/custom_components/jvcprojector/remote.py", line 72, in __init__
    self._jvc = JVCProjector(self._conf_host, self._conf_password, self._conf_port, self._conf_delay, self._conf_timeout, self._conf_retries)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 55, in __init__
    self.validate_connection()
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 174, in validate_connection
    self._send_command(Commands.nullcmd)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 153, in _send_command
    command.write(jvc_sock)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvccommands.py", line 173, in write
    self.__verify_ack(sock, command)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvccommands.py", line 127, in __verify_ack
    raise JVCCommunicationError(
jvc_projector_remote.jvccommands.JVCCommunicationError: Timeout when waiting for the specified ACK: `b'\x06\x89\x01\x00\x00\n'` for command: `nullcmd` with bytes: `b'!\x89\x01\x00\x00\n'`

Any ideas? Thank you! Love this addon!

EDIT: Just installed v1.0.2 and that seems to work. I have an NX7 projector. I’ll continue messing around with stuff. Or at least, the projector shows up with no errors. Seems like 1.0.2 slows down my HASS install a ton, and takes upwards of 45 seconds to load pages like HACS. Couldn’t really test.

EDIT 2: Ok, looking at HASS backups from early November(definitely working), I was on 2.0.0a3. Reinstalled that and get same error.

I’ve just released my integration to read the status:
JVC DILA sensor - Third party integrations - Home Assistant Community (home-assistant.io)

For anyone else who might have this issue, Check out the issue on github for a fix that works. The issue is still open, as I’m working on refactoring communications to be more reliable.

1 Like

Any reason why you’re not using this component with helper entities to read the attributes? I think we can be more productive and create a better user experience if we work together on a singular codebase, so if you have any issues/suggestions/criticisms, then let me know.

FYI, with version 2.1.0, I will be releasing sensor entities which hold some of the state variables, as well as improving communications so they’re more reliable.

1 Like

@bezmi in reality I searched for a component multiple times… and did not found yours :(… so I decided to develop my own… and when I published it I discovered yours :slight_smile:
super happy to work together.
Mine is super simple compared to yours that is very complete and nice.
My objective was to have only the status of the projector, not to act on it (to avoid issues)… also I wanted to avoid external dependancies.
What I was planning to do was to add a config:flow and see if I was able to go for async to get platinum level integration badge :slight_smile: but I’m not (yet) that good in python (is my first program in it :))

I’m checking your component and is very nice. The major difference I found so far that I consider a timeout as a PowerOff and I added a binary sensor (on - off) to make my automations easier.

@bezmi for your info I get this " This entity (‘remote.jvc_dila_x30’) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail."
It would be great you add an unique id to avoid the error

Although avoiding external dependencies is entirely possible, decoupling the control logic in a standalone python library from the homeassistant component has proven to be very useful. I have seen some instances where people have used my python library to write plugins for other (non-home assistant) automation systems.

FYI, Unique ID is in the current master branch, along with config flow setup via the UI. It mostly works, but is still actively worked on and could break any time. There are plans to improve the communications in the python library and add status items as sensors to the homeassistant integration, similar to what you have done, before releasing v2.1.0.

@bezmi it is very good! I was thinking the same and trying to use the library
to be honest with you I would suggest to do 2 components, one with status/actions - that is yours.
One with only status - that is mine.
As in my case I do not want to have any possibility to issue an action (even by mistake) as it would mess up with the projector. I really want a components that “reads” only the status.
For my scenario the only relevan one is on/off (the binary sensor) but it could be great to have even the other ones, maybe it should be a configuration on which entities to create as if there are to many info the projector can get banged by too many requests… as there should be some time between one and the other (0.6s) it could create quite a gap between the checks (i.e. 10 properties = 10*0.6 + handshake > 8 secs :))

does this make sense?

Is anyone also having troubles to read certain attributes? For me it was working but it somehow seems to be broken… for example: lasermode and latency

platform: template
sensors:
  nz8_latency_state:
    value_template: "{{ state_attr('remote.nz8_remote', 'low_latency') }}"
    friendly_name: NZ8 Latency Mode
    #icon_template: mdi:power
    unique_id: 240cf4e1-7eac-454f-a751-ecf65c054e1d
platform: template
sensors:
  nz8_laser_mode:
    value_template: "{{ state_attr('remote.nz8_remote', 'lamp') }}"
    friendly_name: NZ8 Lasermode
    #icon_template: mdi:power
    unique_id: 7fe97b28-75ce-48bc-814a-8d774df6c838

Picture Mode for example is still working fine:

platform: template
sensors:
  nz8_picture_mode:
    value_template: "{{ state_attr('remote.nz8_remote', 'picture_mode') }}"
    friendly_name: NZ8 Picturemode
    #icon_template: mdi:power
    unique_id: dcf20ff1-2d2d-45fb-9ff4-a610e110dbc7

Can you please post an issue on the github repository with any relevant error messages so I may test?

EDIT: resolved here. Basically, only some things are valid state_attr and in order to retrieve something that isn’t one of those, you must send it as a command and then look at the last_commands_response attribute.

Done that… to be honest i am not sure if its an addon issue or my fault :slight_smile:

Those of you on V2 firmware for the NZ series who are having issues, it looks like JVC has changed the commands and shuffled things around with the picture and lamp mode states. I will push an update once I have had a look over the updated specification.

Yes this makes sense. I’m working on a change to allow persistent connection when sending multiple commands so that there isn’t such a delay. The next update will have this functionality.

Perfect! I’ll work on the “read only” component starting from your codebase :slight_smile:

Simple question: Is this HAC still working? I know JVC released an “official” integration but I liked this one better and i am trying to revert to it unsuccessfully

It’s been a long while since I’ve worked on the code or tested it. I’ll try and get it up to date and installable in the coming weeks and then archive the project so people know it’s not going to receive any further updates.