Adding the toggle action
MathisP75 opened this issue ยท 8 comments
Is your feature request related to a problem? Please describe.
The action for a tile card can be "toggle", but the option is missing for a custom button.
Describe the solution you'd like
Adding the "toggle" option to custom buttons would be practical.
Additional context
For example, I would like to make a button to toggle my Pi-Hole. I cannot do it using this add-on, because the "toggle" option is not available. However, all of the other options are present.
I have managed to achieve what I wanted using the "Call Service" action with the "switch: Toggle" service. I guess this is the intended way to do it?
The toggle action is a shortcut for calling various toggle services. I never got around to implementing it but I should.
I spent a decent amount of time tracking down the frontend implementation of the toggle action, but it should be fine to just call the service homeassistant.toggle
for toggle actions. @MathisP75 can you spot check the 4.0.5 beta to make sure it works fine for you?
The generic toggle doesn't work for some domains like locks, so I do have to implemented the rest of the logic ๐.
Alright, beta 2 uses similar logic as the HA frontend to to check entity states and call the appropriate service using that.
Thank you, it works!
Great! I'm gonna work on a few more minor improvements then release it.