Hi, please apologies if asked already but I’m trying to understand the Triggers and Conditions and when I trigger manually a automation if they are respected…
Scenario: I have an automation that will check if any of the Temps across the house are bellow 18 and if so, turns on the boiler(heating) but I do not want this to happen if none of us is home.
This is what I have:
- id: '1547051043616'
alias: Turn Heating ON IF Cold
trigger:
- below: '18'
entity_id: sensor.netatmo_the_inside_temperature
for: 00:15:00
platform: numeric_state
- below: '18'
entity_id: sensor.netatmo_the_otherside_temperature
for: 0:15:00
platform: numeric_state
- below: '18'
entity_id: sensor.kitchen_temp
platform: numeric_state
condition:
- condition: state
entity_id: input_select.house_occupancy
state: 'Home'
action:
- entity_id: switch.arest_pin_one_boiler
service: homeassistant.turn_on
- data:
message: Turning the Heating ON for 60mins...its cold...
title: Heating ON
service: notify.ios_joaos_iphone
- delay: 01:00:00
- entity_id: switch.arest_pin_one_boiler
service: homeassistant.turn_off
- data:
message: Turning the Heating OFF after 60mins...it was cold...
title: Heating OFF
service: notify.ios_joaos_iphone
For the check if we’re at home I’m using something I found on this forum to setup a extra input:
input_select:
house_occupancy:
name: Where are we?
options:
- Away
- Home
- Holidays
icon: mdi:home-map-marker
And the automation for this is:
- id: '1547464779330'
alias: Presence - no one home
hide_entity: true
trigger:
platform: state
entity_id: group.phoneslocations
to: not_home
for:
minutes: 15
action:
service: input_select.select_option
data:
entity_id: input_select.house_occupancy
option: Away
- id: '1547464770330'
alias: Presence - someone home
hide_entity: true
trigger:
platform: state
entity_id: group.phoneslocations
to: home
for:
minutes: 5
action:
service: input_select.select_option
data:
entity_id: input_select.house_occupancy
option: Home
Now, if I trigger this manually it always turns on no mater if the input_select.house_occupancy is set to Home or Away. But if I let it just run it won’t trigger at all.
Now I know that without the Conditions it will trigger since it happened this night. Unless, do my triggers need to all be under 18 for it to be actioned or its “or”.
So the questions:
1 - Is it expected that if I run manually it will turn the boiler on? Even with the status set to Away.
2 - Should I define condition to Away or Home?
3 - What I’m I doing wrong?
You have it all figured out, but you just missed a spot:
You answers:
1- Yes. As far as I know, when you manually trigger an automation, it just goes off no matter what the conditions are.
2- Away. Think of it like that:
When do I trigger? When temp is below 18 for 15’ IF everyone is away
3- The condition
Something I noticed is that you are missing the for: 00:15:00 on the kitchen_temp trigger. Did you forget it?
EDIT:
I should read more carefully… You want it to trigger when you are HOME… so your condition is correct.
Try without quotes and see if it triggers
condition:
- condition: state
entity_id: input_select.house_occupancy
state: Home
See the temp. It has been bellow 18 for quite some time, so it should have triggered, so I’m wondering if it needs to be on the same temp, not heigher or lower than 18 for 15 mins? I mean if goes to 17.5 then 17.3 in the space of less than 15 mins it will not trigger?
Thanks for the reply @finity.
I was just testing that. I was just also wondering if it requires a number and the values that the temp sensor is adding are floats?
To add to this:
{% if states.sensor.netatmo_the_otherside_temperature.state|float < 18 %} true {% endif %}
{% if states.sensor.netatmo_the_inside_temperature.state|float < 17 %} true {% endif %}
{% if states.sensor.kitchen_temp.state|float < 18 %} true {% endif %}
This returns true… but if I remove the |float I get no results…
the only thing I can think is that the temp sensor is “hovering” around the setpoint and every time it goes above and then back below the setpoint it triggers again.
The hovering can not do it as there is the FOR condition. One thing I can think of would be that temperatures were below trigger limit, you would have 4 temp triggers and reloaded the automations. This way all of them would trigger after set 15 min. But as you have only 3 this can’t be the case…
I would also prevent the automation running again when the boiler has been turned on the first time. So add a condition that the boiler needs to be off. This way if one of the temperatures would cause another trigger the automation is not interfered.
I’m not sure if your one hour delay in the automation is 100% safe. I would make another automation to turn the boiler off after it has been on for one hour. And maybe link it to some input_boolean if you are controlling the boiler from some other places also.
Thanks for all the replies.
So two things… the duplication of the Automations, seems to be a bug on the latest HA version. So I’ve rolled back for now. GitHub issue here: #19970
Yes, you are correct, running with a delay is not a good idea, and I’ve also added a status check to see if the boiler is already on. So this is what I have at the moment.
- id: '1547051043616'
alias: Turn Heating ON IF Cold
trigger:
- below: 17
entity_id: sensor.netatmo_the_inside_temperature
for: 00:15:00
platform: numeric_state
- below: 17
entity_id: sensor.netatmo_the_otherside_temperature
for: 0:15:00
platform: numeric_state
- below: 17
entity_id: sensor.kitchen_temp
for: 00:15:00
platform: numeric_state
condition:
- condition: state
entity_id: input_select.house_occupancy
state: Home
- condition: state
entity_id: sensor.boiler_status
state: '0'
action:
- entity_id: switch.timed_boiler
service: homeassistant.turn_on
- data:
message: Turning the Heating ON for 60mins...its cold...
title: Heating ON
service: notify.ios_joaos_iphone
The good news is that it triggered twice during the night… The bad news is that I’m not sure if it triggered correctly. Looking at the temps it seems it was Ok to be triggered but then again… So I’ll keep monitoring…