From 3178a138f6e34f636512a8eb6eaeb1efae604064 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 20 Oct 2018 12:50:21 +0200 Subject: [PATCH] Add PMSX003 Particulate Matter Sensor (#58) * Add PMSX003 Particulate Matter Sensor * Add warning * Fix index --- api/sensor/index.rst | 1 + api/sensor/pmsx003.rst | 25 +++++++++ esphomeyaml/components/sensor/index.rst | 1 + esphomeyaml/components/sensor/pmsx003.rst | 65 +++++++++++++++++++++++ esphomeyaml/images/pmsx003.svg | 36 +++++++++++++ esphomeyaml/index.rst | 23 +++++--- esphomeyaml/sensor.csv | 1 + 7 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 api/sensor/pmsx003.rst create mode 100644 esphomeyaml/components/sensor/pmsx003.rst create mode 100644 esphomeyaml/images/pmsx003.svg diff --git a/api/sensor/index.rst b/api/sensor/index.rst index ae85c1671..e16357321 100644 --- a/api/sensor/index.rst +++ b/api/sensor/index.rst @@ -35,6 +35,7 @@ See :cpp:func:`Application::register_sensor`. mpu6050 mqtt_subscribe ms5611 + pmsx003 pulse_counter rotary_encoder sht3xd diff --git a/api/sensor/pmsx003.rst b/api/sensor/pmsx003.rst new file mode 100644 index 000000000..25098930a --- /dev/null +++ b/api/sensor/pmsx003.rst @@ -0,0 +1,25 @@ +PMSX003 Particulate Matter Sensor +================================= + +.. cpp:namespace:: nullptr + +See :cpp:func:`Application::make_pmsx003`. + +API Reference +------------- + +.. cpp:namespace:: nullptr + +.. doxygenclass:: sensor::PMSX003Component + :members: + :protected-members: + :undoc-members: + +.. doxygenclass:: sensor::PMSX003Sensor + :members: + :protected-members: + :undoc-members: + +.. doxygenenum:: sensor::PMSX003SensorType + +.. doxygenenum:: sensor::PMSX003Type diff --git a/esphomeyaml/components/sensor/index.rst b/esphomeyaml/components/sensor/index.rst index 9e52fbc88..b5edb84b8 100644 --- a/esphomeyaml/components/sensor/index.rst +++ b/esphomeyaml/components/sensor/index.rst @@ -349,6 +349,7 @@ See Also mqtt_subscribe ms5611 pulse_counter + pmsx003 rotary_encoder sht3xd tcs34725 diff --git a/esphomeyaml/components/sensor/pmsx003.rst b/esphomeyaml/components/sensor/pmsx003.rst new file mode 100644 index 000000000..68ec3bf2f --- /dev/null +++ b/esphomeyaml/components/sensor/pmsx003.rst @@ -0,0 +1,65 @@ +PMSX003 Particulate Matter Sensor +================================= + +.. warning:: + + This integration is experimental as I don't have the hardware to test it (yet). + If you can verify it works (or if it doesn't), notify me on `discord `__. + +The ``pmsx003`` sensor platform allows you to use your PMS5003, PMS7003, ... particulate matter +(`datasheet `__) +sensors with esphomelib. + +As the communication with the PMSX003 is done using UART, you need +to have an :ref:`UART bus ` in your configuration with the ``rx_pin`` connected to the SEND/TX pin +(may also be called the RX pin, depending on the model) of the PMS. Additionally, you need to set the baud rate to 9600. + +This platform supports three sensor types, which you need to specify using the ``type:`` configuration +value: + +- ``PMSX003`` for generic PMS5003, PMS7003, ...; these sensors support ``pm_1_0``, ``pm_2_5`` and ``pm_10_0`` output. +- ``PMS5003T`` for PMS5003T. These support ``pm_2_5``, ``temperature`` and ``humidity``. +- ``PMS5003ST`` for PMS5003ST. These support ``pm_2_5``, ``temperature``, ``humidity`` and ``formaldehyde``. + +.. code:: yaml + + # Example configuration entry + uart: + rx_pin: GPIO23 + + sensor: + - platform: pmsx003 + type: PMX003 + pm_1_0: + name: "Particulate Matter <1.0µm Concentration" + pm_2_5: + name: "Particulate Matter <2.5µm Concentration" + pm_10_0: + name: "Particulate Matter <10.0µm Concentration" + +Configuration variables: +------------------------ + +- **pm_1_0** (*Optional*): Use the concentration of particulates of size less than 1.0µm in µg per cubic meter. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **pm_2_5** (*Optional*): Use the concentration of particulates of size less than 2.5µm in µg per cubic meter. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **pm_10_0** (*Optional*): Use the concentration of particulates of size less than 10.0µm in µg per cubic meter. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **temperature** (*Optional*): Use the temperature value in °C for the ``PMS5003T`` and ``PMS5003ST``. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **humidity** (*Optional*): Use the humidity value in % for the ``PMS5003T`` and ``PMS5003ST``. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **formaldehyde** (*Optional*): Use the formaldehyde (HCHO) concentration in µg per cubic meter for the ``PMS5003ST``. + All options from :ref:`Sensor ` and :ref:`MQTT Component `. +- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`UART Component ` if you want + to use multiple UART buses. + +See Also +-------- + +- :ref:`sensor-filters` +- :doc:`API Reference ` +- `Edit this page on GitHub `__ + +.. disqus:: diff --git a/esphomeyaml/images/pmsx003.svg b/esphomeyaml/images/pmsx003.svg new file mode 100644 index 000000000..1c423b368 --- /dev/null +++ b/esphomeyaml/images/pmsx003.svg @@ -0,0 +1,36 @@ + +image/svg+xmlPMSX003 + \ No newline at end of file diff --git a/esphomeyaml/index.rst b/esphomeyaml/index.rst index 443bb9533..95ee21ab5 100644 --- a/esphomeyaml/index.rst +++ b/esphomeyaml/index.rst @@ -234,21 +234,25 @@ Sensor Components -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- `MPU6050`_ `MQTT Subscribe`_ `MS5611`_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -|Pulse Counter|_ |Rotary Encoder|_ |SHT3X-D|_ +|PMSX003|_ |Pulse Counter|_ |Rotary Encoder|_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -`Pulse Counter`_ `Rotary Encoder`_ `SHT3X-D`_ +`PMSX003`_ `Pulse Counter`_ `Rotary Encoder`_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -|TCS34725|_ |Template Sensor|_ |TSL2561|_ +|SHT3X-D|_ |TCS34725|_ |Template Sensor|_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -`TCS34725`_ `Template Sensor`_ `TSL2561`_ +`SHT3X-D`_ `TCS34725`_ `Template Sensor`_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -|Ultrasonic Sensor|_ |Uptime Sensor|_ |WiFi Signal Strength|_ +|TSL2561|_ |Ultrasonic Sensor|_ |Uptime Sensor|_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -`Ultrasonic Sensor`_ `Uptime Sensor`_ `WiFi Signal Strength`_ +`TSL2561`_ `Ultrasonic Sensor`_ `Uptime Sensor`_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -|Xiaomi MiFlora|_ |Xiaomi MiJia|_ |Custom Sensor|_ +|WiFi Signal Strength|_ |Xiaomi MiFlora|_ |Xiaomi MiJia|_ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -`Xiaomi MiFlora`_ `Xiaomi MiJia`_ `Custom Sensor`_ +`WiFi Signal Strength`_ `Xiaomi MiFlora`_ `Xiaomi MiJia`_ +-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- +|Custom Sensor|_ +-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- +`Custom Sensor`_ ================================================== ================================================== ================================================== .. |Sensor Core| image:: /esphomeyaml/images/folder-open.svg @@ -332,6 +336,9 @@ Sensor Components .. |MS5611| image:: /esphomeyaml/images/ms5611.jpg :class: component-image .. _MS5611: /esphomeyaml/components/sensor/ms5611.html +.. |PMSX003| image:: /esphomeyaml/images/pmsx003.svg + :class: component-image +.. _PMSX003: /esphomeyaml/components/sensor/pmsx003.html .. |Pulse Counter| image:: /esphomeyaml/images/pulse.svg :class: component-image .. _Pulse Counter: /esphomeyaml/components/sensor/pulse_counter.html diff --git a/esphomeyaml/sensor.csv b/esphomeyaml/sensor.csv index affee9fe4..217ba0700 100644 --- a/esphomeyaml/sensor.csv +++ b/esphomeyaml/sensor.csv @@ -25,6 +25,7 @@ MH-Z19, components/sensor/mhz19, mhz19.jpg MPU6050, components/sensor/mpu6050, mpu6050.jpg MQTT Subscribe, components/sensor/mqtt_subscribe, mqtt.png MS5611, components/sensor/ms5611, ms5611.jpg +PMSX003, components/sensor/pmsx003, pmsx003.svg Pulse Counter, components/sensor/pulse_counter, pulse.svg Rotary Encoder, components/sensor/rotary_encoder, rotary_encoder.jpg SHT3X-D, components/sensor/sht3xd, sht3xd.jpg