Trying to send HEX commands to shade

Needs some assistance as a Homeseer Refugee…

A critical part of my HS system is integration with my older QMotion shade control. The plug-in I had been using was no longer supported and there was no easy transition path to HS4 and my venture into HA

I have thus far been unable to really figure out how to get HA to make a call to my shade controller. The controller itself is a serial device connected to Ethernet by an old Lantronix box to do the TCP/IP to Serial conversion. I need to send C-escaped hex commands to the Lantronix via IP and port.

# SHADE 25%
\x01\x07\x00\x05\x01\x01\x0B\x00\xF6
# SHADE 50%
\x01\x07\x00\x05\x01\x01\x09\x00\xF4
# SHADE 75%
\x01\x07\x00\x05\x01\x01\x07\x00\xFA
# SHADE DOWN
\x01\x07\x00\x05\x01\x01\x02\x00\xFF
# SHADE UP
\x01\x07\x00\x05\x01\x01\x01\x00\xFC

I’d love to be able to send these to the shade, I’m happy to start simply with up and down (i.e. open and close) but for the life of me I have no idea where to begin to make this work in HA. The commands must be C-escaped and sent to a IP and Port (192.168.0.100 : 10001 for example). Any help here would be welcome!

This is what I’ve tried thus far based on what I’ve been able to find searching the forums…

- platform: command_line
  switches:
	master_suite_blackout:
	  command_on: ech -e "\x01\x07\x00\x05\x01\x01\x01\x00\xFC" | nc 192.168.0.100 10001
	  command_off: ech -e "\x01\x07\x00\x05\x01\x01\x02\x00\xFF" | nc 192.168.0.100 10001
	  friendly_name: Master Suite Blackout

I’ve also added a x0D to the end of the string as well and get nothing. I tried to sniff using Wireshark to see what the difference in the end results were and can’t catch the packets from either HS or HA, so I’m at a bit of a loss.

Is there an ech -e command or did you mean to write echo -e for the command?

1 Like

OMG… When you stare at something for too long you completely gloss over the simplest of things. I fixed it to ‘echo’ and added single quotes to encapsulate the entire call and it finally works. The final results…

### SHELL COMMANDS TO TRY AND CLEAN IT UP A BIT ###
master_suite_blackout_open: 'echo -e "\x01\x07\x00\x05\x01\x01\x01\x00\xFC" | nc 192.168.30.40 10001'
master_suite_blackout_75: 'echo -e "\x01\x07\x00\x05\x01\x01\x07\x00\xFA" | nc 192.168.30.40 10001'
master_suite_blackout_50: 'echo -e "\x01\x07\x00\x05\x01\x01\x09\x00\xF4" | nc 192.168.30.40 10001'
master_suite_blackout_25: 'echo -e "\x01\x07\x00\x05\x01\x01\x0B\x00\xF6" | nc 192.168.30.40 10001'
master_suite_blackout_closed: 'echo -e "\x01\x07\x00\x05\x01\x01\x02\x00\xFF" | nc 192.168.30.40 10001'


### ACTUAL COVER TEMPLATE ###
  - platform: template
    covers:
      master_suite_blackout:
        device_class: shade
        friendly_name: "Master Suite Blackout Shade"
        open_cover:
          service: shell_command.master_suite_blackout_open
        close_cover:
          service: shell_command.master_suite_blackout_closed
        set_cover_position:
          service: shell_command.master_suite_blackout_25
          data:
            position: 25


I can now get it to open and close and go to 25%… Now if anyone wants to help me with the set_cover_position to call the three intermediate positions via shell command when the slider is manipulated I’d be extremely grateful.

0% to 10% → master_suite_blackout_closed
10% to 37% → master_suite_blackout_25
38% to 64% → master_suite_blackout_50
65% to 87% → master_suite_blackout
88% to 100% → master_suite_blackout_open

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.