Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic homebridge accessories #4

Closed
ebaauw opened this issue Oct 23, 2016 · 22 comments
Closed

Support dynamic homebridge accessories #4

ebaauw opened this issue Oct 23, 2016 · 22 comments

Comments

@ebaauw
Copy link
Owner

ebaauw commented Oct 23, 2016

Currently homebridge-hue uses static homebridge accessories, configured at start-up time.

With dynamic homebridge accessories, homebridge-hue could dynamically add or remove accessories as they are added to or removed from the Hue bridge, without restarting homebridge. Not sure if that's really a big win (how often do you buy new hue lights, switches, or sensors), but it could be handy for CLIP sensors and schedules.

However, the ability to store an accessory context might be useful to store the bridge username in the bridge accessory (once we support that) without the need to update manually config.json. Also, this would allow for config switches for lights, groups, sensors, schedules in the bridge accessory.

@ebaauw ebaauw changed the title Dynamic accessories Dynamic homebridge accessories Oct 23, 2016
@ebaauw ebaauw changed the title Dynamic homebridge accessories Support dynamic homebridge accessories Oct 23, 2016
@ebaauw
Copy link
Owner Author

ebaauw commented Dec 9, 2016

Note to self: also change mapping of reachable from Status Fault to accessory reachable state. This is supported by the iOS 10 Home app and how the square Philips Hue bridge exposes reachable.

@dylanslewis
Copy link

Another nice to have here, if supporting dynamic accessories, would be to have a dynamic heartrate value. This way you could have a fast polling time when you know the house will be busy, and low polling time when it is empty.

@ebaauw
Copy link
Owner Author

ebaauw commented Jan 2, 2017

Indeed, @dylanslewis . You could even switch the polling off altogether and only query the bridge when HomeKit apps actually request the value of the corresponding characteristic. Not sure what that would do to HomeKit triggers, though.

Also, I could implement some of the configuration parameters in config.json in HomeKit switches instead and change what resources homebridge-hue exposes on the fly.

@ebaauw ebaauw mentioned this issue Jan 6, 2017
@ebaauw
Copy link
Owner Author

ebaauw commented Jan 6, 2017

Actually, I don't need dynamic platform accessories for a dynamic heartrate. Opened separate issue #39 for this.

@ebaauw
Copy link
Owner Author

ebaauw commented May 7, 2017

Looks like I finally found a compelling reason to start working on this: on startup, deCONZ shows no /lights resources, even thought it has stored lights discovered in previous sessions in its database. It only restores the resource, after the light has been re-discovered in this session.

With dynamic platform accessories, homebridge-hue would expose all previously discovered accessories immediately on startup, but mark them as unreachable (in HomeKit context). When the resource becomes available, homebridge-hue would re-attach the accessory to the resource, and mark it as reachable. This would also solve any startup timing problems, where homebridge would start before homebridge-hue had created all accessories, causing HomeKit to delete the not yet exposed accessories.

This will be by far the biggest change to homebridge-hue. I need to refactor a large part of the code. I'll create a new v1.0 branch for these changes.

@netRunner0
Copy link

News?

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 24, 2019

News?

I just converted homebridge-zp to use dynamic platform accessories. Three plugins down, three to go. I'll be saving the best (homebridge-hue) for last: it has most users and I really want to iron out any design issues in homebridge-lib before refactoring homebridge-hue.

@simonnelli
Copy link

It seems that the lack of support for dynamic accessories of homebridge-hue interferes with other homebridge plugins that support dynamic accessories. See: johannrichard/homebridge-dingz#5 (comment)

@ebaauw
Copy link
Owner Author

ebaauw commented May 19, 2020

This has nothing to do with other plugins supporting dynamic accessories. It’s how Homebridge used to work before dynamic platform accessories (Homebridge Hue is over 5 years old). Static platform plugins need to inform Homebridge what accessories they want to expose, before Homebridge starts the HAP server. Homebridge Hue needs to (re-) connect to all Hue bridges mentioned under hosts in config.json, and, for new bridges, request an api key, requiring the user to press the link button, before it can pass the accessories back to HomeKit. During this time, homebridge runs, but the HAP server hasn’t started, and Homebridge cannot be reached by HomeKit.

When a bridge is unreachable, by design, Homebridge Hue waits for it to become reachable, delaying Homebridge startup. If Homebridge Hue wouldn’t do this, Homebridge would start without exposing the accessories, and HomeKit would delete them. On the next restart, the accessories would be exposed again, but HomeKit would see them as new accessories, having lost any associations to room, groups, scenes, and automations.

@simonnelli
Copy link

simonnelli commented May 19, 2020 via email

@Tyraenor
Copy link

Hi,

are there any news on this?

@ebaauw
Copy link
Owner Author

ebaauw commented Oct 17, 2020

If there were, I’d post them here.

@ebaauw
Copy link
Owner Author

ebaauw commented Jan 9, 2021

Did a big refactor in v0.12.13 of the supporting classes (to handle the very different behaviour of the latest Hue bridge firmware), but the platform plugin itself is still on the TODO list.

@Nastras
Copy link

Nastras commented Mar 14, 2021

Hello Erik,

since i read in the latest update that you are starting to prepare homebridge-hue for the transition to dynamic platform i wanted to ask when the time comes if i need to disconnect the homebridge instance from hk for this or will it be an easy transition?

Thanks!

@ebaauw
Copy link
Owner Author

ebaauw commented Mar 14, 2021

I think I'll be able to provide an upgrade while keeping the HomeKit configuration intact, with help from oznu for the needed support by Homebridge.

@Nastras
Copy link

Nastras commented Mar 14, 2021

That sounds great 👍

@ebaauw
Copy link
Owner Author

ebaauw commented Jan 23, 2022

Closing this in favour of #1070.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants