Hi there.
I am stuck. I’ve tried to figure this out for a good few hours now, but I just can’t figure out the syntax.
I have 4 byte blocks that come in on the serial port. Byte 2 is the address.
Using IF statements, I want to be able to match the address to the entity.
Heres my code. Everything works other than the RF1 entity which I would like to respond when the address coming in = 1
sensor:
- platform: serial
scan_interval: 0
serial_port: /dev/ttyUSB0
baudrate: 9600
bytesize: 8
parity: N
stopbits: 1
- platform: template
sensors:
RFinfo:
friendly_name: RF info
unit_of_measurement: ""
value_template: "{{ states('sensor.serial_sensor') [1:2] | ord }}"
RF1:
friendly_name: RF1 device
unit_of_measurement: ""
value_template: {{ IF states('sensor.serial_sensor') [1:2] | ord = 1 }}
Triggered
Hope someone can help as this has me baffled.
Thanks.
2 posts - 2 participants