TCP commands for Ethernet relay

i am using hassos, and indeed -q isnt an available option :frowning:

Please can you tell me what hardware you are controlling with this? I have a need to do something similar.

Try the -w option.
About the hardware is just one of cheap relay board you can find on eBay and such.

in my case my domotica system, it has an IP controller, to turn on off my lights/switches/screens …

-w option doesnt reply to me either, strange
but anyway, i stay with my .py sensor file , that i loop every 10 sec :slight_smile:
it works

mySocket.send(message)
data = mySocket.recv(1024)
data = binascii.hexlify(data).decode()

print (data)

At the risk of hijacking this thread (though it is kind of relevant), would this item be able to be used in the same way?

This is what my case is too probably. Even though it seems to be a relative new version (July 18) it doesn’t have the -q option. It’s exactly the same as @pergola.fabio’s version.

Can you update netcast though on Hassio?

This solution works if you have to send plain content over a TCP/UDP socket. If your device has a Rest API there’s a better way (https://www.home-assistant.io/components/sensor.rest/, or other HA components).

You should check the datasheet or the manual of your product and find out what you have to do to control it.

Thanks for the reply.

The only info available is as below:

http://192.168.1.4/30000/00 : Relay-01 OFF

http://192.168.1.4/30000/01 : Relay-01 ON

http://192.168.1.4/30000/02 : Relay-02 OFF

http://192.168.1.4/30000/03 : Relay-02 ON

http://192.168.1.4/30000/04 : Relay-03 OFF

http://192.168.1.4/30000/05 : Relay-03 ON

http://192.168.1.4/30000/30 : Relay-16 OFF

http://192.168.1.4/30000/31 : Relay-16 ON

http://192.168.1.4/30000/41 : Enter

http://192.168.1.4/30000/40 : Exit

http://192.168.1.4/30000/42 : Next Page

http://192.168.1.4/30000/43 : Next Page

Does that give any clues as to how I might use it with HA?

That’s just an http request? You can do that with a curl command line

I have ended with the following code:

- platform: command_line
  scan_interval: 10
  switches:
    light_led:
      command_on: echo -n 11 | nc 192.168.1.100 6722
      command_off: echo -n 21 | nc 192.168.1.100 6722
      command_state: echo -n 00 | nc -q 1 <ip_addr> <port>
      value_template: "{{ value[0:1] == '1' }}"
      friendly_name: LED
    light_left:
      command_on: echo -n 12 | nc 192.168.1.100 6722
      command_off: echo -n 22 | nc 192.168.1.100 6722
      command_state: echo -n 00 | nc -q 1 <ip_addr> <port>
      value_template: "{{ value[0:1] == '1' }}"
      friendly_name: Left

But it won’t work correctly. Either it will turn on one of the lights and immediately turn state off, which then won’t let me turn it off as it thinks it is already off. I can’t tell if this is becauce of me not including -q 1 or because of "{{ value[0:1] == '1' }}"

My board is a two relay board. The state options are as following:

Both on: 11000000
CH1 on: 10000000
CH2 on: 01000000
Both off: 00000000

Doesn’t the value_template option check for 1 on either the first or second place of the response leading to this confusion between the two relays? I’m not very familiar with the value_template options unfortunately.

I’ve got the same setup with a Dobiss ip controller.
How did you find the hex string for each light point?

i too have the dobiss , i control now everything with it
do you have evolution or the newer one? the hex strings depends what controller you have

i only got the ambiance pro with canbus programmer, i don’t have the webserver module only the ip module.(DO5435)
I tried with network sniffing to get some information out the app but i didn’t find anything usefull

no, sniffering is not possible :slight_smile:
webserver is not needed for this control, i have now my new webserver created in HA :slight_smile:

you can also send a command to receive the status of your light, so that you can change the state of a light to on/off if you turn on your light with your switches
i use template lights/switches for it, those i also have exposed to google assistant :slight_smile:
also for your moods, you can control them also

Thanks!
I’ve been looking to controll my installation without the dobiss app for a while!
Downloaded it!

ok, thnx :slight_smile:

Great that you have this information!
i’m just started with home-assistant and i don’t have any programming skills
I’m spending a bit of time trying to learn some basics but it isn"t going very well
I can’t find the right hex string
I’ve got 1 module, a relay with adress 1 and 12 outputs(lights) with numbers from 1 to 12.

i’ve tried this to toggle the fifth light on relay1:

echo -e “\0x01\0x05\0x02\0xFF\0xFF\0x64\0xFF\0xFF” | nc 192.168.1.9 1001

but it isn’t working.

have a look in this thread, my post #9

Took me some time but finally found how to make the string and controll the lights!
Do you know how to find the OutputID of the lightpoints and moods?
Found the most lights with trial and error but didn’t find any moods.
Thanks again for the PDF!