I’m sure I’m just tired and stupid, but I can’t find out how to make simple push buttons (without state) in a dashboard. Do I have to use the switch and make it stateless somehow? Or maybe immediately switch back the state in the app? A 2 state switch is fine for lights, but now I’m going to to start/stop/etc buttons for manually controlling the vacuum and then it feels not so correct…
the problem you have is that you think you can make/create anything in dashboard.
dashboard is just a way to display what already exists (in HA)
a push button?
create an input boolean and let an automation do what you want it to do and set it back to off after the automation is done.
start/stop/etc. buttons? a button can do max 2 things. if you want to do 3 or more, just use an insupt_select and with automation you create an event for every setting.
off course when i say automation, it can also be an app.
I took a look and you can add the momentary parameter:
my_switch: widget_type: switch entity: switch.my_switch title: My Momentary Switch momentary: 300
to any widget that is based on the baseswitch widget, i.e. a switch, input_boolean etc.
The switch will then return to its old state after 300ms, making it a momentary switch.
where did you find that?
because there is nothing like that in the docs or in the code that i can find (and i never heard from it)
so i dont think thats default, but from a custom widget. (unlees i am mistaken off course)
but if it is a custom widget a would really like to know where you got that so i can ask for a PR to make it default.
No, not in the docs, but I looked in the code for the baseswitch widget and the logic is there.
And I just tested it with a switch and it works!
i did miss it when i looked at it the first time. thanks.
i think Andrew did accept a PR and forgot to put it in the docs.
ill talk with him and add it to the docs.
Great! Maybe the “enable” parameter is also not documented. You can add
... enable: 0
to any switch widget and the click function will be disable, i.e. it only shows the state but you cant flip the switch.
allthough i really see no point in that setting. you could also change the widgettype to binary sensor (or to iconsensor with some more config)
but ill take it up with him.
That’s very true. I think Andrew included it to be able to make derived widgets such as the binary_sensor with the defalt behaviour set to
in the derived widget yaml file.
That was the original thought yes, but Rene is right that I should have documented it, he is helping me with that as we speak - thanks Rene!
Ah, that could work good enough I guess Will try it tonight Thanks
Hi, nice code. I’m interested. Could you explain better where to write it? In configuration.yaml I tried, but I get an error.
Hi, This is posted in the HADashboard category and this a definition for a widget if you are using HADashboard and Appdaemon.
I’d just like to say I have a use case for an enable/disable-state on a switch. I’ve currently got an input_boolean for “unlocking” my garage door - effectively enabling a template switch that fires a script with a conditional - this makes the template switch bounce back if I didn’t unlock first. (this is ofc to minimize risk of drunk-opening my garage door when I check in on HA ).
you cant get something to work with a setting in the dashboard.
if you disable switch in the dashboard, then its nothing more then an iconsensor, so you could use that in dashboard.
your solution is the best possible way i can think of.
is that still working? i’m getting an error when trying to add it to the widget.
it should work, but you can also use the script widget.
that already has the momentary set by default.
Please post you widget definition and the error.
thank you! yes it works fine, my mistake.