I wondering why not expose multiple services of a device under a single HomeKit accessory entity? This allows for better readability in the Home or Eve app.
For example a Xiaomi Mi Smart Home Temperature / Humidity Sensor will expose 3 services Temperature, humidity and pressure.
Would this idea mean that services that may be exposed as individual entities would also be linked as a “feature” (attribute) of the parent entity?
For example, I have an Ecobee thermostat and it has preset modes. Homekit exposes a current_mode entity that allows me to change the mode, but this isn’t also exposed as an attribute of the thermostat entity itself, so when creating a thermostat card, the mode isn’t available as an optional feature I can display; I have to create a separate card for it.
I came here looking to see if this was suggested and found this… hoping this is exactly what I was looking for as a feature request.
I would find this useful. I have 2 book cases, each with 4 shelves, each with an LED strip light. I have 2 Shelly WRGB controllers which expose the 8 light strips as individual dimmable lights. Really I want to group each book case and it’s set of 4 lights as a single dimmable light - and then expose this to HomeKit.
Actually I may be able to do this - create a group helper in HA for the 4 lights and expose that. Not tried it but seems possible.
I did expose all 4 lights to HomeKit and then group them together at that side.
I did get it to work partially by introducing a hard patch inside the homekit integeration code. Although it would only work in my case because I know that all the fan devices configured in my home setup have light entities in them. I did it by making the homekit integeration as a custom component and then tinkered with the type_fans.py file code with the below code
:
@TYPES.register("Fan")
class Fan(HomeAccessory):
def __init__(self, *args: Any) -> None:
:
:
serv_light = self.add_preload_service(SERV_LIGHTBULB, self.light_chars)
serv_fan.add_linked_service(serv_light)
self.char_on = serv_light.configure_char(CHAR_ON, value=0, setter_callback=self.set_light_state)
:
:
def set_light_state(self, value: bool) -> None:
"""Set state if call came from HomeKit."""
light_entity_id = f"light.{split_entity_id(self.entity_id)[1]}"
_LOGGER.debug("%s: Set light to %d", light_entity_id, value)
params = {ATTR_ENTITY_ID: light_entity_id}
service = SERVICE_TURN_ON if value else SERVICE_TURN_OFF
self.async_call_service(LIGHT_DOMAIN, service, params)
however it is just partially working in the sense that I havent yet figured out on how to get the current state of the light entity to get passed on into the type_fans.py’s
ps: I am fairly new home assistant and just got mine up and running 2 weeks back. So please ignore any blunders in this post or in my code. Python isn’t my area of expertise too…
would really love this feature, ive spent the past few hours with chatgpt trying to replicate it using various ways like templates or composites but it always fails.
did you ever get anywhere @svyatogor ?
i’m also using HASS but for this grouping (and for example a proper LG TV integration), you need homebridge. not really a big deal honestly, both can co-exist and considering the backend is actually zigbee2mqtt, there are no conflicts
I would counter saying that to simply group multiple entities in Home Assistant, that the dependency of Homebridge is pretty excessive.
If the situation is that you need full support for something that needs Homebridge to work (as in, the plugin for Home Assistant doesn’t exist or doesn’t provide the necessary functionality), then sure - by all means say Homebridge is required.
However, if people just want to associate entities together in Home Assistant, that should be implemented in Home Assistant itself - especially since this request is specifically talking about grouping entities that come from the HomeKit integration in Home Assistant.
Personally, I have one single device I would like this feature for - to spin up Homebridge for just one device seems like a waste of limited resources on my little home server to resolve a purely cosmetic issue in Home Assistant.
Ah, not to nit pick, but this feature request is the other way around, it is about grouping entities from Home Assistant together when exposing them to HomeKit via the HomeKit Bridge integration, so that when you view them in Apple’s Home app, they appear as a single item.
I would consider using HomeBridge for this functionality a workaround, since this feature request is basically asking for Home Assistant’s built-in integration to gain the functionality that exists in HomeBridge.