Allow grouping entities as a single HomeKit device

Hello,

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.

Regards

1 Like

I am very surprised this feature is not implemented yet and nobody has upvoted the request. Will try to add this functionality myself.

3 Likes

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.

1 Like

I think this is the same request: Allow grouping entities as a single HomeKit device - Feature Requests - Home Assistant Community (home-assistant.io)

Would be amazing, you got my vote!

1 Like

+1 from me

1 Like

Is there any new information about this feature?

2 Likes

+1 - need this for my fan entity to move left or right a step. This is the only thing that’s stopping me from scrapping my homebridge setup.

1 Like

I would really love to see this. There are a number of different threads out there that seem to be asking for the same sort of functionality:

2 Likes

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

   @callback
    def async_update_state(self, new_state: State) -> None:

however for now I have acheived the grouping

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…

5 Likes

Does anybody know if possible to use heater/cooler in Home Assistant? This could help me to combine thermostat + fan into one device.

5 years later and this is still not implemented?

homebridge can do it:

i managed to get this behaviour using homebridge and homebridge-mqttthing plugin with the following config:

{
            "accessory": "mqttthing",
            "type": "custom",
            "name": "Living Room Lights",
            "url": "mqtt://IP:PORT",
            "username": "USER",
            "password": "PASS",
            "logMqtt": true,
            "services": [
                {
                    "type": "lightbulb",
                    "name": "Left",
                    "topics": {
                        "getOn": {
                            "topic": "zigbee2mqtt/Living Room Switch",
                            "apply": "const d = JSON.parse(message); return d.state_left === 'ON';"
                        },
                        "setOn": {
                            "topic": "zigbee2mqtt/Living Room Switch/set",
                            "apply": "return JSON.stringify({ state_left: message ? 'ON' : 'OFF' });"
                        }
                    }
                },
                {
                    "type": "lightbulb",
                    "name": "Right",
                    "topics": {
                        "getOn": {
                            "topic": "zigbee2mqtt/Living Room Switch",
                            "apply": "const d = JSON.parse(message); return d.state_right === 'ON';"
                        },
                        "setOn": {
                            "topic": "zigbee2mqtt/Living Room Switch/set",
                            "apply": "return JSON.stringify({ state_right: message ? 'ON' : 'OFF' });"
                        }
                    }
                }
            ]
        }
4 Likes

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 ?

1 Like

the solution is literally above your comment

1 Like

not really? thats using homebridge rather than homeassistant which kinda defeats the point.
I am migrating out of homebridge to HA

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.

2 Likes