MH-Z19 CO_2 and Temperature Sensor¶
The mhz19
sensor platform allows you to use MH-Z19 CO_2 and temperature sensors
(refspace) with ESPHome.
As the communication with the MH-Z19 is done using UART, you need
to have an UART bus in your configuration with the rx_pin
connected to the TX pin of the
MH-Z19 and the tx_pin
connected to the RX Pin of the MH-Z19 (it’s switched because the
TX/RX labels are from the perspective of the MH-Z19). Additionally, you need to set the baud rate to 9600.
# Example configuration entry
uart:
rx_pin: D0
tx_pin: D1
baud_rate: 9600
sensor:
- platform: mhz19
co2:
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
Configuration variables:¶
- co2 (Required): The CO_2 data from the sensor in parts per million (ppm).
- temperature (Required): The information for the temperature sensor. Please note that this is not officially documented in the datasheet and seems to be quite inaccurate.
- update_interval (Optional, Time): The interval to check the
sensor. Defaults to
60s
. - uart_id (Optional, ID): Manually specify the ID of the UART Component if you want to use multiple UART buses.