I have followed the temperature and humidity sensor setup as per the mqtt documentation here.
The problem I’m experiencing is that only the temperature sensor definition is being updated when a new temperature value arrives. When I flip the config around, i.e. place the humidity sensor last, then only the humidity sensor is updated. The other value stays as unknown.
Is the doc I followed still valid or has something changed?
The message that I’m publishing to the Mosquitto broker on the HA server from another pi is received in HA as follows.
Message 0 received on home/garage/sensor1 at 22:56:
{
"temperature": 26.9,
"humidity": 53.9
}
My sensor include file defines my sensor as follows. (I tried many combinations, including placing the config in the configuration.yaml file.)
- platform: mqtt
state_topic: '/home/garage/sensor1'
name: 'Garage Humidity'
unit_of_measurement: '%'
value_template: '{{ value_json.humidity }}'
- platform: mqtt
state_topic: 'home/garage/sensor1'
name: 'Garage Temperature'
unit_of_measurement: '°C'
value_template: '{{ value_json.temperature }}'
I cannot see any messages regarding the matt sensors in the log.
Messages to HA are only published roughly every 5 mins, which is an average of the last couple of sensor readings.
No other messages are being sent other than the message with the temperature and humidity values as above. There are also no other mqtt sensors on the network.
I’m running Hassio (Home Assistant OS?) v2020.12.2
Any idea of what I’m missing?