Zacknetic / HomebridgeMagicHome-DynamicPlatform

Homebridge Plugin for MagicHome LED controllers and light bulbs
Apache License 2.0
62 stars 12 forks source link

Feature Request - Additional Functions #13

Open MWDelaney opened 4 years ago

MWDelaney commented 4 years ago

Hi. This is definitely me just getting greedy, but I wonder if it'll be possible for this plugin to support the additional features that the MagicHome app offers, like the "dynamic" color cycling it can do.

I was able to achieve this sort of thing with an IR LED controller and homebridge-broadlink-rm by exposing the remote's "crossfade" button as a switch in HomeKit.

I realize you have a lot left to do just to support the basic MagicHome functionality, but perhaps this could be added to a future roadmap?

Thanks for listening!

Zacknetic commented 4 years ago

It's possible. It all has to do with how to implement it using the ultra simplistic HomeKit UI. I've been thinking about this for a while. Nearly 3 years.

How would we implement the patterns? Perhaps in the config.schema with a color chooser. One pattern per MAC address? Seems tedious. Perhaps the patterns are global.

How would we activate the pattern? Adding a new tile per controller would double the amount of tiles. That's a lot of space for people with 20,30,40 magichome devices.

Alternatively I've been looking into sending TCP packets to the lights to create cool effects controlled by Homebridge over WiFi. It works fine on my system but it could overload some user's WiFi.

The benefits would be super customized patterns which would all be synchronized.

Some patterns I've written so far:

Anyways I'll put your suggestion on the feature request and milestone. If you'd like, research how it could be implemented using the config.schema and HomeKit interface. I'd like an elegant solution. Not one extra tile per pattern per light.

or-agami commented 3 years ago

Hi, any updates with addressable LED? I managed to configure them as a regular RGB, but it would be great to see some lightning effect

Thanks for the awesome work !

Zacknetic commented 3 years ago

Hey, I am still trying to get this plugin functional as it has one bug that is proving very tough to squash. Despite that I have put some testing into how to add more services to an accessory.

It is possible to add a switch or another light element to an accessory. However, this does turn off the ability to "quick click" the accessory in Homekit, but the switch or light can be separated thus restoring that capability. Take a look at an example below.

Single Accessory with Two Light Services

In terms of the code for animations. Can you elaborate on the individually addressable LED animation functionality? I do not own one myself so I am unfamiliar with how magichome handles its animations. With my normal bulbs the animations simply change the lights from one color to the next, either with the pre-made animations or "custom" animations where you choose the color. Is there additional functionality that your controller has? I have addressable LEDs myself, so I know they are capable of some cool movement animations. I just use an arduino to control my individually addressable LEDs so I am unfamiliar with magichome capabilities.

As for the code for creating the animations or triggering them, that is still on the TODO list as there are basic features that still need implementation and major bugs that need squashing.

We are completely open for collaborations and merge requests so if you are interested in kickstarting this feature let me know. I can be contacted directly here on the magichome discord server. Just mention me @Zacknetic once you're there.

or-agami commented 3 years ago

Hi, I did some searches and I found Homebridge plugin for MagicHome with light effects, this plugin can create preset patterns switches and also sync all lights, and it might help you (sorry but I don't have knowledge with coding) about the addressable LEDs, so after looking for existing plugins I found that not many people want those kind of effects or don't have addressable LED strip, so maybe it's not worth to get into it if no one going to use it.

Thank you

Zacknetic commented 3 years ago

@or-agami this is really useful thank you!

These patterns are not for individually addressable controllers but actually for all controller types. Therefore, I very well may be able to implement this in the future.

However, seeing as I do not physically have an individually addressable controller, I can't test the functionality for that type of animation (theater chase, cylon, color wheel, etc). Without the hardware, can't do it. But I can still have a crack at the basic patterns.

To be quite honest, the magichome patterns are underwhelming. The transition from color to color is not linear. Instead the lights wait the delay period and then transition quickly to the next color. They are also inaccurate. The interpretation of the delay time varies between the numerous controller types.

I think it may be a better use of time to develop a server-side pattern generator. This would of course trade cpu load/bandwidth for more robust and beautiful animations.

Zacknetic commented 3 years ago

Take a look at some of the progress made in the animation feature.

https://imgur.com/gallery/mvxMc9x

It's non blocking and each light technically can independently run its own animation. If the light is controlled in any way (on/off, brightness, hue, saturation) the animation instantly disables and normal functionality resumes.

One switch per light per animation is going to be too much though.

Brainstorming some ideas including an angular js GUI animation editor. Problem is I have zero knowledge of angular.

I think best case scenario is one switch per animation. One approach would be placing all accessories the user wants for a certain animation into a group (using a web editor) and that switch controls that group.

What do you think?

or-agami commented 3 years ago

WOW amazing progress, it's look really nice! Switch control for group sound good. I think even just fading feature maybe enough or just one animation option (for me at least)

Great work thank you!

Zacknetic commented 3 years ago

Hi everyone, as I mentioned in another issue, I've run into two roadblocks:

1.) I don't know a proper way to "group" lights that should be animated and lights that shouldn't be animated.

-I thought about having the user add a unique name to their device but I don't think anyone wants to confuse their Siri with oddly named devices. -Alternatively I could generate a list of each device in the config ui x interface. Then the user could choose which animations they'd want per device.

2.) I am having trouble figuring out how to setup the custom color transitions and integrate it into a repeating pattern. That's kinda a big deal. I am completely lost as to how to do that.

A buddy and I wrote a color transition function that iterates from 0 to 1 between colors. -step 1 would be to figure out how to loop from 0 to 1 in that one color change without blocking -step 2 would be to figure out how to iterate from color to color, again without blocking -step 3 would be to figure out how to repeat the whole cycle, again without blocking

Any suggestions or feedback would be greatly appreciated. Perhaps you have some programming experience or have seen something similar in another plugin that I could take a look at.

BetoRn commented 3 years ago

Hi, I have an idea for this, I have a Vocolinc Flowerbud, this device has a few "animations" and they work with HomeKit using the Eve app. You have to create a new scene in the Eve app, then select the device, and there are 4 toggles: 1 Power 2 Color 3 Brightness and 4 Light effects mode enabling the light effect toggle reveals an selector to chose from (if the animation is active, the light effect is preselected)

after saving the scene it works on the Apple HomeKit app as well

IMAGE 2020-10-21 4:36:27 p m

Zacknetic commented 3 years ago

This is sweet!

Does the flowerbud work through a homebridge plugin? I'd need to see the code for this "effects" service.

On Wed, Oct 21, 2020 at 5:39 PM Alberto Rojas notifications@github.com wrote:

Hi, I have an idea for this, I have a Vocolinc Flowerbud, this device has a few "animations" and they work with HomeKit using the Eve app. You have to create a new scene in the Eve app, then select the device, and there are 4 toggles: 1 Power 2 Color 3 Brightness and 4 Light effects mode enabling the light effect toggle reveals an selector to chose from (if the animation is active, the light effect is preselected)

after saving the scene it works on the Apple HomeKit app as well

[image: IMAGE 2020-10-21 4:36:27 p m] https://user-images.githubusercontent.com/14804764/96789903-91bfa480-13bb-11eb-85c5-9ed0020ec7c1.jpg

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Zacknetic/HomebridgeMagicHome-DynamicPlatform/issues/13#issuecomment-713892870, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLCJVY6LT3CPYREPT4BP3TSL5IKLANCNFSM4PGE55AA .

BetoRn commented 3 years ago

oh no, Flowerbud is native HomeKit.

But this plugin also makes use of this custom eve services:

https://github.com/grover/homebridge-automation-switches

maybe it can help

Velkas commented 3 years ago

I think this is the right place to put this--

I setup some 5-channel RGBWW strips with my 5 channel magichome controller and your plugin has worked WONDERS in finding, setting up, and controlling my light strips with simultaneous RGB + WW control and it's been phenomenal.

This has solved a long-standing issue with other plugins where I couldn't get WW to enable at all and it did so automatically. I'm over the moon!

Onto the relevant parts: would this ticket cover the addition of time-based sequences? More specifically, I setup my strips to cover the whole perimeter of my room as my main light source in my room which I spend most of my time in. As this room as no windows, I setup my strips to turn on, and occasionally change throughout the day (starting cool, shifting warmer, ending orange) daily to help my circadian rhythm without seeing the sun every day. My ultimate goal was to simulate the changing lighting conditions throughout the day to make me feel better. With Homekit this process was simple and effectively plug-and-play when coupled with your plugin finding and configuring my controller. The only piece missing would be a smooth and gradual rise and fall in brightness. As it stands, the lights just turn on immediately at sunrise and that can be jarring waking up. I would love if I could configure a way to ease into the cool sunrise light in the morning and ease out of the warm sunset light at night. If this could expose a "sunrise" and/or "sunset" switch that I could trigger and configure, it would be... magical!

If this isn't the right place, let me know and I can move it.

Thanks for the hard work on this awesome plugin!

Zacknetic commented 3 years ago

@Velkas Hey thank you for the kind words.

This is absolutely something that is in the works and will be released as soon as the next iteration of Homebridge comes out of beta. It's called Adaptive Lighting and it's something apple has given us the option to implement! If you'd like to partake in the beta for this (when it reaches that stage) please join our discord and let @tom-23 know. He'll get you sorted as a beta tester.