Closed genestealer closed 5 months ago
How about this, the devices are split by OOK zone code?
This would mean that if you have a 4-way gang or double socket/switch they would share the same device entry, and this should only be defined once. So something like:
- unique_id: subwoofer
name: "Subwoofer"
command_topic: energenie/ook/8887/1/command
optimistic: false
state_topic: energenie/ook/8887/1/state
availability_topic: energenie/availability/state
device:
name: "energenie 4 gang"
identifiers: ["ook-8887"]
model: "4 Way Extension Lead [8887]"
manufacturer: "energenie"
via_device: "mqtt-ener314rt"
- unique_id: fountain
name: "Fountain"
command_topic: energenie/ook/8887/4/command
optimistic: false
state_topic: energenie/ook/8887/4/state
availability_topic: energenie/availability/state
device:
identifiers: ["ook-8887"]
Similarly you could group devices together if you use the same zone; this could possibly allow for switch 0 (all in zone) switching too; providing I can come up with a good way to dealing with the multiple states...
@Achronite I personally wish to keep the "appliance" which I'm controlling abstracted from the thing which is used to switch it on and off. E.G. Fountain and Coffee maker may share the same 4-gang, but I have no reason to groups them together in the device registry.
I'm not a fan of zone 0 switching, as home assistant will not see it as each device being commanded, rather zone 0 would be just another device in the map. Rather, if you want to perform the equivalent to command all devices of a zone, create a helper in home assistant which groups all the devices together. E.G. If you want to switch all things connected to a 4-gang, make a helper switch in home assistant and add the devices which are connected to the 4-gang to it.
@genestealer FYI - I've decided that the suggestion for the README to make the primary entity name=null, should be implemented for the non-heating devices via MQTT Discovery:
I don't know what to set the primary entity to for the thermostat / eTRV... I'm thinking of Climate_Control - Do you have any preference?
I'll release it soon
@genestealer Code released to develop.
This table is missing some primary entities, let me know if you have any suggestions:
Device | Description | Primary Entity name now set to null |
---|---|---|
MIHO004 | MiHome Smart Monitor Plug (Pink) | |
MIHO005 | MiHome Smart Plug+ (Purple) | switch |
MIHO006 | MiHome House Monitor | |
MIHO013 | MiHome Radiator Valve | |
MIHO032 | MiHome Motion sensor | motion |
MIHO033 | MiHome Open Sensor | contact |
MIHO069 | MiHome Heating Thermostat |
@Achronite I'm currently out today but I will have a look when I get home later tonight 😁
Updated table: | Device | Description | Primary Entity name set to null |
---|---|---|---|
MIHO004 | MiHome Smart Monitor Plug (Pink) | real power | |
MIHO005 | MiHome Smart Plug+ (Purple) | switch | |
MIHO006 | MiHome House Monitor | apparent power | |
MIHO013 | MiHome Radiator Valve | climate control | |
MIHO032 | MiHome Motion sensor | motion | |
MIHO033 | MiHome Open Sensor | contact | |
MIHO069 | MiHome Heating Thermostat | climate control |
I'm just about to add a change that these 'main' entities will also be the only ones that contain the details about the parent device in the MQTT discovery messages; the others will just have their ids
set.
@Achronite Sorry got home late last night. Yes those all look great.
develop code has been updated.
@Achronite Will pull it now
UPDATE
I was wrong on one point. "Some MQTT entities have an entity name equal to the device name. This is not expected. The entity name is set to
null
as a work-a-round to avoid a duplicate name." "This stops working in version 2024.2.0. Please address before upgrading."I have updated the examples to reflect the same naming as we have in the MQTT discovery, I have avoided using
null
.Description
I'd like to propose a modification to the readme to better align with Home Assistant's Device Registry behavior. The current example might lead to unexpected results due to inconsistencies in device grouping.
Issue
Suggestion
Issue Example
See the example below for that happens if different entities are attempted to be "grouped" under one device. Results in the "issue", where the first entities device settings are taken as ther master version for all following entities
Suggested Fix
For single devices, e.g. A light with only On/Off:
Example of device with multiple entities:
Examples