-
Notifications
You must be signed in to change notification settings - Fork 142
adaptive lighting support for CCT lights #1028
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
adaptive lighting support for CCT lights #1028
Conversation
47ddb01 to
5954e5c
Compare
|
Nice, didn't noticed this PR in July. |
|
Any updates on this? I'm super excited I found this firmware for the Shelly RGBW2 and was able to get my RTF-Lighting FCOB CCT lights to work with tunable controls in HomeKit. Nothing else I tried worked as well as this. The icing on the cake would be having adaptive lighting support as well 🤩 |
|
Mh I use this every day since several months so I can say that for me works pretty well :) If @rojer fixes the build pipeline by updating https://hub.docker.com/r/mgos/esp32-build/tags via cesanta/mongoose-os#603 then the GitHub action would provide some beta you could try on your device. Or you build it yourself? :) Any feedback welcome... |
68c88f7 to
763cd67
Compare
|
Sorry, I'm pretty new to all this. How would I go about building it myself? As in, I would just flash it with your version of the firmware that's still waiting to be merged? If so, how do I go about doing that? I'd love to test it out if I can. |
|
Okay, this is the current build of commit 763cd67 for uploading via web interface |
|
Seems to be working! I had to remove the accessory and add it back into HomeKit but it's got the adaptive lighting option there now and seems to be working great! |
|
Readd? Strange... Are you on the "new architecture" of HomeKit of latest iOS update (that recently got pulled again?) might be the caching of this new architecture... |
|
I'm not sure, I don't know anything about it. How would I check? It's also possible I didn't actually need to remove and add it back. That's just the first thing I tried when it wasn't showing adaptive lighting as an option after the firmware update. |
this adds the homekit feature adaptive lightning. as this is a non-officially documented feature by apple homekit specification, it relies on the reverse engineering done by homebridge
85aa92f to
deb843b
Compare
deb843b to
b9dafce
Compare
| // Use adaptive lightning when possible (CCT) | ||
| std::unique_ptr<hap::AdaptiveLighting> adaptive_light; | ||
| adaptive_light.reset(new hap::AdaptiveLighting(hap_light.get(), lb_cfg)); | ||
| auto st = adaptive_light->Init(); | ||
| if (st.ok()) { | ||
| hap_light->SetAdaptiveLight(std::move(adaptive_light)); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be integrated in the CCTController? Because it's the only light which supports it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it could. But on the other hand: the controller should not need to know about adaptive lights existing. And the Adaptive Lightning Protocol of Apple is generic in the way that it could support autotuning other characteristics, not limited to only color temperature, so I actually think it would make more sense this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good argument. My main point is that I don't like ot have redundant code in the device specific files. You follow the current pattern, so it's ok. That problem should be solved, but not in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
I guess currently it's complicated if you don't already know... so never mind. |
|
@markirb I wasn't on the new architecture at the time. I just updated yesterday, so now I am. No issues so far. |
Co-authored-by: Timo Schilling <[email protected]>
|
I tried installing the firmware from I just ended up just installing the zip file from @markirb on it like I did on my first RGBW2 device instead. |
|
pushing to master does not equal a release. first it will go to a beta, then somewhen a release |
|
Here are some prerelease builds with this PR, for the devices which are supporting CCT. |
@markirb Ah, okay makes sense.
@timoschilling Thanks so much! They seem to be working great so far. |
|
Hi @markirb: is it there also a possibility to support this feature for Shelly Duo - RGBW? I just know that there are nanoleaf lights available which supports RGB and CCT and you can activate adaptive lighting in homekit. Not sure if it is a different technology in comparison to Shelly but I think Shelly Duo - RGBW have also cold and warm white so I think this feature could be possible? |
|
I do not understand so actually want to control your rgbw as though it was a CCT? Or does HomeKit support the menu for RGBW also? Can you show me the menu in HomeKit? |
|
Hi. Any ideas / feedback on that? |
I have been working on this for a while, as I really find this an interesting feature.
I think now it is in a state for review and testing.
currently it relies on one additional fix mongoose-os-libs/homekit-adk#10
This adds the Homekit feature adaptive lighting for Lights supporting ColorTemperature (CCT at the moment).
When adaptive lighting is enabled, the light gets a schedule every 24 hours how to adapt the color temperature according to the current night / daytime. Afterwards the schedule is ran on the device itself see e.g. https://www.howtogeek.com/712520/how-to-use-adaptive-lighting-with-apple-homekit-lights/ for how this works.
As this is not (yet) documented in the published Apple Homekit spec, this relies heavily on the reverse engineering of the TLV done by Homebridge specifically https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/controller/AdaptiveLightingController.ts.
The only thing missing is making the schedule permanent. But I do not know if this makes sense as it uses ~1kB of configuration storage and only would make sense if we have a notion of time on the device otherwise we do not know where to continue after a downtime.