SenseAir CO_2 Sensor
====================

.. seo::
    :description: Instructions for setting up SenseAir S8 CO2 sensor
    :image: senseair_s8.jpg
    :keywords: senseair_s8

The ``senseair`` sensor platform allows you to use SenseAir CO_2 sensor
(`website`_) with ESPHome.

.. figure:: images/senseair_s8-full.jpg
    :align: center
    :width: 50.0%

    SenseAir S8 CO_2 Sensor.

.. _website: https://senseair.com/products/size-counts/senseair-s8-residential/

As the communication with the SenseAir is done using UART, you need
to have an :ref:`UART bus <uart>` in your configuration with the ``rx_pin`` connected to the TX pin of the
sensor and the ``tx_pin`` connected to the RX Pin (it's switched because the
TX/RX labels are from the perspective of the SenseAir sensor). Additionally, you need to set the baud rate to 9600.

.. code-block:: yaml

    # Example configuration entry
    uart:
      rx_pin: D0
      tx_pin: D1
      baud_rate: 9600

    sensor:
      - platform: senseair
        co2:
          name: "SenseAir CO2 Value"
        update_interval: 60s

Configuration variables:
------------------------


- **co2** (**Required**): The CO_2 data from the sensor in parts per million (ppm).

  - **name** (**Required**, string): The name for the CO_2 sensor.
  - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
  - All other options from :ref:`Sensor <config-sensor>`.

- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
  sensor. Defaults to ``60s``.

- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`UART Component <uart>` if you want
  to use multiple UART buses.

- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for actions.

.. figure:: images/senseair_s8-pins.jpg
    :align: center
    :width: 80.0%

    Pins on the SenseAir S8. Only the ones marked with a red circle need to be connected.

.. note::

    ``G+`` should be connected to power supply (supported voltage is 4.5 V to 5.25 V), ``G0`` to ``GND`` pin


See Also
--------

- :ref:`sensor-filters`
- :apiref:`senseair/senseair.h`
- :ghedit:`Edit`
