RS232 control via itach IP2SL - tweak of itach remote component

I am trying to migrate away from Simple Control to a new platform (long story) and home assistant does almost everything I need except I need a smallish tweak - ideally that gets added as a feature rather than me having to edit the itach module myself (and break my updates).

I have an Itach IP2SL RS232 device for control of my Denon Amp and am wondering if someone is interested in tweaking the itach remote component to achieve this?

The standard itach remote takes a hex string and changes it to the correct format for sending to the itach IP2IR (adding the extra characters needed, eg “sendir,1:1…” . What I’m after is a tweak to NOT convert that text and just send it directly as entered through to the IP2SL.

Standard itach config:

  - platform: itach
    host: <itach_ip_address>
    port: 4998    #ip2ir command port
    devices:
      - name: TV
        connaddr: 2
        commands:
          - name: "ON"
            data: "0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689"

What would work for an IP2SL:

  - platform: itach
    host: <itach_ip_address>
    port: 4999    #note the port is different for the IP2SL
    devices:
      - name: TV
        commands:
          - name: "ON"
            data: "PWRON\x0D"

Basically, telnet to the itach IP2SL device on port 4999, transmit PWRON\x0D without translation (or whatever command is in the data field). (TBH, not sure why you would need the translation anyway as Global Cache have a giant database of most IR commands in their format for easy download).

I can do this with the TELNET component but that expects ON and OFF commands where I can send all of the below (and more) as discrete commands using RS232.

PWRON
PWROFF
SITUNER
SIDVR
SIDVD
MVUP
MVDOWN
MVxx (number between 00 and 80, or 99 = minimum)

Ideally I would then be able to add all of those buttons to the remote and also to scripts/automations at a later stage.

I have already used the REST API to set up all of the remote buttons for my Panasonic Viera TV with the Telnet component to send the IR commands for On and Off as my VT60 doesn’t do WOL).

For reference, my Telnet config for IR on and off of the TV: (using itach IP2IR)

  platform: telnet
  switches:
    panasonic_tv:
      resource: 192.168.1.80
      port: 4998
      command_on: "sendir,1:1,1,37000,1,1,128,63,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,48,16,2712"
      command_off: "sendir,1:1,1,37000,1,1,128,63,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,16,16,48,16,2712"

And my REST config for TV remote buttons (available via scripts):

  url: http://192.168.1.98:55000/nrc/control_0
  method: POST
  headers:
    content-type: application/xml
    SOAPAction: '"urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"'
  payload: '<?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1"> <X_KeyEvent>NRC_{{ command }}-ONOFF</X_KeyEvent> </u:X_SendKey> </s:Body> </s:Envelope>'
  content_type: 'text/xml'
  verify_ssl: false

And one of the button scripts:

sequence:
  - service: rest_command.tv_buttons
    data:
      command: CH_UP

OK so that was too hard (and had no responses) so I’ve gone down a different route.

I found a Docker container which takes an http REST API on one side and outputs telnet commands to a denon amp. Well, that was his design. My amp is flakey on the IP control so I have the IP2SL for RS232 control via IP but the commands are the same, just on a different port with a different end of line/carriage return character…

Denon REST API container

So I tweaked it slightly and now it works happily with my IP2SL in the middle.
Had to add in commands for Zone 2 as they weren’t included in the initial package. All working well now.

REST_API component in my configuration.yaml:

avr_buttons:
  url: http://192.168.1.20:8000/api/{{ command }}  
  method: GET
  verify_ssl: false 

Example of a script to change input to TUNER:

alias: AVR Input Tuner
sequence:
  - service: rest_command.avr_buttons
    data:
      command: SITUNER

Thanks to @petro. Without seeing what he did with his remote I wouldn’t have even thought of trying this. And I copied his look and style shamelessly. Now that everything works, I’m just tidying up the button arrangement and colours.

image


Happy to share my tweaks to the Denon API docker container if anyone else is in a similar boat.
As mentioned, am using REST API for Denon, Panasonic TV and Plex with standard media_player controls for Spotify and a couple of telnet_command switches for IR control.

Now I can throw away the SimpleControl app and stop paying them - extra bonus, I can use my new remote on any device - iOS, Android or Mac/PC. Perfect.

1 Like

I’m in the same boat, I have an IP2SL connected to my receiver (and amplifiers) that I want to control from Home Assistant. Seems like a generic Home Assistant interface to IP2SL almost doesn’t make sense (unlike the IR version which is really a one-way broadcast of IR), since so much is in the interpretation of the results from the serial commands.

The only IP2SL Home Assistant client I could find was this old unsupported notify component for sending data TO a RS232 (but not handling responses):

This is useful for sending commands like IR…e.g. Power On/Off, buttons, etc.

Did you try that IP2SL component out?

Actually that still doesn’t offer as clean of a solution as you proposed for defining commands. I might play around with a IP2SL client that is a pure RS232 remote.

I don’t actually use the feedback as that became difficult - particularly as the Denon feedback is continuously overwriting the previous feedback all on one line - without clearing the line first. Don’t know if that is a quirk of the IP2SL or the Denon.

The only thing I really needed/wanted feedback on was the volume setting (although it would be nice to see what the audio decode mode currently is - DTS-HD MA etc). As I don’t ever use the physical remote, I now use Home Assistant to exclusively control the volume - anything that changes the volume actually changes an input_number in HA which then fires off an automation to set the volume. Not as elegant (or responsive) as what I was paying for before but perfectly usable. This way I can use Alexa or any one of several iPads/phones around the house to control the volume and all are synchronised - unless someone turns the knob on the amp but as that is in a media cupboard downstairs, that would only ever be me. :slight_smile:

I did look at using that IP2SL notify component but it didn’t work. I still like my idea of just sending the actual command to the IP2IR rather than converting it - or have a flag which turns on IR command translation if needed.
e.g.
Standard IR command data which needs to be translated to Global Cache format:

  - platform: itach
    host: <itach_ip_address>
    port: 4998    #ip2ir command port
    devices:
      - name: TV
        connaddr: 2
        commands:
          - name: "ON"
            data: "0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689"
            translate: "yes"

vs the same command using Global Cache format directly:

  - platform: itach
    host: <itach_ip_address>
    port: 4998    #ip2ir command port
    devices:
      - name: TV
        connaddr: 2
        commands:
          - name: "ON"
            data: "sendir,1:1,1,37000,1,1,128,63,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,48,16,2712"
            translate: "no"

That would keep everyone happy.
Particularly if the default option for translate was yes - then it’s not a breaking change (and we all know how annoying those are!!!) :slight_smile:

Here was an example configuration I was playing with for a IP2SL client to one of my amplifiers. The RS232 devices I have all just take commands, not try to replicate IR codes over serial.

- platform: ip2sl
  host: <itach_ip_address>
  port: 4999 # serial port 1 = 4999
  name: "Xantech Amplifier"
  commands:
    - name: "All Off"
      data: "!AO+"

- platform: ip2sl
  host: <itach_ip_address>
  port: 4999 # serial port 1 = 4999
  name: "Xantech Zone 1"
  commands:
    - name: "On"
      data: "!1PR1+"
    - name: "Off"
      data: "!1PR0+"
    - name: "Power Toggle"
      data: "!1PT+"
    - name: "Volume Up"
      data: "!1VI+"
    - name: "Volume Down"
      data: "!1VD+"
    - name: "Mute On"
      data: "!1MU1+"
    - name: "Mute Off"
      data: "!1MU0+"
    - name: "Source TV"
      data: "!1SS1+"
    - name: "Source Sonos"
      data: "!1SS2+"
    - name: "Source Spotify"
      data: "!1SS3+"
    - name: "Source FM"
      data: "!1SS4+"
    - name: "Source DVD"
      data: "!1SS5+"
    - name: "Source XBOX One"
      data: "!1SS6+"
    - name: "Source None"
      data: "!1SS7+"
    - name: "Source None"
      data: "!1SS8+"

Though I’m not really convinced that a completely generic IP2SL interface from Home Assistant is useful except for initial experimentation. Amost every case I get into, I want more discrete control over details (exact volume level, dimmer level setting, passing source ids, etc)…or want the data/commands exposed in more complex interfaces like media_player.

I think for a media_player it would probably need to be more specific rather than a generic implementation. If you don’t require the feedback (if you assume the command was always successful and nothing externally ever changed the settings) then volume (for the denon at least) and potentially dimming are easy. The Denon allows setting specific volume levels directly: eg MV30

It would be great if we could take the feedback from an IP2SL and use that. Similar to how I currently use the command_line sensor. Example from my Raspberry Pi:

  - platform: command_line
    name: rasplex_temp
    command: ssh [email protected] "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) | round(1) }}' 

  - platform: command_line
    name: rasplex_sd
    command: ssh [email protected] "./rasplex_sd.sh"
    unit_of_measurement: "GB"
    value_template: '{{ value | multiply(0.001) | round(1) }}'  
    scan_interval: 3600

  - platform: command_line
    name: rasplex_ram
    command: ssh [email protected] "./rasplex_ram.sh"
    unit_of_measurement: "MB"

  - platform: command_line
    name: rasplex_cpu
    command: ssh [email protected] "./rasplex_cpu.sh"
    unit_of_measurement: "%"
    scan_interval: 60

image

Not entirely sure what that thing is doing at 15% CPU though! Shouldn’t be anything happening there at all!!

For Volume, I do this, which works with a generic command and could happily be converted for another platform:

  • All volume changes are made to input_number.avr_volume (-80 to -10 as I limit the volume as +18 is just stupidly loud)
  • sensor.avr_volume_sensor translates the input number to a number the Denon expects to see (0-80)
  • The AVR_Volume automation applies the sensor value to the Denon via the IP2SL
  • sensor.avr_volume_display just formats the volume nicely for the volume display button
  • tapping/clicking the sensor.avr_volume_display button brings up the input number slider to easily set a specific volume

Input_number:

avr_volume:
  name: Lounge
  icon: mdi:volume-medium
  initial: -80
  min: -80
  max: -10
  step: 0.5
  unit_of_measurement: dB

AVR_volume sensors:

      avr_volume_sensor:
        value_template: "{{(states.input_number.avr_volume.state | float) + 80 }}"
        friendly_name: Denon Volume
      avr_volume_display:
        value_template: "{{ states.input_number.avr_volume.state + 'dB' }}"  
        friendly_name: Volume

AVR_Volume Automation

- alias: Set AVR volume
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: input_number.avr_volume
  action:
  - delay:
      milliseconds: 50  
  - service: rest_command.avr_buttons
    data_template:
      command: MV{{((states.sensor.avr_volume_sensor.state | replace('.','')))}}

When dragging the slider I can see the value I’m setting the value to…
image

None of which really helps you though as you setup seems to need something more customised.

If you do come across a better way of doing any/all of this, let me know. I’m happy to test things with my setup if that helps.

I feel like my way of doing things is SUPER convoluted and there must be an easier way!!
After staring at it for so long though it’s hard to see the forest for the trees…

What does the feedback look like?
Is it all mashed up on the same line or is it cleared after every command?

Yes…same parts of my configuration. It gets convoluted quickly if you are using generic serial/IR/communication/command line/etc interfaces.

For things I’m building, I’m striving to make simpler for users by installing via add-on stores and setup with minimal config. For home automation there are often so many layers, it isn’t completely obvious to users what is going on, how many things are involved and where things break. And that is just getting things talking to one another…it gets really complicated once you try to bind everything together into a nice looking Lovelace interface.

1 Like

Serial devices write out to buffers, which means clients read everything the device is sending in order (including old replies). My Xantach amp replies always include enough info (line by line) to interpret the result, and dispatch to the appropriate handler. Effectively you have to think of it as asynchronous bi-directional communication, the reply may or may not be the next thing you read off the serial port.

Do you have the Xantech fully integrated now? I have one that I was going to get rid of. But my Russound has been really flaky, so I thought I might put the Xantech back if I could get it working with HA.

@samgreco No, but I’ve started working on it again. I decided to change the approach and instead just make the connection simulate a Monoprice, since there are so many apps, libraries, etc that communicate with Monoprice (it uses the same protocol just with some minor tweaks). Then the Xantech can be used with any Monoprice client. I hope to do this in the next few weeks.

The Xantech is a MUCH better amp than the Monoprice units and I have two different ones so I’m incentivized to eventually get to this…

I actually have 3 audio matrixes. I have a Russound MCA-C5, which works great with HA. Until it decides to lose it’s network connection. Sometimes in a n hour, sometimes days or weeks.

I also have a Vaux Lattis LE-1600A, which is a 16X16 that I have been using for a couple of years with my old automation software. But no driver for it in HA.

And then the Xantech ZPR68-10 with expander. That’s why this post piqued my interest.

And the idea of emulating is interesting. I’d love to see how you do that.

@samgreco The Xantech protocol for the old ZPR68-10 is completely different anyhow, so this wouldn’t work for you I don’t think anyway.

I kinda thought so, once i realized you were working with the MCRs. I’d love to continue using the Vaux Lattis I had. Always worked brilliantly. And I have 18 channels of amplification.

Wish I could code :slight_smile:

Hi guys, so am following the threads with Itach in them. I too have an itach ip2sl. Has anyone managed to successfully integrate this into HA or even Node-red yet? I don’t really know how to code, so am at a bit of a loss. I have been waiting for ages for someone smarter than me to come up with a solution.

Is it working at all for anyone?

I didn’t come across anyone else doing anything better so I’m still using the docker container with python scripts in it to talk to the IP2SL and I just use a REST API to talk to the container. I don’t get feedback but because we only ever use the HA “remote” to control everything, there are no issues. But feedback would be nice as I know it’s possible.

Surely someone could fix this integration so it worked properly and was easy to implement??
The people at SimpleControl (aka Roomie) can’t be the only ones to make this work properly can they??

Haven’t tried Node-red. Will have a look at that. What are you controlling with the IP2SL by the way?

I was controlling an Epson Projector (TW6100w). Currently am using a broadlink RM mini to do it, but i paid good money for these itach’s and it’s a shame not to utilise them, especially when theoretically they should perform better (with the feedback). I saw that someone had added a global cache integration (GC100) it’s such a shame it can’t be expanded to include the itach flex.

Am I right in my understanding that I only need to add this to my config’ (changing the serial commands (data) of course? Do I need to add a different file into custom components or anything like that?

  • platform: ip2sl
    host: <itach_ip_address>
    port: 4999 # serial port 1 = 4999
    name: “Xantech Amplifier”
    commands:

    • name: “All Off”
      data: “!AO+”
  • platform: ip2sl
    host: <itach_ip_address>
    port: 4999 # serial port 1 = 4999
    name: “Xantech Zone 1”
    commands:

    • name: “On”
      data: “!1PR1+”
    • name: “Off”
      data: “!1PR0+”
    • name: “Power Toggle”
      data: “!1PT+”