I had been using my own implementation of the JVC projector IP control protocol to control my projector. Based on this post, I decided to clean up the code (a little!) and upload a python module and homeassistant component. I used the demo remote component and added some async stuff. While my implementation works, I’m not sure if it is “correct”, so I’m open to suggestions that would make this more in line with the developer guidelines.
UPDATE 11-Dec-2021: I’ve renamed the repo to homeassistant_jvc_projector_remote to better follow the updated HACS repository format.
I’ve included some instructions/examples in the documentation.
Supported Services:
remote.turn_on, remote.turn_off
remote.send_command
Input Source: hdmi1, hdmi2
Lens Memory: memory1, memory2…
I am still working on this, along with the rest of my system, so feature requests are welcome. See the documentation for the relevant place to post them.
How could I use your code in Windows? I am using a Windows based home automation system called HomeSeer. In it, I can call an executable with a command line to control the projector. Is it possible to make such an executable as a command line for Windows? I tried using putty.exe and telnet but could not get this to work.
I have a python module which interfaces with the homeassistant component. You can implement a simple python script that uses this module and just call that via the command line. Raise an issue on the page for the python module if you need some help.
Thanks for your reply, I am not clear on one thing please.
I am running a Windows based HomeSeer HS3. How did you mean to implement python script? Did you mean that I would have to instal Cygwin on the HS3 machine and run this script in Cygwin? How would i call this Cygwin python script from within HS3? I was hoping for Windows command line approach.
Sorry, just not sure.
Felix
I don’t know where the python module page is. So, I am replying here.
I figured out my scripting requirements. I installed Cygwin on my windows machine wiht python module. I downloaded your code and i wrote a script. The communciation seems to be working and your code and my script actually run. But, I am not able to turn on the projector. I tested all the handshaking and it seems to work (otherwise your exceptions would happen). However, I am seeing strange things on the data being sent. In your defintion, the hex codes for power on are 21 89 01 50 57 31 0A. And that is correct, even though my projector is DLA-X30B. However, what I see echo in the Cygwin terminal is different values being sent. I am seing these ASCII characters !▒PW1 which when converted to hex are these 21 2592 50 57 31 0a. Maybe I am not understanding something in conversion between ASCII and Hex but perhaps you may have a better understanding. Is this a problem? Why am I not these ASCII characters instead !PW1. What could be the problem here?
I’m not sure about the problems you’re having with the hex/ascii characters sorry. Please raise an issue on that github page and I can help you get the python module running. What you are asking about is not related to the homeassistant component, so the discussion should not be here.
I am hoping to get this working (I am a total newbie with HA), I had been using Irule to control my projector successfully. Now that Irule is no longer a supported product I have been looking for a way to control my HT and Home Assistant seems to be the best route so far.
I managed to get this loaded into Home assistant (Hassio) and it does respond to power on and off commands. But none of the other commands work.
I only need Lens memory and on / off to work. The projector is a JVC RS6710.
I know the commands should work, I was able to verify the lens memory and input commnands work using a CLI tool for windows.
Unfortunately there is not any errors in the logs for hassio to point me in the right direction.
I have also tried using the developer tools and sending the remote event manually. I don’t get a response or error there either.
Any help would be appreciated. Right now I am working on one device at a time and the projector is the first one I am tackling.
Hi, I’d be happy to help. Could you clarify what tool/command string you used from windows and the exact command format you are using in the developer console of homeassistant?
Could you please try the python module that this component uses: https://github.com/bezmi/jvc_projector directly from windows to try and send a few commands? We will be able to narrow down whether it is the homeassistant component that is not working or my implementation of the commands.
The windows stand alone python module works fine. It controls on / off and input, lens memory. So the problem appears to be with my setup of Home Assistant.
In Home Assistant I have it setup with your examples tweaked for my system. As said I said the power on and off works. But none of the lens memory or input commands work. This is both with the automations.yaml and using the developer tools.
The developer commands I used,
Services>remote.send.command
Entity RS6710
Command: hdmi2 and hdmi 2 then memory1 and memory 1
This is the windows command line tool. All of the commands I need worked with this. Power On//Off and lens memory.
Sorry for the delayed response. I’ve had a busy few days.
First things first, I’d just like to confirm how you’re trying to manually send commands from the homeassistant developer tools by manually sending a direct power_on or power_off command instead of using the remote.power_on service. Doing it this way will let us troubleshoot the actual jvcprojector component without any potential configuration errors getting in the way.
Select the remote.send_command service.
entity_id set to remote.rs6710. At this point, your Service Data should look like:
I tried this, none of the commands worked, I tried with and without quotes on the command itself as well as the leader (command).
The errors in the logs are
2020-01-03 10:23:55 ERROR (MainThread) [homeassistant.helpers.entity] Update for remote.rs6710 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/jvcprojector/remote.py", line 44, in update
self._state = self._jvc.is_on()
File "/usr/local/lib/python3.7/site-packages/jvc_projector/__init__.py", line 116, in is_on
message = self._send_command(Commands.power_status.value, ack = ACKs.power_ack.value)
File "/usr/local/lib/python3.7/site-packages/jvc_projector/__init__.py", line 68, in _send_command
jvc_sock.connect((self.host, self.port)) # connect to projector
ConnectionRefusedError: [Errno 111] Connection refused
That is very strange. Before proceeding further, just make sure that the IP address of the projector is correct from the settings menu. If you haven’t set it to static in your router, the IP may be reassigned. At the very least, I’d expect the power commands to work as you’re able to power on and off using the toggle in homeassistant, which is treated the same by the code that actually sends commands to the projector.
I’d like to confirm that the underlying code is working with your projector outside of the homeassistant environment. Here are the instructions for windows:
Installing Python and Pip on Windows
Install the latest version of python 3.8.1 at this time. Make sure you select the “add python 3.8 to PATH” option. If you forget, the most straightforward way is to uninstall and reinstall python, remembering to check the box.
The ip address is correct in the configuration.yaml, is there anywhere else it needs to be input?
From the developer tools I can turn the projector on and off with the remote.turn_on or remote.turn_off commands and entity_id: remote.rs6710
from developer tools the remote.send_command
entity_id: remote.rs6710
command: power_off
this does not work
Mon Jan 06 2020 10:22:59 GMT-0600 (Central Standard Time)
Error handling message: expected dict for dictionary value @ data['service_data']. Got 'entity_id":"remote.rs6710 command:power_off'
I get the above error.
using the python module on my windows pc and your instructions. That does work I can turn the power on and off, get true or false indications on power status. Change hdmi input and lens memories it all works.
Okay, thanks for bringing this to my attention! Turns out I was a bit behind on more recent changes to homeassistant which made my code incompatible. I’ve quickly tested and pushed the change (literally adding one word to function definitions) to the repository. After re-installing the component, you should now be able to send a command from the developer tools by selecting the remote.send_command service with the service data YAML:
entity_id: remote.rs6710
command: power_on
Or any relevant command. Let me know how it goes. Apologies for not picking up on this earlier.
I haven’t yet tested the input_select configuration examples with the working code, so let me know if you get stuck on that.