Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain Attributes cannot be read #26

Closed
roninf opened this issue Jan 21, 2023 · 6 comments
Closed

Certain Attributes cannot be read #26

roninf opened this issue Jan 21, 2023 · 6 comments

Comments

@roninf
Copy link

roninf commented Jan 21, 2023

Not working:

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

Here are some HA logs (not sure if they are related to the issue):

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: homeassistant.helpers.entity
Source: custom_components/jvcprojector/remote.py:249
Integration: jvcprojector (documentation)
First occurred: 20. Januar 2023 um 23:33:49 (1 occurrences)
Last logged: 20. Januar 2023 um 23:33:49

Update for remote.nz8_remote fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 102, in __handshake
    message = jvc_sock.recv(len(JVC_GRT))
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.py", line 538, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
    raise exc
  File "/config/custom_components/jvcprojector/remote.py", line 106, in async_update
    await self.async_update_state()
  File "/config/custom_components/jvcprojector/remote.py", line 295, in async_update_state
    raise e
  File "/config/custom_components/jvcprojector/remote.py", line 249, in async_update_state
    self._signal_state = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 205, in command
    return self._send_command(getattr(Commands, commandl[0]))
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 140, in _send_command
    jvc_sock: socket.socket = self.__handshake()
  File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 111, in __handshake
    raise JVCHandshakeError("Timeout when waiting to receive PJ_OK") from e
jvc_projector_remote.jvccommands.JVCHandshakeError: Timeout when waiting to receive PJ_OK
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.jvcprojector.remote
Source: custom_components/jvcprojector/remote.py:173
Integration: jvcprojector (documentation)
First occurred: 20. Januar 2023 um 18:52:35 (6 occurrences)
Last logged: 20. Januar 2023 um 23:25:21

Sent command, received communication error: JVCCommunicationError("Timeout when waiting for the specified ACK: `b'\\x06\\x89\\x01PM\\n'` for command: `low_latency` with bytes: `b'!\\x89\\x01PMLL0\\n'`")
Sent command, received communication error: JVCCommunicationError("Timeout when waiting for the specified ACK: `b'\\x06\\x89\\x01PM\\n'` for command: `low_latency` with bytes: `b'!\\x89\\x01PMLL1\\n'`")
Sent command, received communication error: JVCCommunicationError("Timeout when waiting for the specified ACK: `b'\\x06\\x89\\x01PM\\n'` for command: `picture_mode` with bytes: `b'!\\x89\\x01PMPM03\\n'`")
Sent command, received communication error: JVCCommunicationError("Timeout when waiting for the specified ACK: `b'\\x06\\x89\\x01PM\\n'` for command: `picture_mode` with bytes: `b'!\\x89\\x01PMPM0C\\n'`")
Sent command, received communication error: JVCCommunicationError("Timeout when waiting for the specified ACK: `b'\\x06\\x89\\x01PM\\n'` for command: `picture_mode` with bytes: `b'!\\x89\\x01PMPM0D\\n'`")
@roninf
Copy link
Author

roninf commented Jan 21, 2023

addition:
remote.nz8_remote

last_commands_sent: power last_commands_response: standby power_state: standby signal_state: unknown input_state: unknown lamp_state: high picture_mode: unknown friendly_name: NZ8_remote supported_features: 0

I know its standby here .. but it does not change when the projector is running

@roninf
Copy link
Author

roninf commented Jan 21, 2023

Does it have to be "lamp_state" or "lamp" .... i changed it to lamp according to the documentation... maybe thats the "issue"... i`ll check that later on.

@bezmi
Copy link
Owner

bezmi commented Jan 21, 2023

Yes it should be "lamp". The logs are on the first set, the projector is refusing communication and in the second set, it is not sending the required responses for the low_latency and picture_mode commands. Is your projector on the "new" firmware that was released by JVC by any chance?

@roninf
Copy link
Author

roninf commented Jan 22, 2023

Yes its on the new firmware (2.0)... but "picture_mode" and the remote do still work fine. I can change the lasermode, picturemode and latency just fine using the remote.
Lamp state is not shown anymore since its "lamp" instead of "lamp_state" at least thats my guess. And i just added latency 2 days ago so i don`t know if it would have worked before.

@bezmi
Copy link
Owner

bezmi commented Jan 24, 2023

My apologies, I have looked over your posts in more detail and the problem is clear.

state_attr('remote.nz8_remote', 'SOME_ATTR') will only work with attributes that are exposed via the remote device (follow the link to see what is possible).

You are mixing up commands which can be directly sent to the projector via the remote.send_command service and the attributes that are stored in the remote device. In this case, lamp_state is the correct format to use, as that is the name of the attribute. Internally, the remote component sends a command lamp (which is found in the README) to the projector. The result is interpreted and stored in the lamp_state attribute.

Since a low_latency attribute has not yet been implemented, you will need to write an automation which uses the remote.send_command service to send the command low_latency and then use state_attr('remote.nz8_remote', 'last_commands_response') to retrieve the value.

@roninf
Copy link
Author

roninf commented Jan 24, 2023

Perfect thanks for clarification!

@roninf roninf closed this as completed Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants