So the short story is I’m building a custom component to interface MQTT light switches with homeassistant to control LIFX bulbs. I haven’t been able to get brightness control working.
I’m fairly new to this but have put a custom component together so far that works very well for toggling lights, monitoring status changes from HomeAssistantand and communicating via MQTT. All of this I was able to work out from other examples or information resources but I’m falling short when it comes to examples about controlling brightness. I want to be able to do it similar to the YAML automation configuration where it is a generic brightness value (as my bulbs may not always be LIFX) that is sent via data.
Any help, hints or examples would be hugely appreciated.
@mynameisdaniel can you share some more details on your MQTT light switches, home grown one? I am also interested in building one but have no clue how to.
They’re something I’ve hacked together. I live in Australia so parts may not be very applicable elsewhere (or there are probably cheaper ways). I’m using some Clipsal 30PBBPL switches (they fit in our standard size wall plates) which are basically just an expensive momentary button with an LED in it. They’re designed to run a 240V system but instead I’ve connected it up to a NodeMCU ESP8266 module which runs a bit of Arduino code to talk via MQTT. I’ve also hacked the built in LED to connect it up so it can be controlled via the ESP8266 which allows me to do things like show status.
I only have two bench test ones going at the moment but they’ve been 100% stable (once I switched from NodeMCU/LUA to Arduino) and paired with the LIFX bulbs there’s no noticeable lag.
Hey mate, do you have a tutorial, wiring diagram or code for the Clipsal button. I have the same setup with a nodemcu and been searching all over the web for a way to do exactly what you’ve done. Cheers in advance.
I don’t sorry - I’d suggest getting your hands on one and taking it apart, there’s not much to them.
I just connected the in-built LED wires directly to the ESP8266/NodeMCU/Arduino (unsure if 5V or 3.3V) and use PWM output to control the brightness, has been going for a bit over a year, 24/7 and hasn’t died yet.
I then connected the NO contacts on the back of the switch to a separate pin on the arduino (so it grounds when pressed). Make sure you put some debouncing code in there too, the switch action is very bouncy.
I did end up getting brightness control to work well, when I hold the button it cycles in 20% increments every second and stays set once released.