I have a number of temperature sensors around the house that publish their values to mqtt. HA has mqtt sensors defined to capture these sensors, but I can’t find a way to assign them to a particular room (area).
Any ideas?
I have a number of temperature sensors around the house that publish their values to mqtt. HA has mqtt sensors defined to capture these sensors, but I can’t find a way to assign them to a particular room (area).
Any ideas?
Areas are only available for integrations as faar as I know.
Does anyone know if this is a planned future feature?
I have several MQTT sensors (zigbee2mqtt xiaomi temperature and esprflink temparature) assigned to areas.
Ah! see thats the issue. My MQTT sensors dont even appear in the Devices list. It only shows up in the Entities list and the Homekit integrations through config.yaml
MQTT sensors that are defined in yaml don’t show up as devices. You have to write a discovery message to have them discovered as devices.
Ok. I wrote the discovery message. It was detected.
Now I can see the MQTT device state in Developer Tools > State. But I still cant see it in the Devices list.
I’ll give an example of a 433Mhz temperature and humidity sensor
topic:
homeassistant/sensor/xiron_3201/temperature/config
discovery message :
'{"unit_of_measurement":"°C","device_class":"temperature","value_template":"{{ value_json.TEMP }}","state_topic":"rflink/Xiron-3201","name":"eetkamer_temperature","unique_id":"eetkamer_temperature","device":{"identifiers":["xiron_3201"],"name":"xiron_3201","model":"Digoo temp & humidity sensor","manufacturer":"Digoo"}}'
The important part to create a device in the device list is to add a device in your discovery message, the part : “device”:{“identifiers”:[“xiron_3201”],“name”:“xiron_3201”,“model”:“Digoo temp & humidity sensor”,“manufacturer”:“Digoo”}
Here is what I sent.
"name": "garage",
"device_class": "temperature",
"state_topic": "homeassistant/sensor/garage_metrics",
"unit_of_measurement": "°F",
"value_template": "{{ value_json.Temp }}",
"json_attributes_topic": "garage_metrics",
"json_attributes_template": "{{ value_json | tojson }}",
"device": {
"identifiers": [
"ESP_BME_280"
],
"name": "ESP_MBE_280",
"model": "ESP BME temp & humidity sensor",
"manufacturer": "Unusual Doubt"
}
}
Here is what I see in Developer Tools -> State
sensor.garage_humidity 55 unit_of_measurement: %
friendly_name: garage_humidity
device_class: humidity
sensor.garage_temperature 81 unit_of_measurement: °F
friendly_name: garage_temperature
sensor.home_humidity 73 unit_of_measurement: %
friendly_name: Home Humidity
device_class: humidity
I reads the JSON properly as you can see it read the values! It shows up nicely in the iOS app. Just wont on the device list!
Thanks for persisting with me on this.
I published this :
{
"name": "garage",
"device_class": "temperature",
"state_topic": "homeassistant/sensor/garage_metrics",
"unit_of_measurement": "°F",
"unique_id": "ESP_BME_280_12345",
"value_template": "{{ value_json.Temp }}",
"json_attributes_topic": "garage_metrics",
"json_attributes_template": "{{ value_json | tojson }}",
"device": {
"identifiers": [
"ESP_BME_280"
],
"name": "ESP_MBE_280",
"model": "ESP BME temp & humidity sensor",
"manufacturer": "Unusual Doubt"
}
}
And I got this :
Edit : best to check the retain checkbox if you try it yourself
How did you add multiple sensors under the same device?
By assigning each sensor to the same device identifier?
The answer was to have different unique_id but same device identifier