I’m struggling with an automation for a “dumb” mini-split HVAC in the bedroom. It has no active thermostat - just off and on, heat or cool, etc.
So, I’m using the temperature sensor on a Broadlink RM Pro; created a template to adjust it since it’s in an equipment cabinet.
I created an Automation to turn it on and set the temp to 74 anytime that the sensor is over 75 and it worked (once). Never triggered again after the first day (the Smart IR integration is working fine; the sensor and template sensor are working fine).
Here’s some YAML if anyone can spot something I’ve done wrong:
alias: Climate - Bedroom AC On Via Sensor (Turn On At 74 Degrees)
description: Turn on bedroom AC to cool when temperature is over 74.
trigger:
- platform: numeric_state
entity_id: sensor.master_bedroom_adjusted_temperature
for:
hours: 0
minutes: 10
seconds: 0
above: 75
condition:
- condition: state
entity_id: climate.bedroom_ac
state: "off"
action:
- service: climate.turn_on
data: {}
target:
entity_id: climate.bedroom_ac
- service: climate.set_temperature
data:
temperature: 74
hvac_mode: cool
target:
entity_id: climate.bedroom_ac
mode: single
- id: 'automation.climate_bedroomac_cool_sensor_2000'
alias: Climate - Bedroom AC On Via Sensor (Set To 68 After 8:00PM)
description: 'Cool down to 68 after 8:00PM.'
trigger:
- platform: numeric_state
entity_id: sensor.master_bedroom_adjusted_temperature
for:
hours: 0
minutes: 10
seconds: 0
above: 69
condition:
- condition: time
after: "20:00:00"
action:
- service: climate.set_temperature
data:
temperature: 68
hvac_mode: cool
target:
entity_id: climate.bedroom_ac
mode: single
You don’t tell what should happen if the target temperatures have been reached and until what time the temperature should stay at 68 in the morning.
Assuming the AC should stay ON all the time and the temperature should be kept at 74°F from 08:00AM to 08:00PM and the climate is OFF you can merge the two automations into one. Change data as needed:
Thanks Tamsy, this is great. Had no idea you can combine multiple conditions.
Forgive my ignorance, I’m just a few weeks into HA: It appears that is_state() within the conditional clause is a simple function. Do you know of a list of global functions for HA?
Hi Aceindy, yes - I did add the custom sensor to the temperature_sensor variable in SmartIR; this allowed the value of the sensor to show on the card in lovelace; but, the only way I can see to have it “do something” with that value is via automation.
Do you by any chance edit those files (i.e. automations.yaml, configuration.yaml etc.) using Windows Notepad?
Note that Notepad as per default is using Windows Line endings (CRLF) which are different to Unix/Linux line endings (LF). This can lead to all sorts of hard to spot errors because you dont “see” the difference. More information about the latter here.
To remove Windows/DOS characters from a Unix file you can use a Linux app like i.e. dos2unix which easily converts files to Unix format.
As for editing Linux files in Windows better use an editor like the free Notepad++ which will automagically take care of the above.
No, I’m using Dreamweaver. I setup a SFTP connection via SSH. Everything should be UTF-8.
I compared the hidden characters side by side and there were no differences; other than the entity_id being on a separate line with the hyphen (thought the hypen was a specification of a mapping entity only)
I’ve written 30 automations and 67 scripts over the past two weeks; and all have the entity_id: entity_id format with no issues. Just this one. And, I deconstructed the script feature by feature and this is definitely the reason HA wouldn’t take it.
I created 2 identical versions: one with the entity_id on the same line, one without and same line won’t show up.