How to change a switch to a button

I installed Home Assistant 2021.12.
And have read about the button integration (finally) Button - Home Assistant

But i do not know how to integrate it
I have some switches like “switch.cv_relay”, “switch_deurbel” and “switch.woonkamer_hue_scene_selection” who should actually be a buttons. Now a made a automation for them to deactivate them directly when they are activated.
How can i changed the switch to a button?image

I wonder if some of these entities should actually be template switches.

is there someboday how can help ?

States here in the docs:

The button entities cannot be implemented manually, but can be provided by other integrations.

For now, unless these devices are running ESPHome-based firmware, you will have to wait for the underlying integration to change them to button entities.

So a shelly1 switch , which is used for example as a "doorbell ". But should act like a button,
still cannot be used as a button at HA.

I disagree. A doorbell is not stateless. It’s either on or off. If you want to push it, you need a script that turns it on and off.

Yes scipt is a solution . only problem is , when you are using also the webinterface of shelly ( on/off) then the scrip will not react. so automation is the only solution.

why not?
make your switch monitoring input of Shelly (change from off to on)

edit: tbh I don’t understand why you are deactivating those switches. Are you activating shelly1 with momentary button, toggling shelly state? so after releasing button shelly remains turned on?

Monitoring? , where do i set this option monitoiring in HA .And when it is turened to ON, where do i set it to OFF again at HA.

The Doorbell and Hue Scene selection are physical switches with a spring return( so pressed it is ON en when released it is OFF) switchmode1 at tasmota(shelly1)… .

There are two things HA should see:

  • state of the Shelly input, which represents state of momentary button you press
  • state of the Stelly relay. Depending of the Shelly configuration it may or may not reflect input button state.

You can make automation off any of them.
But to me remains unclear why you want to turn the relay off after a while. In doorbell example, I expect Shelly should release the relay immediatelly after you releasing the button - because this is the function of a doorbell. If you are using it in some other way, I would appreciate more details.

I run tasmota on it with MQTT
But i do not see state if relay and state of switch …
How can i ready these states ?

shelly will release the relay when the doorbell butten is released. but when you switch it by HA
it will stay ON. of when using the webinterface of shelly , it stays ON

Regarding Tasmota: I have none experience with it. I use all my Shellies with stock fw. But I believe tasmota must expose input and relay states too. Especially to MQTT. If you are using other tasmota integration then I cannot help in this detail.

Understand. You need to run ringbell from HA. There are several options IMO:

  1. when using stock firmware, there is option to auto-off. Not sure how it behaves while somebody is still pressing ring button. Maybe tasmota offers something similar.
  2. Write automation which turns relay on and then off after required time. Call this automation everytime you press the button in HA GUI. Not sure stock Lovelace buttons can do that. but custom-button card can.
  3. other option is to write automation script intercepting relay-on. Then send turn off after a required time. Without any other condition it will affect the ringbell activated manually. In the automation you can limit the script only to work if “authenticated” person is changed the state to on (the person who use HA GUI). Events triggered by physical button are not signed by any user.

I think I would go for 2nd option likely.

i used Tasmota because i had Domoticz, but now im used HA for a year and i will used stock shelly FW next time. But my existing shellys, with Tasmota will remain .

So if you can check at HA the switch and the relay state (with standard FW) can you provide an examples of the entities ? and you are using it with the Shelly integration ?

I’m using it through mqtt integration. But it really doesn’t matter. I’m pretty sure any integration should expose state of input as well as state of relay

because i cannot see the difference if relay is activated, by manual activating the switch or by HA/ webinterface shelly

i now have an automatiion . So when shelly Doorbell is activated it will be deactivated again after 1 sec
In this auomation , also some otherthing will be activated , like a notification

ahh there might be no way to distinguish imanual activation using connected push button from shelly/tasmota web gui.
You can however distinguish action done with HA from manual/shelly web interface