Hi all,
I have simillar problem with convert from hex to binary.
I have a switch in command_lines
- switch:
scan_interval: 1
unique_id: switch_no_1
command_on: echo -n 11 | nc IP 6722
command_off: echo -n 21 | nc IP 6722
command_state: echo -n '00:0^' | nc IP 6722 | sed -En 's/HX02([0-9A-F]{4})/\1/p'
#command_state is receiving in hex 4 chars
value_template: '{{ value[0:1] == "1" }}'
name: "Friendly Name"
After conversion from hex to binary, I should receive 16 chars 0-1.
Each char represent one of relay from board with 16 switches (SR201-M-16)
My question is how to fix command_state or value_template to be able to determine if eg swith 8 or switch 16 is on or off?
Example:
0000000100000001
indicates that relay 8 and 16 is on