Hi guys!
I would like to program a D1 mini + relay like this (if it’s possible):
when the relay is activated (momentary 1 s), it must no longer be activated for 5 minutes.
After 5 minutes, the entity can be clickable and activated again.
Possibly I would like to do everything within ESP Home, and only display the button on the Home Assistant (and possibly the on/of status)
I need this to automate a coffee machine, which has only one button:
if pressed when it is off > it turns on the machine.
if pressed a second time when on > it dispenses the coffee.
It is possible to program a D1 mini and relay to behave in the way you described using the ESPHome firmware. ESPHome allows you to define custom automations and conditions within the firmware, so you could create an automation that turns on the relay for 1 second when it is activated, and then prevents the relay from being activated again for 5 minutes.
As an example of how this could be implemented using ESPHome:
In this example, the coffee_machine_button binary sensor is used to detect when the coffee machine’s button is pressed. When the button is pressed, the coffee_machine_relay is turned on for 1 second, then turned off again. This simulates pressing the coffee machine’s button.
After the relay is turned off, a 5 minute delay is added using the delay action. During this time, the coffee_machine_button_lock ID is used to prevent the relay from being activated again, even if the button is pressed. After the 5 minutes have elapsed, the coffee_machine_button_lock ID is removed, and the coffee machine’s button can be pressed again to activate the relay.
You can then use Home Assistant to display the state of the coffee_machine_button binary sensor, and control the coffee_machine_relay from the Home Assistant UI.