Hi all,
I have a few heaters around the house, they are controlled by a PLC that turns on and off relays in my cabinet. I send commands to this PLC from Node Red and Node Red is publishing the state of the heaters using MQTT. I managed to set this up in Node Red so that they are autodiscovered in home assistant, I followed a bunch of posts in here and other places some time ago, I hardly remember it anymore.
But, now I would like to add a sensor to each of these heaters so that I see power consumption as well.
Currently I have a function node for each of them were I give them node_id like
bedroom_2nd_fl_heat
, name
, manufacturer
etc and then a change node where I set the stuff that I publish to the MQTT broker like this:
{
"command_topic": "homeassistant/switch/" & $.payload.node_id & "/set",
"state_topic": "homeassistant/switch/" & $.payload.node_id & "/state",
"name": $.payload.name,
"icon": $.payload.icon,
"unique_id": $.payload.node_id,
"device": {
"identifiers": [$.payload.node_id],
"model": $.payload.model,
"manufacturer": $.payload.manufacturer
},
"availability_topic": "homeassistant/switch/" & $.payload.node_id & "/availability"
}
I also publish to the /config, which I think is needed for home assistant to discover it:
"homeassistant/switch/" & $.payload.node_id & "/config"
This works, and they pop up in home assistant as a device looking like this:
Now I want to add another entity in there called power, so that I get one device with multiple entities, like one of my ZigBee2Mqtt sensors for example:
I have read and tried to understand the Home assistant MQTT discovery and for sensors with multiple values I need to add multiple configuration topic submissions but I can’t understand how to do this.