02-18-2025 10:18 AM
I'm setting up a script automation to control a split a/c system in my bedroom.
The code below works but I want one of the starters to be a condition, so essentially both starters have to be met to start the automation.
metadata:
name: Bedroom Heater Control
description: Automates heating for the bedroom A/C when the temperature drops below a set threshold.
automations:
starters:
- type: device.state.OnOff
state: on
is: true
device: virtualSwitchLessThan60F - Bedroom
- type: device.state.TemperatureSetting
state: thermostatTemperatureAmbient
lessThanOrEqualTo: 68F
device: Temp and Humidity - Chris's Bedroom
actions:
- type: device.command.OnOff
on: true
devices: Bedroom A/C - Chris's Bedroom
- type: device.command.ThermostatSetMode
thermostatMode: heat
devices: Bedroom A/C - Chris's Bedroom
- type: device.command.ThermostatTemperatureSetpoint
thermostatTemperatureSetpoint: 75F
devices: Bedroom A/C - Chris's Bedroom
- type: home.command.Notification
title: Bedroom A/C State Change
body: The heat is ON!!
Adding either of the starters as a condition gives an error. [The value should be [Condition] but is [Array] instead.
condition:
- type: device.state.OnOff
state: on
is: true
device: virtualSwitchLessThan60F - Bedroom
ERROR: The value should be [Condition] but is [Array] instead.
Answered! Go to the Recommended Answer.
02-18-2025 10:34 AM
It's the dash in front of the type in the condition. That indicates an array. Just drop it. Something like this:
metadata:
name: Bedroom Heater Control
description: Turn on bedroom heater when the temperature drops below a set threshold.
automations:
- starters:
- type: device.state.OnOff
device: virtualSwitchLessThan60F - Bedroom
state: on
is: true
condition:
type: device.state.TemperatureSetting
device: Temp and Humidity - Chris's Bedroom
state: thermostatTemperatureAmbient
lessThanOrEqualTo: 68F
actions:
- type: device.command.OnOff
devices:
- Bedroom A/C - Chris's Bedroom
on: true
- type: device.command.ThermostatSetMode
devices:
- Bedroom A/C - Chris's Bedroom
thermostatMode: heat
- type: device.command.ThermostatTemperatureSetpoint
devices:
- Bedroom A/C - Chris's Bedroom
thermostatTemperatureSetpoint: 75F
- type: home.command.Notification
title: Bedroom A/C State Change
body: The heat is
02-18-2025 10:34 AM
It's the dash in front of the type in the condition. That indicates an array. Just drop it. Something like this:
metadata:
name: Bedroom Heater Control
description: Turn on bedroom heater when the temperature drops below a set threshold.
automations:
- starters:
- type: device.state.OnOff
device: virtualSwitchLessThan60F - Bedroom
state: on
is: true
condition:
type: device.state.TemperatureSetting
device: Temp and Humidity - Chris's Bedroom
state: thermostatTemperatureAmbient
lessThanOrEqualTo: 68F
actions:
- type: device.command.OnOff
devices:
- Bedroom A/C - Chris's Bedroom
on: true
- type: device.command.ThermostatSetMode
devices:
- Bedroom A/C - Chris's Bedroom
thermostatMode: heat
- type: device.command.ThermostatTemperatureSetpoint
devices:
- Bedroom A/C - Chris's Bedroom
thermostatTemperatureSetpoint: 75F
- type: home.command.Notification
title: Bedroom A/C State Change
body: The heat is
02-18-2025 10:45 AM
Thanks a million!