SamZorSec / Arilux_AL-LC0X

Alternative firmware for Arilux AL-LC0X LED controllers, based on the MQTT protocol and a TLS connection
MIT License
190 stars 33 forks source link

[Feature] Add ability to turn on/off with transition #35

Open papaiatis opened 6 years ago

papaiatis commented 6 years ago

I'd like to request a feature so that when I turn off the device it fades into black with the specified transition duration.

For example: { "state": "ON", "transition": 3 } would turn on the lights with a black to color transition of 3 seconds. { "state": "OFF", "transition": 1 } would turn on the lights with a color to black transition of 1 second.

Philje123 commented 6 years ago

This already works does it not? I know that if I send an MQQ Json message from HomeAssistant with transition: 5 the lights will transition on/off over 5 seconds.

papaiatis commented 6 years ago

So, how such a MQTT message should look like exactly? Because this one does not work: { "state": "OFF", "transition": 5 }

This one works: { "color": { "r":255, "g":255, "b":255 }, "transition": 5 } but this is not what I requested in this ticket.

Philje123 commented 6 years ago

I'm not sure on your specific formatting or how you are sending the message. I use Home Automation.

So my scene contains a command for my MagicHome controller (running this firmware of course) like this:

light.kitchen_cupboard_leds:
    state: on
    transition: 5
    brightness: 120
    rgb_color: [255, 99, 62]
papaiatis commented 6 years ago

Please read the title of this ticket carefully. I'm talking about turning on or off with a transition. Not changing colors.

Philje123 commented 6 years ago

Ok. I just tried without any colours.

It works fine. Both the above lights are MagicHome rgb controllers with this firmware on. They both started in an off state then slowly transitioned to on over 5 seconds to their last colour.

rvt commented 6 years ago

I agree with papaiatis,

transition with only state changes without color mentioning does not work.

rvt commented 6 years ago

I am working on a version with different way to handle transitions and allow to add more transitions easily. However, I am changing a lot of thing quite a bit. It will only support JSON and only HSB with white 1 and white 2 colors. So it should be mostly backwards compatible but you have to start feeding it with HSB instead of RGB. So om the sending end things might get easer (at least in openhab). I am also planning to make short duration transitions with fade in/out in shorter time frames.

if anybody is interested I will put it on github..

rvt commented 6 years ago

quick update: I have everything working now except one transition I need for myself (5 minute or more slow transition between two color states).

rvt commented 6 years ago

Here is a branch where this issue is solved https://github.com/rvt/Arilux_AL-LC0X/tree/redesign

Note: It´s not a drop-in replacement because color model is changed from RGB to HSB and some things are changed to follow this design. It should be easy to convert though. If there is really a need for RGB model I can see what I can do but I just assumed that all control software (openHAB, Home assistant etc) can output HSB