Physical Buttons for Home Assistant

Thanks, glad I could help

Cannot find a reference to Xiaomi sensors, where can I find out about that?

They did start to support Xiaomi recently.
But AFAIK the dresen devices are not well integrated with HA (yet).
Some has started building a custom component.
I think there is a lot of potential from this direction, but not mature enough (for me) yet.

Are there any new products to fill this area?

Iā€™ve tried using a dash button, but a WiFi extender stops it from being detected. The Flic button looks good, but theyā€™re quite costly. The Xiaomi set up looks like the best option, but Iā€™m only thinking of a single button for now so a gateway seems excessive.

Edit: could it be possible to use a sonoff rf bridge (flashed) to listen to for rf button press and forward via mqtt? Or does it only work the other direction? Thatā€™d be Ā£10 solution for the bridge and remote!

You can skip gateway and use CC2531 with https://github.com/danielwelch/hassio-zigbee2mqtt

Hey, i know this is an old topic but recently found myself wanting a button for my DIY alarm system.

still working things out right now but basically have an automation that triggers all the lights to come on and a Z-wave siren to sound when motion is detected by one of my motion sensors.
Currently this automation is always running and only takes effect between the hours of 00:30 and 6 am (have a dog so no need for an alarm during the day). However i felt a little restricted as if we watched a film that went on later than midnight thirty iā€™d have to go to my front end and turn off the automation then turn it back on when we went to bed. Also it meant that if we went away with the dog, i would have to have a separate automation that has no time conditions so that it could be on all the time.
Hence me just wanting a button to press when i get into bed to activate the house alarm automation.

I recently started playing with raspberry pi zeros and python and have started using the home assistant API to write a script that will turn the house alarm automation on and off.
This works great and i can now run the script on a raspberry pi and it toggles the automation. My next step is to solder a button to the Pi and program it to call the API when the button is pressed, as well as play a sound when the automation has been toggled.
It may be overkill to use a raspberry pi but itā€™s relatively cheap, familiar and the Zero is tiny so next to no footprint.

Why not add a condition to your alarm that it doesnā€™t work if the TV is on?

Good idea but for me, I donā€™t have my tv integrated with home assistant and thereā€™s too many variables where we might be up late, or i might get engrossed in a youtube binge on my pc etc and not necessarily have the tv on.

I like home automation for certain things but with a house alarm i think itā€™s too disruptive to risk it being triggered accidentally so would rather it be either on or off!

If you have Sonoff RF bridge which cost about 12 euro you can buy these RF buttons (less then 3 euro) which you can place wherever you want, they can perform any action you want
I have a couple of these rf switches and they work great.

1 Like

Those RF devices look like a good idea. However I want to make a solution from scratch whilst learning a bit more about python and the power of the Raspberry pi, so probably not the route iā€™ll go with mine!

Itā€™s absolutely overkill but I found myself in a similar situation ā€“ thereā€™s just something nice about something thatā€™s tactile and dedicated specifically to its own function! I actually made a HASS remote by hollowing out a block of nice-looking wood, then adding 4 through-hole buttons on the top. Inside is an ESP-12 flashed with ESPHome, and each button triggers a separate HA script that changes the buttonā€™s function based on what else is going on (e.g. if my alarm is going off, it turns it off, but otherwise it acts as a lightswitch for the room, setting a scene based on what time of day and whoā€™s home). The enclosure has a battery, but right now it only lasts a few hours, the next step for me is to figure out a circuit thatā€™ll wake up the module from deep sleep while still registering the right button push. I also have a few dash button lightswitches that other housemates like because they always do the same thing, every time. I expect this is pretty close to what youā€™re making with your pi!

Also: if you wanna practice your python, I highly recommend seeing what all you can write in AppDaemon. Itā€™s much less popular than NodeRED but itā€™s great python practice for complex script/automation-writing since, well, itā€™s actually just python.

Can you use more than one of these buttons? Or are they all coded the same? EG buy 2 buttons, does the receiver know which button has been pressed?

J

I have 5 of these buttons, they have all unique rf codes. You can assign any action you want through automations.

Excellent, 4 on order. I wondered if Iā€™d made an error and they were all the same code.

Can you set up automationā€™s for long clicks etcā€¦?

Many thanks for taking time to respond!

J

There is no long click functionality, still produces the same rf code.
you still need an rf receiver to capture the rf feeds ie. Sonoff RF Bridge.

iā€™ll share the config later next week.

ps remind me otherwise :wink:

I donā€™t have these, but I imagine you could set up something to handle double, triple, etc. clicks. Some components apparently have built-in support for that. If not, I remember a discussion where someone was trying to do that with a switch.

Essentially, you use a counter to count the number of clicks then have an automation that fires when it hasnā€™t been clicked again in X seconds and acts based on the current value of the counter.

Interesting. I guess this would introduce a delay, for the automation to ā€œwaitā€ to see if another click is coming?

I assume the limitation is that these are 'single channel"?

J

Yes, there would be a delay for every single click in that case. Iā€™m not sure how tight you could get it via this method. It would depend on all of the hardware involved and how fast HA can pick up and react to the button presses.

Hi,

I use a Wemos (with ESP8266) in alot of my physical buttons on my home, I has this configuration two years ago more or less, and i think itā€™s perfect!!

Somees devices with ESPEasy, anothers with Espurna (for the double pulse) and now I will try with ESPHome firmware.

Antoni.

I use little RF buttons. Details on my blog.