JVC Projector Component

Hi all,

i am trying to set this up for a NZ8 projector but there seems to occur an error somewhere:

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 36, in setup_platform
    JVCRemote(name, host, password, port, delay, timeout, retries),
  File "/config/custom_components/jvcprojector/remote.py", line 69, in __init__
    self._lamp_state = "unknown" if not self._state else self._jvc.command("lamp")
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 202, in command
    return self._send_command(getattr(Commands, commandl[0]))
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 167, in _send_command
    result = command.read(jvc_sock)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvccommands.py", line 212, in read
    return self.read_valsinv[resp]
KeyError: b'2'

My config is as follows:

platform: jvcprojector
name: NZ8
host: 10.2.0.50
scan_interval: 30

# only required for NZ series and up
#password: MyNZ8

# optional, default is 20554
port: 20554

# optional, float, default is 0.5 seconds
# how long to wait before raising a communication error
timeout: 0.5

# how long to wait between commands
# optional, default is 600 milliseconds
delay: 600

# how many times to retry on connection error
# optional, default is 5
max_retries: 5

Interesting as well is that my device has no option to set a network password…

Do you have any idea what could be wrong?

BR

Forgive me for showing a bit of the code, but if you look here, I am only dealing with two return values for the lamp power state, either “high” (return code b'1') or “low” (return code b'0').

Your error implies the NZ series has another lamp power state that corresponds to the key b'2' that I have simply not implemented as my older projector doesn’t have it. This will need looking into, but if you can put your lamp in a different power mode which doesn’t give the error, it should allow you to get it set up and kind-of working.

For the network password, if it isn’t an option in your projector’s network settings, then there is no need to set it in the config. I have no idea which models actually have it (quick check of the manual says DLA-NZ9BK, DLA-NZ8BK, DLA-NZ7BK, DLA-RS4100K, DLA-RS3100K, DLA-RS2100K only).

I am trying to find the external command specifications for the NZ models, but so far, I have only come across the file for NX series, which was last updated in 2018. Since these are laser models, it is likely that the “lamp” commands are different.

Edit: found it! AVS Forum to the rescue! There is indeed a “mid power” lamp mode. I can have this implemented and pushed out fairly quickly. Stay tuned!

1 Like

Cool thanks very much for your promt answer!! There will be a firmware update midth of november which might change the file you found slightly again (should`nt change lamp/laser mode though).

Thats exactly the file i found as well.

I have released v2.0.0a3. It should greatly improve compatibility with newer projectors, among other bugfixes. Please give it a go and report back, there aren’t many users with the newest models that I know of.

If you are able to use this component without issues, I am inclined to push out the final v2.0.0 and start preparing for v3.0.0 which will allow web interface configuration and settings tweaks and hopefully bring the component up to the latest homeassistant standards.

1 Like

Wow that was fast :slight_smile: Just saw it. I will check it later on and let you know!

Update: looks better now:

 Logger: custom_components.jvcprojector.remote
Source: custom_components/jvcprojector/remote.py:105
Integration: jvcprojector (documentation)
First occurred: 17:33:17 (78 occurrences)
Last logged: 18:11:47
Couldn't connect to the projector at the specified address: 10.2.0.50:20554. Ensure the configuration is correct.

I will check again when i have turned on the projector later on.

Looks good, but i had to restart HA after turning the projector on before it worked out.

Let me know what you need me to test! :slight_smile:

Is there a way/command to control CMD, eShift and graphics mode as well?

but i had to restart HA after turning the projector on before it worked out.

Yes, I find that this is often the case. Unfortunately it is quite a pain to debug and optimise the communications as JVCs protocol is not great and has many quirks. Given how long the projector takes to restart, you can imagine how frustrating debugging these things can get. Hopefully writing v3 with web ui config flow will give me an opportunity to refactor some of the communications code.

Let me know what you need me to test!

Just go through the attributes in that list and make sure that they are working. Put it through regular usage and check the logs reasonably often, let me know if any weird warnings/error messages appear.

Is there a way/command to control CMD, eShift and graphics mode as well?

Not yet, but I try to add extra commands whenever I update the python library, so I’ll put them on the list.

Everything worked out well so far! Attributes where showing corresponding states. It might be even faster then the original remote which really sucks.

Is there a way to get the attribute states into a separate entity (like a status entity)? I am not a coder but please let me know if i can be of any help :slight_smile:

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?