Hello,
I am trying to define a DHT22 sensor (temperature & humidity) with 1 Json definition according to the example in the MQTT documentation.
So I am having 1 device (dht22_1) with 2 components (dht22_t and dht22_h) and the objective is to send 1 config message for both components (at least this is my understanding about the device based discovery scheme).
The config message is received and the config payload seems to be right. Also the state payload can be seen and is linked to the dht22_1 device.
However, no sensor value is really recognized and is shown up in the MQTT broker or as individual homeassistant sensor entity.
My config payload:
{
"device": {
"identifiers": "dht22_1",
"name": "dht22_1c"
},
"origin": {
"name": "cellar_1"
},
"components": {
"dht22_t": {
"platform": "sensor",
"device_class": "temperature",
"unit_of_measurement": "°C",
"value_template": "{{value_json.temperature}}",
"unique_id": "DHT22_t1"
},
"dht22_h": {
"platform": "sensor",
"device_class": "humidity",
"unit_of_measurement": "%",
"value_template": "{{value_json.humidity}}",
"unique_id": "dht22_h1"
}
},
"state_topic": "homeassistant/sensor/dht22_1/state"
}
My config topic: homeassistant/sensor/dht22_1/config
My state topic: homeassistant/sensor/dht22_1/state
with the payload of {“temperature”:19.8,“humidity”:45}
The only entity I do see is in the the homeassistant entity overview is a mqtt sensor:
Inside the mqtt debug session I find:
[homeassistant.components.mqtt.discovery] Pending discovery for (‘sensor’, ‘dht22_1’): deque() which means that the discovery is pending, but I don’t know why.
So, what I am doing wrong as this is almost identical to the example in the documentation?
Thanks for your help in advance.