Hi Guys, i’m trying to work with a webrelay using raw TCP commands. (I know I could use node red, but I don’t want to setup the whole node environment only to on/off a relay.
This is my script:
switch:
name: "Pompa P0b"
unique_id: "pump_termo_p0"
scan_interval: 20
command_on: echo -n -e '\x31\x05\x01\x00\x00\x00\x00\' | nc 192.168.1.16 18165
command_off: echo -n -e '\x31\x05\x00\x00\x00\x00\x00\' | nc 192.168.1.16 18165
command_state: echo -n -e '\x33\x05\' | nc 192.168.1.16 18165
value_template: "{{ value[0] == '1' }}"
IT works, I mean, it correctly on/off the relay but…
- Every time I manually switch on I see a popup message like this:
And honestly speaking, I don’t understand why
- The command state doesn’t work. I mean, something goes wrong interpreting the result
Using the Packet send utility I see that the relay answers to my state request with 5 bytes:
01 00 80 00 30
where the first byte is the status. So, into my value template I should compare only the first value… But I suppose that something is wrong in my template…
Any suggesitons?