cancel
Showing results for 
Search instead for 
Did you mean: 

ac off script 1 hour

basemantadex
Community Member

I have a problem with setting the script so that the device turns off after a set time of 1 hour

# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #

metadata:
name: Grzanie poddasza ponizej 22C # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
description: Scripted automation # Write a detailed description that includes everything the automation does, like “At sunset, on weekdays, close blinds, turn on lights to 50%, and play the sunset playlist on certain speakers.”

automations:
# “starters” and “actions” are required; “conditions” are optional.
# Use Ctrl + Space to see autocomplete suggestions.

# ---- STARTERS ---- #
# Starters describe events that will start the automation.
# To add more than one starter, duplicate the "- type" section under "starters".
# If you add multiple starter events, any one of them happening will start the automation.
starters:
- type: device.state.TemperatureControl # Handles temperature points and modes of a thermostat device.
state: temperatureAmbient
lessThan: 22C
device: Poddasze - Sypialnia

# ---- ACTIONS ---- #
# Actions will start when a starter event takes place and all conditions are met.
# Actions will start in the order they appear in the script and with any delay specified.
# To add more than one action, duplicate the "- type" section under "actions".
actions:
- type: device.command.OnOff # Turn the device on or off.
on: true # Start or stop the device.
devices: Poddasze Klima - Sypialnia




1 REPLY 1

basemantadex
Community Member

metadata:
name: Grzanie poddasza ponizej 22C
description: Scripted automation

automations:
starters:
- type: device.state.TemperatureControl
state: temperatureAmbient
lessThan: 22C
device: Poddasze - Sypialnia

actions:
- type: device.command.OnOff
on: true
devices: Poddasze Klima - Sypialnia
- type: time.delay
# Adjust duration as needed. Supported units: sec, min, hour
for: 1min
- type: device.command.OnOff # Turn the device on or off.
on: false
devices: Poddasze Klima - Sypialnia

The [OnOff] command on device [action.devices.types.AC_UNIT] is currently not supported.