Sensor type is Honeywell CRIR Series CO2 sensor
Sensor data:
send to sensor: [0xFE, 0x04, 0x00, 0x07, 0x00, 0x01, 0x94, 0x04]
get from sensor: “\xFE\x04\x02\ x02\xEF \xED\xC8”
02EF (byte 3 and 4) is 16bit ppm value of 751
sensor:
- platform: template
name: "CO2"
id: uart_co2
unit_of_measurement: ppm
interval:
- interval: 10s
then:
# send uart query
- uart.write: [0xFE, 0x04, 0x00, 0x07, 0x00, 0x01, 0x94, 0x04]
uart:
id: uart_bus
tx_pin: 12
rx_pin: 13
baud_rate: 9600
debug:
direction: "RX"
dummy_receiver: True
sequence:
- lambda: |-
UARTDebug::log_string(direction, bytes);
// Read 16bit data from uart byte 3 and 4
id(uart_co2).publish_state(uint16_t((bytes[3] << 8) | bytes[4] ));
// use this if you have 8bit
id(uart_co2).publish_state( bytes[3] );