Changing state of dashboard icon to off

I have a switch that is used to flash an LED segment. I would like this button to act as a momentary switch and change the state of the icon back to off after a few seconds.

I have the self.listen_state to get the state when pushed, I just can’t figure out what the self.set_state or other command would be to set the state back to off so the icon state would change to off.

How could I do this?

Is there something other than a widget_type: switch I should be using.

Thanks

If you’re talking about HADashboard V1 the ‘scene’ data-view has a data-ontime parameter that sets the time out of the momentary switch look and feel. The scene can be switch.ledsegment state: on. Then have an automation that on x seconds turns switch.ledsegment off or whatever you are trying to accomplish.

Similar deal with HADashboard V2. Just use a ‘scene’ widget_type and do the same as above. Not sure if there is a time out value yet but it will trigger off after about a second.

Perfect, that what I was looking for. Works just like I was hoping for.

Thanks

i guess you are talking about an app here.

i have a bunch of input booleans myself that i use as buttons.
i use listen_state(self.callback,“your.entity”,state=“on”) to listen to the boolean, in the callback i use:

def calback(...)
  do some stuff
  self.turn_off(entity)

that way the action is done when i turn the boolean on and it goes off afterwards.

Thanks for the information. I was able to get my icon to stay in the on state using your suggestion.

Both options will do the trick, but I like being able to keep the icon active while the process is running.

1 Like