I want to create a button in Lovelace Overview that will start a smartplug for a period of time, then turn off.
This will control my underfloor heating through a smart plug. I have created timers in configuration.yaml plus an automation (see photos). It would be nice to maybe have a slider to change the timer from 60mins to 180 mins.
OK. Don’t post screenshots of your automation. Post the automation in YAML format (just switch the Automation Editor’s mode from UI to YAML, then copy-paste what it displays).
alias: automation.ufh.60
description: ‘’
trigger:
platform: state
entity_id: switch.10012da59d
to: ‘On’
from: ‘Off’
condition: []
action:
service: timer.start
data:
duration: ‘0’
target:
entity_id: timer.ufh_timer_60
mode: single
see how it looks format right
those Quotes around are the wrong ones U must on a apple try " speech marks
you have started the timer by call the right drvice but I think the duration is a bit short
try
as we are dealing with a time we should format it to a time format “HH:MM:SS”
Unless I am missing some requirements, I think that you could do this in a much “cleaner” way.
If you can get a temperature sensor into home assistant, you could use the generic thermostat component and then you would have temperature control.
If you can’t do that for some reason, and you want to have a button that turns something on for a certain period of time, I would just make a script that has three actions: turn on the switch, run a delay of the desired length (which could be stored in an “helper” input), and then turn off the switch. You could then put that script on an entity button on lovelace. If you want to automatically have this happen on some occasions, you could write an automation that just turns on the script when necessary.
An automation fires automatically based on some trigger, checks some conditions, and then runs an action. A script is just the action portion of an automation.