Hi all,
I just installed HA (based on image on Raspberry Pi) and it looks pretty nice.
Now I have a CO2. humidity and temperature sensor which sends its data through MQTT.
So I installed the MQTT broker (Mosquitto) on my HomeAssistant and configured it correctly. Additionally I configured my sensor to send its data to the broker.
So far this works fine. I can even connect with mosquitto_sub and see the messages from my sensor dropping in:
root@zentrale:~# mosquitto_sub -h hass -t hass/sensor/schlafzimmer/luftsensor -u mqtt -P "xxxxxxx"
{"meta":{"sn":75,"ip":"192.168.22.60","name":"Unipi IAQ Sensor RW-THC","desc":"IAQ RW-THC Schlafzimmer","fw_version":"3.4","uptime":1533,"heap_size":123.184,"heap_size_min":93.184,"rst_0":12,"rst_1":12,"http_server_state":5,"http_server_counter":42,"wifi_rssi":-78.200088500976562},"temperature":24.15,"relative_humidity":43.72,"absolute_humidity":9.57,"dew_point":11.03,"CO2":463.69,"atm_pressure":1003.56,"ambient_light":20.88,"VOC_index":42.08,"VOC_equiv_CO2":529.84,"VOC_accuracy":1}
Even I did a lot of reading about MQTT autodiscovery and al lot of related stuff I am absolutely unsure how to go from here.
I would guess I have to configure it somehow in configuration.yaml. Regarding to read the json data correctly as shown here.
sensor:
platform: mqtt
state_topic: 'hass/sensor/schlafzimmer/luftsensor'
name: 'temp_sz'
unit_of_measurement: '°C'
value_template: '{{ value_json.temperature }}'
In the logs I see:
Logger: homeassistant.components.sensor
Source: components/mqtt/__init__.py:368
Integration: Sensor (documentation, issues)
First occurred: 09:50:55 (8 occurrences)
Last logged: 09:51:18
Error adding entities for domain sensor with platform mqtt
Error while setting up mqtt platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 697, in add_to_platform_finish
await self.async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 588, in async_added_to_hass
await self._subscribe_topics()
File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 249, in _subscribe_topics
self._sub_state = await subscription.async_subscribe_topics(
File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 93, in async_subscribe_topics
await requested.resubscribe_if_necessary(hass, current)
File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 48, in resubscribe_if_necessary
self.unsubscribe_callback = await mqtt.async_subscribe(
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 368, in async_subscribe
async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'
Anyone having a clue what is wrong here? And yes, I tried to use the documentation but it does not explain how to add such a sensor at all
I guess I have to create some sort of mapping. But hoe?
Thanks
/KNEBB