Hi all. I’m quickly learning HA and porting all my devices and automations over from Homey. This because Homey is becoming unstable when using a lot of home automation devices and flows.
Homey has an advanced flow builder (which is awesome) and I run into some challenges to transfer flows to HA’s automation: can you guys help me out?
For now I would like to create an automation based on this triggers:
Only when the time is between 05:00 and 23:00
Switch on the IR panel (Aqara single switch module T1) if:
the temperature (aqara temperature and humidity sensor) goes below 16 degrees
OR: door (aqara door sensor) goes open AND temperature is below 16 degrees
Switch off the IR panel (Aqara single switch module T1) if:
the temperature (aqara temperature and humidity sensor) goes above 19 degrees
OR: door (aqara door sensor) goes open AND temperature is above 19 degrees
If time is equal to 23:30 switch off the IR panel (Aqara single switch module T1)
I’d do it as two automations. One is certainly possible but messier. I’ve used fictional entity_ids as you don’t say what they are. Obviously untested…
These automations are simple enough to replicate in the UI if you don’t fancy YAML coding. Note that it does exactly what you asked for: if the temperature is 12°C at 5am, nothing will happen until the door opens, as the temperature numeric_state trigger only fires when the threshold is crossed.
alias: "Turn on IR panel"
id: 6e640bcd-da7a-499c-8465-19271f59c821
description: >
Turn on the IR panel between 5am and 11pm when the
temperature drops below 16°C or if the door opens and
the temperature is already below 16°C.
trigger:
- platform: numeric_state
entity_id: sensor.aqara_temp
below: 16
- platform: state
entity_id: binary_sensor.aqara_door
to: 'on'
condition:
- condition: numeric_state
entity_id: sensor.aqara_temp
below: 16
- condition: time
after: "05:00:00"
before: "23:00:00"
action:
- service: switch.turn_on
entity_id: switch.aqara_t1
alias: "Turn off IR panel"
id: 13abc2b8-7f5f-40e5-9586-44c4ab03d139
description: >
Turn off the IR panel between 5am and 11pm when the
temperature rises above 19°C or if the door opens and
the temperature is already above 19°C.
trigger:
- platform: numeric_state
entity_id: sensor.aqara_temp
above: 19
- platform: state
entity_id: binary_sensor.aqara_door
to: 'on'
- platform: time
at: "23:30:00"
id: late
condition:
- or:
- and:
- condition: numeric_state
entity_id: sensor.aqara_temp
above: 19
- condition: time
after: "05:00:00"
before: "23:00:00"
- condition: trigger
id: late
action:
- service: switch.turn_off
entity_id: switch.aqara_t1
Awesome, thank you…
I’m learning HA, and YAML, bit by bit. These examples are helping a lot to understand how everything works.
I’ve added your code yesterday, March 10th, around 9:30. Seems like the panel only switches on, and but never off:
This is the code used: can you see what is going wrong?
This code was created through the UI of HA: just to try if this should work as mentioned in your reply.
alias: Toilet - Infraroodpanel uit
description: ""
trigger:
- type: temperature
platform: device
device_id: 3741bbc37ffeadac69b982bd6ca25adc
entity_id: sensor.toilet_temperature
domain: sensor
above: 19
condition:
- condition: and
conditions:
- condition: time
after: "05:00:00"
before: "23:00:00"
action:
- device_id: 26a429cf3ab32619274f9ae6346c6ce7
domain: mobile_app
type: notify
message: Verwarming toilet uit
title: Toilet
- type: turn_off
device_id: f3c6c5078d803378393f9234bb7bd694
entity_id: switch.toilet_infraroodpaneel_switch
domain: switch
mode: single