2018-10-14 18:43:58 +02:00
|
|
|
MQTT Subscribe Sensor
|
|
|
|
=====================
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
|
|
|
:description: Instructions for setting up MQTT subscribe sensors
|
|
|
|
:image: mqtt.png
|
|
|
|
:keywords: MQTT
|
|
|
|
|
2018-10-14 18:43:58 +02:00
|
|
|
The ``mqtt_subscribe`` sensor platform allows you to get external data into esphomelib.
|
|
|
|
The sensor will subscribe to messages on the given MQTT topic and parse each message into
|
|
|
|
a floating point number.
|
|
|
|
|
|
|
|
Please note this integration only works with MQTT topics that have numeric data! Each time
|
|
|
|
a message that is not a number is published a warning will be shown. Please use the MQTT subscribe
|
|
|
|
text sensor for importing arbitrary text into the esphomelib ecosystem.
|
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-10-14 18:43:58 +02:00
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
sensor:
|
|
|
|
- platform: mqtt_subscribe
|
|
|
|
name: "Data from topic"
|
|
|
|
id: mysensor
|
|
|
|
topic: the/topic
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name of the sensor.
|
|
|
|
- **topic** (**Required**, string): The MQTT topic to listen for numeric messages.
|
|
|
|
- **qos** (*Optional*, int): The MQTT QoS to subscribe with. Defaults to ``0``.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
|
|
|
- :ref:`sensor-filters`
|
2019-02-07 13:54:45 +01:00
|
|
|
- :apiref:`sensor/mqtt_subscribe_sensor.h`
|
|
|
|
- :ghedit:`Edit`
|
2018-10-14 18:43:58 +02:00
|
|
|
|
|
|
|
.. disqus::
|