Hello, I want to create an intelligent “template button” for manual restarting of fast.com measurement service which run for cca 20 seconds.
Would like a button which gets disabled after pressing and gets enabled again after press sequence ends (like ESPhome and HA system buttons).
My first version below was trying to set icon and availability properties according to the button state, but it was wrong (later found out that state of template button = timestamp of the last press, not sure why).
I can’t figure out where/how to find the button press real state.
Could anyone help me how to configure the template button which behaves exactly like the standard HA/ESPhome buttons (is unavailable/disabled during press sequence running)?
Thanks in advance
template:
- button:
- unique_id: 'restart_fastdotcom'
name: Restart Fast.com
icon: >-
{% if is_state('button.restart_fastdotcom', 'on') %}
mdi:restart-off
{% else %}
mdi:restart
{% endif %}
press:
- service: fastdotcom.speedtest
availability: >-
{% if is_state('button.restart_fastdotcom', 'on') %}
off
{% else %}
on
{% endif %}