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] Toggle lights with physical switch connected to GPIO #37

Open oglodyte opened 7 years ago

oglodyte commented 7 years ago

Allow light to be controlled (on/off) from the wall toggle switch for the backwards compatibility with non-geek family members.

Had to do this to meet minimum WAF.

Have simple working code that I wanted to share, but could not push it to new branch in this repo. Is it not allowed or it is my ignorance issue?

Philje123 commented 7 years ago

For my WAF I have a mix of Hue lights, dimmer switches, livingwhites remote and google home.

Are you running Home Assistant or similar?

If Hue were to get some Hue lights and remotes there is some custom code you can install that listens for remote button presses and can then activate MQTT lights like Arilux/MagicHome controllers.

oglodyte commented 6 years ago

hi @Philje123,

thank you for your comment.

Yes, I'm running HA, but the point is to make it smart with 0 impact on the users who do not care about it's smartness. If there was a wall switch to turn it, it just have to continue working as usual. And as reliable.

Those remotes are only useful if they can replace wall switch. IMO the only remote that is aesthetically acceptable is Lutron Pico and that still scores lower on WAF than existing plain toggle switch. Then you need to have Lutron's Pro hub and too many points of failure in the chain overall to call it reliable.

So what I typically do when adding ESP8266-baseed controller - I wire existing toggle switch to the GPIO pin on the same controller, so that it can be used to toggle whatever it controls on/off wether or not WiFi, HA or MQTT services are available.

Philje123 commented 6 years ago

I get exactly what you mean now.

So you could basically wire up a toggle switch between say GPIO0 and Vcc so every time it is switched on or off if toggles the RGB lights?

That would be a really nice feature and sure pretty easy to code in... but I've no idea how. I'm pretty new to all this arduino/mqtt stuff and learning as I go.

oglodyte commented 6 years ago

Right. It is actually fairly easy change. I have it working with my LC11 pretty well. If you are interested I've just put it here: oglodyte/Arilux_AL-LC0X I'm also new to this and just having fun learning.

rvt commented 6 years ago

Would it be possible to use a eeprom to keep track of last light state when it was emitting? Then when the device detects a start it will simply go on, regardless of what mqtt states? SOmething similar to what the Ikea ights do when power is toggled...

rvt commented 6 years ago

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

What it does is when the less where off and you power off/on it will lookup the last color setting and brightness in EEPROM and turn on the device with these settings making operation feel a bit more natural. Also handy if your mutt broker is down.

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