I just build a ESP8266 with 4 buttons and 2 LED’s and got it working in Hassio.
First automation:
I wanna make two of the switches toggle (first press sends “ON”, second press sends “OFF”). Do any of you have an example of this i can look at?
Second automation:
The two other switches i wanna use as multiple funktions, so if i use on_click it sends “first-value” to Hassio, when i use on_double_click it sends “second-value” and lastly when i press and hold the switch i want to send “third-value” until i release it.
The second automation is for light;
One single press should turn on/off the light at last brightness.
Two presses should turn the auto-light-off-by-pir automation on/off.
When i hold the button down the light should rise in brightness until it reaches max, then fall in brightness until it reaches minimum brightness, then repeat.
The click_type I think is special to that Xiaomi button so I don’t think it will translate to yours automatically.
You’ll, of course, have to make switch entries that the automation can toggle - here’s an example for mine that uses curl - though I guess how you’ll call the switch changes will differ, and the command_state.
Not sure how you’d code the second part you want, if you post what code you’re using so far to turn them on/off, change brightness, read the pir etc. I imagine someone will have done something similar and can give you pointers.
I’m actually trying to accomplish this in esphomeyaml and not so much in Hassio, yet. I tried the below, but no succes, throws validation error in esphomeyaml.
EDIT: My indentation was wrong… Going to test it when I’m home…
Hi @skeptizzle
did you get it to work? do you need to use MQTT to get the press over in home assistant?
im sitting right now with and LK low powered 4 button that i want to use long press and double press/multi press.
i got it working with a simple binary sensor press, and toggle light on/off.
Nope, did not get it working, I didn’t have the time to spend figuring it out. Ended up using MQTT for sensors and outputs (relays) and ZigBee (on a ConBee stick) for buttons.
Have a look at a Danish Facebook group called “Philips Hue Erfaringer” and search for “svagstrøms tryk”.
The only downside is that it’s not possible to drive the LEDs, other than that it works great.
Xiaomi are making some nice, small, round buttons.
yeah, i see that you can do some cool stuff with philips hue switches, but in my case i dont have any philips, mostly yeelight and ikea trådfri and ofcourse Xiaomi, that have that feature, properly i can use one of the Xiaomi on a IHC lowpowered switch, that fit inside LK, but i will been in lack of 4 push switches
my first plan was to use a esp-01 behind the wall switch, but misses the long press and multi press