Improvised fingerbot, switch sth on for one second?

Hi,

I am new to home assistant, installed it about two days ago, so I am still getting used to some basic concepts…

Right now I am trying to build something like an improvised fingerbot/switchbot. My Raspi 4B 2GB has a Raspbee 2 Zigbee controller, and I have connected some temperature sensors, a motion sensor, a zigbee lightbulb and a zigbee power socket.

I added a button card to my test-dashboard, this button card toggles my zigbee power socket. Plugged into the power socket is a power supply that connects to a soleniod that presses a real physical button for me. So far, so good.

But this button needs only to be pressed for a moment, not permanently. So I have to click the button card again immediately to toggle the solenoid off again.
Of course it should be possible to automate this. I tried to modify the code of the button card from the original

type: button
tap_action:
  action: toggle
entity: switch.on_off_plug_in_unit_4
icon_height: 36px
show_state: true

to this:

type: button
tap_action:
  action: toggle
  delay: 1
  action: toggle
entity: switch.on_off_plug_in_unit_4
icon_height: 36px
show_state: true

But this does not seem to be valid. As I said, this field is totally new to me, and I have no experience with python either.

Also, it would be preferred, if this button had an inbuild check to make sure it is switched off. So not just “toggle, wait, toggle” but maybe something like “toggle, wait, toggle if on”

What would be a good way to accomplish that?

Ok, I finally looked into automations and used “create a new automation from scratch” in the GUI…

It was surprisingly easy! The automation uses my zigbee-socket from Lidl being switched on as a trigger. Then it executes the action “wait for time to pass” and another action to switch the socket off.
This was completely straightforward, I just was not aware that one can create this in the GUI.

So I tried the next step. The reason for all this is, that the heating system in our community center is defective, for the last three weeks it has repeatedly stopped with an error message. Then someone has to go over to the building, in the basement, and press a button to turn it back on. There are apartments in the building, a church office and a kindergarten. Sometimes the heating fails several times a day, or even at night.

Now I have temperature sensors (Aqara and Sonoff) on the heating pipe and mounted the solenoid in front of the boiler’s start button.

The automation reacts when the temperature of a sensor falls below a certain value for 15 minutes. As an additional condition, I added a second sensor in case my first sensor accidentally falls down.

The first action is to turn on the solenoid. Then wait a second. Then switch off the button again. And finally wait 30 minutes, because otherwise the automation would be activated continuously because the temperature cannot rise again so quickly.

Unfortunately, I don’t know yet whether it works as expected, because tonight there was no failure…

Hopefully next week a heating company will get the heating right again.