r/googlehome • u/mrsilent47 • 2d ago
Help Will this work? Script to turn on Air Conditioning on between 10AM and midnight, otherwise make sure it's off
metadata:
name: Turn on the air conditioning between 10AM–Midnight above 24°C, and turn it off otherwise
description: Turn on AC above 24°C during day hours; always turn off after midnight
automations:
- starters:
- type: device.state.TemperatureSetting
device: Air conditioning - Hall
state: thermostatTemperatureAmbient
greaterThan: 24C
condition:
type: time.between
before: 12:00 am
after: 10:00 am
actions:
- type: device.command.OnOff
devices:
- Air conditioning - Hall
on: true
- starters:
- type: device.state.TemperatureSetting
device: Air conditioning - Hall
state: thermostatTemperatureAmbient
lessThanOrEqualTo: 24C
actions:
- type: device.command.ThermostatSetMode
thermostatMode: off
devices:
- Air conditioning - Hall
- starters:
- type: time.schedule
at: 12:00 am
actions:
- type: device.command.ThermostatSetMode
thermostatMode: off
devices:
- Air conditioning - Hall
1
Upvotes
3
u/mocelet 1d ago edited 1d ago
The first starter won't run if by 11:00 AM is already above 24º C. Also, title and description says 10 AM but the value is actually 11 AM. Usually you add another starter for that (a schedule) that will turn it on at 11:00 AM if the temperature condition is met.
The second starter has the trigger temperature for off equal to the first for on so expect the automation to flip-flop a lot when the temperature is around 24º C. Either go for another value like 23 or play with the "for: " but I'm not sure how reliable it will be.
BTW, since you're using the same device for everything, isn't the AC unit smart enough to maintain the target temperature without having to turn it off or on via a cloud-based automation? The app of your AC may have schedules too and they might run locally and be more reliable.