Maybe this is available and I can’t find it so please let me know.
I think a widget “Button” would be handy. You press it and it will turn a module/GPIO pin/a program ON for a selectable time in seconds and then turn it OFF. Maybe be able to select the color or a button image too.
My need is for a garage door button. I’m going to use a pi zero w as the controller. With a small relay and two switches I can tell if the garage door is open closed or in between and open and close it.
Side note: As long as the pi is in the garage a temp sensor for fire safety and a sensor to detect car presence would be easy too.
I don’t have the skill to make this. Anybody want to give it a go?
In general, you don’t need a special “button” widget to trigger a program.
If you already have some automation programs you can easily add them to the dashboard using Add Module dialog.
For example, I have two automation programs “Dim corridor” and “Undim corridor” which under the hood set configuration of corridor’s dimmer to limit the maximum brightness of the corridor light. After pressing on a module name on the dashboard (it acts like a button) the program runs.
This is helpful but I would still like a button as I described. It saves you from writing a program for every momentary action you might want and makes HG more user friendly. The latter being the key for increasing HG users.
What I want is a widget the same size as the switch or dimmer widget with a large clickable button. So when you add a module to a group and you select lamp switch dimmer etc. there will be a button selection available which has maybe a one second default timing. When you click the little gear in the upper right corner that opens the widget configuration you can change the length of time and a check box if you want normally “on” the default would be normally “off”. It would look something like this.
Well, I think it’s not possible at this moment because modules are coupled with widgets, so when you add a switch module to a group you will see default widget for switches with On and Off buttons, and it’s not easy to change this behavior.
I also thought about writing a custom program where you will be able to select a module, timeout and a command, but this idea is also not a viable alternative as you won’t be able to add more than one instance of this module to the dashboard.
Once you place a “switch” module in a group you can then change it to another type. You do this to change it to a dimmer. You can even change it to sensor and the widget will indicate the current state of the switch. I just changed an X10 switch module to a thermostat. Of course this won’t control the switch module. However a button widget is a switch simply configured different. I know it’s possible and it will work I just don’t have the programming skills to do it. This is why I’m making a feature request.
Yes, you are right saying that you can change the module’s type, but you have limited choice of these types. It’s needed if HG incorrectly chose device type at the time of discovery. But it looks weird to introduce a new type “button” as it doesn’t correspond to a real-world equipment.
The only thing to wire up some custom widget with some program (and you need a program because you have some logic attached to that button: turn on, wait, then turn off) is to write module. But, you can’t install multiple copies of one module into HG.
So, for now, I see the only way to write multiple custom programs and use default program widgets.
If someone knows how to implement such button - please, let me know.