JVC Projector Component

Hi Everyone,

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.

If you’d like to give it a try:
bezmi/hass_custom_components https://github.com/bezmi/homeassistant_jvc_projector_remote

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.

1 Like

IP only? Serial support planned?

Sadly no RS232 support with this component. However, you should be able to use this. Just run the server.py file and send GET commands via REST.

Thank you. I saw this in past but forgot to test.
Guess I have found a weekend project.

Hi bezmi

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.

Thank you
Felix

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

bezmi, again, thanks for your help.

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?

Thank you

BTW, using Hercules terminal tool with correct hex commands on same windows PC works fine. THe JVC turns of, off and so on.

The link to the module is in my first reply to you, just click the “python module” text. Here it is again https://github.com/bezmi/jvc_projector.

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.

1 Like

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.

I am on the latest hassio on a RPI 2

Thanks

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.

Here is my configuration.yaml

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
remote:
  - platform: jvcprojector
    name: RS6710
    host: 192.168.1.37
# Example configuration.yaml for projector input source and lens memory
input_select:
  jvc_projector_input:
    name: Input
    options:
      - HDMI 1
      - HDMI 2
    initial: HDMI 1
  jvc_projector_memory:
    name: Lens Memory
    options:
      - Memory 1
      - Memory 2
      - Memory 3
      - Memory 4
      - Memory 5
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Here is the automations.yaml

- id: '1577644923807'
  alias: Change Projector Input
  description: Change JVC Input
  trigger:
  - entity_id: input_select.jvc_projector_input
    platform: state
  condition:
  - condition: state
    entity_id: remote.rs6710
    state: 'on'
  action:
  - data:
      command: "{% if is_state('input_select.jvc_projector_input', 'HDMI 1') %}\n\
        \  hdmi1\n{% elif is_state('input_select.jvc_projector_input', 'HDMI 2') %}\n\
        \  hdmi2\n{% endif %}"
    entity_id: remote.rs6710
    service: remote.send_command

In the custom_components jvcprojector dir the init.py was empty so I copied the init.py from the git site.

Bezmi,

Is there any other information I can supply to help troubleshoot this?

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.

  1. Select the remote.send_command service.
  2. entity_id set to remote.rs6710. At this point, your Service Data should look like:
{
  "entity_id":"remote.rs6710"
}
  1. Edit the Service Data json to:
{
  "entity_id":"remote.rs6710",
  "command":["power_on"]
}
  1. If this works repeat the above steps 1-3 and replace "power_on" with "memory1" to "memory5", and "hdmi1" or "hdmi2".

bezmi,

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

  1. 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.
  2. Save this get-pip.py script to your Desktop
  3. Open Command Prompt and type cd Desktop and press enter.
  4. Now type python get-pip.py and press enter. It should output some stuff and finish with “Successfully installed pip-xx.x.x”.

Installing and using jvc-projector-remote

  1. In cmd, type pip install jvc_projector_remote and press enter.
  2. Launch IDLE, the python interpreter from your start menu.
  3. You should be at the python command line now.
  4. Type each of the following lines into the interpreter, followed by the enter key, assuming your projector is at IP 192.168.1.37:
from jvc_projector import JVCProjector
host = "192.168.1.37"
projector = JVCProjector(host)
  1. You’re set up to send commands. Try the following in the interpreter:
projector.power_on()

Your device should power on. Now try

projector.is_on()

which should return True.
6. Now try:

projector.command("hdmi2")

The values can be anything we discussed above in my previous post. Let me know how this goes.

Bezmi,

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.