I’ve been struggling with an mqtt configuration problem. I’m replacing an old alarm controller with a microcontroller based one. I’d like it to show in Home Assistant as a single device with multiple sensors, as shown in the image.
If I edit the configuration.yaml file with the following, it produces the above:
# Manually configured MQTT entities
mqtt:
- binary_sensor:
- name: EntryMotion
device_class: motion
state_topic: "home/EntryMotion"
payload_on: 1
payload_off: 0
unique_id: mysensor1
device:
identifiers: HouseAlarm-ID
name: HouseAlarm
- name: RumpusMotion
device_class: motion
state_topic: "home/RumpusMotion"
payload_on: 1
payload_off: 0
unique_id: mysensor2
device:
identifiers: HouseAlarm-ID
name: HouseAlarm
However, coding this into mqtt discovery messages produces a device with one sensor and one orphaned sensor as a separate identity:
Topic: homeassistant/binary_sensor/EntryMotion/config
{
"name": "EntryMotion",
"device_class": "motion",
"state_topic": "homeassistant/binary_sensor/EntryMotion/state",
"payload_on": 1,
"payload_off": 0,
"unique_id": "mysensor1",
"device": {"identifiers": ["HouseAlarm-ID"], "name": "HouseAlarm"},
"retain": true
}
Topic: homeassistant/binary_sensor/RumpusMotion\config
{
"name": "RumpusMotion",
"device_class": "motion",
"state_topic": "homeassistant/binary_sensor/RumpusMotion/state",
"payload_on": 1,
"payload_off": 0,
"unique_id": "mysensor2",
"device": {"identifiers": ["HouseAlarm-ID"], "name": "HouseAlarm"},
"retain": true
}
This isn’t my first try - I have multiple temperature / humidity sensors that work this way and they configure multiple sensors fine. It just seems to be the binary_sensor I’m having issues with.
Any help would be appreciated.
Thanks,
Phil