iloveicedgreentea / jvc_homeassistant

JVC Integration for Home Assistant
20 stars 4 forks source link

Implementation of lens control command #33

Closed josh-79 closed 11 months ago

josh-79 commented 11 months ago

Hello,

I use a JVC N5 projector in my home theater. Currently I have connected the projector via the FHEM Smart Home software. I would now like to switch to the Home Assistant component. Unfortunately, I am currently missing the following command in the Home Assistant component:

"Lens Control“

This command opens directly the focus menu without the need to enter it via the setup menu. According to JVC documentation, the command can be called via the following remote code:

Hex Code: 21 89 01 52 43 37 33 33 30 0A ASCII: 30 Source (Page 10)

In FHEM it is possible to send a specific remote code. I use the remote code 30 to execute the command.

Could this command also be implemented in the Home Assistant component? Maybe you could integrate a command to send any ASCII remote code?

iloveicedgreentea commented 11 months ago

sure let me see what I can do

iloveicedgreentea commented 11 months ago

in HACS please update to the latest beta release. You will need to allow beta releases should be v3.6.99

You can use send_command service to send something like remote,30 as a value which will execute ascii code 30 using Code A (73)

Make sure to restart and stuff. If you have issues, turn on debug logging for the jvc component only and try again, then post logs

logger:
  default: warning
  logs:
    custom_components.jvc_projectors: debug
josh-79 commented 11 months ago

Wow, thank you for the very fast implementation. I will test the beta version tonight and then give feedback.

josh-79 commented 11 months ago

Hello,

sorry for the late feedback. I have been trying to get the new beta version to work for the last few days.

The old commands work perfectly (e.g. "lamp_power,normal").

However, I have not been able to get the new "remote" commands to work. I have tested "remote,30", "remote,2e" and "remote,03".

I get the following error message in the log:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/jvc_projectors/remote.py:235 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 23:24:40 (6 occurrences) Last logged: 23:46:05

[139838971437328] too many values to unpack (expected 3) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1849, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 980, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/remote/init.py", line 204, in async_send_command awa

Am I doing something wrong or is the error in the plugin?

josh-79 commented 11 months ago

Here another log-error-message:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/jvc_projectors/remote.py:235 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 15:20:04 (1 occurrences) Last logged: 15:20:04

[140304242599600] too many values to unpack (expected 3) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1849, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 980, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/remote/init.py", line 204, in async_send_command 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 "/config/custom_components/jvc_projectors/remote.py", line 235, in send_command self.jvc_client.exec_command(command) File "/usr/local/lib/python3.10/site-packages/jvc_projector/jvc_projector.py", line 410, in exec_command return self._send_command(command, command_type) File "/usr/local/lib/python3.10/site-packages/jvc_projector/jvc_projector.py", line 238, in _send_command cons_command, ack = self._construct_command(cmd, command_type) File "/usr/local/lib/python3.10/site-packages/jvc_projector/jvc_projector.py", line 382, in _construct_command command_name, val, ack = Commands[command].value ValueError: too many values to unpack (expected 3)

iloveicedgreentea commented 11 months ago

please try 3.6.6. I just tested on mine and was able to send remote commands

iloveicedgreentea commented 11 months ago

I also added menu,lens_control which opens to that menu but its not in this release will be in the final one

iloveicedgreentea commented 11 months ago

I released 3.7.0 which adds all of these actually

josh-79 commented 11 months ago

I have tested version 3.7.0. It works perfectly (both: "menu,lens_control" and "remote,30"). Thanks for the implementation.

I have also tested version 3.7.1. Here I get the following error message before restarting HA:

Platform error remote.jvc_projectors - Requirements for jvc_projectors not found: ['jvc-projector-remote-improved2==3.7.1'].

iloveicedgreentea commented 11 months ago

thanks I put the wrong library version its fixed now