johanb7
(Johan)
April 24, 2020, 9:56am
1
Hi All,
I created the following Automation but the action (push) is still send even if the state is None:
alias: Send push if today is Restafval
description: ''
trigger:
- platform: template
value_template: '{{ is_state(''sensor.afvalinfo_today'', ''restafval'') }}'
- at: '11:50'
platform: time
condition: []
action:
- data:
message: Grijze container buitenzetten
title: Alert
service: notify.mobile_app_PHONE
I’ve also tried:
value_template: '"{% if is_state(''sensor.afvalinfo_today'', ''restafval'') %}true{%endif%}"'
But that isn’t working also.
Regards,
Johan
tom_l
April 24, 2020, 10:25am
2
value_template: "{{ is_state('sensor.afvalinfo_today', 'restafval') }}"
johanb7
(Johan)
April 24, 2020, 10:36am
3
changed to :
"{{ is_state('sensor.afvalinfo_today', 'restafval') }}"
but still getting the push message
tom_l
April 24, 2020, 10:38am
4
What does this resolve to in the developer tools template editor:
"{{ is_state('sensor.afvalinfo_today', 'restafval') }}"
Mutt
(Muttley)
April 24, 2020, 10:51am
6
Are you triggering this automation manually to test it by any chance ?
Your spacing is off, I count 3 spaces for some lines and 5 spaces for others (spacing should always be multiples of 2)
What about adding a condition (say) : -
condition:
- condition: template
value_template: "{{ states('sensor.afvalinfo_today') != 'none' }}"
I know that you specifically are triggering on == ‘restafval’
but the time trigger doesn’t
Mutt
(Muttley)
April 24, 2020, 10:52am
7
Binary sensors say false, how is that sensor constructed ?
johanb7
(Johan)
April 24, 2020, 10:58am
8
I just move the time and wait.
I’ll get the following error:
Error rendering template: TemplateSyntaxError: unexpected ‘%’
I think that time means check on the time if state is ‘restafval’ or am I incorrect?
Mutt
(Muttley)
April 24, 2020, 11:05am
9
sorry, corrected above, i cut and pasted a more complex condition, then simplified it but i made an error, corrected now.
post the yaml for the sensor
Your automation is triggering by time, not by the template.
Remove the time trigger, job done.
1 Like
johanb7
(Johan)
April 24, 2020, 12:05pm
11
Seems to work when I change the state manually.
my interpretation of the time tigger is different that how it works
Thanks
tom_l
April 24, 2020, 12:25pm
12
It’s a pretty simple trigger. At the time you specify it triggers. How did you think it worked?
2 Likes