creis
(Christian)
July 4, 2022, 9:51am
21
alias: 'Pool: Poolday'
description: ''
trigger:
- platform: time
at: '06:00:00'
condition:
- condition:
alias: "temp above 22"
condition: template
value_template: "{{ state_attr('weather.dwd_weather_solingen_hohenscheid','forecast')[0]['temperature']|int(0) > 22 }}"
- condition: state
entity_id: input_boolean.at_home
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: sunny
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: partlycloudy
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.pool_heating
mode: single
yields
Message malformed: Expected a dictionary @ data['condition'][0]
This should work:
alias: 'Pool: Poolday'
description: ''
trigger:
- platform: time
at: '06:00:00'
condition:
- condition: template
alias: "temp above 22"
value_template: "{{ (state_attr('weather.dwd_weather_solingen_hohenscheid', 'forecast')[0]['temperature']) | int(0)) > 22 }}"
- condition: state
entity_id: input_boolean.at_home
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: sunny
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: partlycloudy
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.pool_heating
mode: single
creis
(Christian)
July 4, 2022, 9:54am
23
Woot! The above was able to save… Let’s hope it actually works
THANKS EVERYONE . I would not have done this in 10 years.
I live happily in the GUI editor. There is cake there. And no pain
1 Like
zoogara
(Daryl)
July 4, 2022, 9:55am
24
Ah - the old missing brackets (plural)…
Thanks @paddy0174 for the pickup.
1 Like
creis
(Christian)
July 4, 2022, 10:57am
25
Hey,
I had it force-run with time and it failed to run. The temperature element yields false. I bumped everything into the tempate editor: Your code is false, removing the “> 22” part shows unknown. If i put my original stuff in there it goes back to the correct temperature and even evaluates right.
Something amiss?
creis
(Christian)
July 4, 2022, 11:05am
26
Oddly, this worked:
- condition: template
alias: Precipitation
value_template: >-
{{
(states('weather.dwd_weather_solingen_hohenscheid.attributes.forecast[0].precipitation_probability')
| int(0)) < 20 }}
Fear my copy pasta
Hellis81
(Hellis81)
July 4, 2022, 11:18am
27
It shouldn’t work as far as I know.
You have states()
which takes the state of an entity.
Inside the states() you have half a syntax for the old method to get the attribute.
I have my doubts on this method.
It does not work for me
What Paddy wrote is correct and should work.
EDIT; no there is a )
too much…
value_template: "{{ (state_attr('weather.dwd_weather_solingen_hohenscheid', 'forecast')[0]['temperature']) | int(0) > 22 }}"
2 Likes
zoogara
(Daryl)
July 4, 2022, 11:38am
28
Hellis81:
It does not work for me
Didn’t work for me either.
Hellis81:
EDIT; no there is a )
too much…
value_template: "{{ (state_attr('weather.dwd_weather_solingen_hohenscheid', 'forecast')[0]['temperature']) | int(0) > 22 }}"
Yep, there is! After the int(0)
But the last one posted is something different. It uses “precipitation_probability” and not “temperature” as in the examples above.
So could we come back to one thing at a time? What is the actual code you’re using @creis and with what attributes should we work?
alias: 'Pool: Poolday'
description: ''
trigger:
- platform: time
at: '06:00:00'
condition:
- condition: template
alias: "temp above 22"
value_template: "{{ (state_attr('weather.dwd_weather_solingen_hohenscheid', 'forecast')[0]['temperature']) | int(0) > 22 }}"
- condition: state
entity_id: input_boolean.at_home
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: sunny
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: partlycloudy
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.pool_heating
mode: single
This is a corrected (removed the additional bracket) version, that should run without errors. Try this and report back, what errors come up. And please don’t change anything, just copy and paste it.
If you need something different afterwards, we can change that then, but for now, we need to establish some basics, like “is this running correctly or not?”.
creis
(Christian)
July 6, 2022, 11:48am
30
condition:
- condition: template
alias: Temperature
value_template: >-
{{ (state_attr('weather.dwd_weather_solingen_hohenscheid',
'forecast')[0]['temperature']) | int(0) >= 22 }}
- condition: state
entity_id: input_boolean.at_home
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: sunny
- condition: state
entity_id: weather.dwd_weather_solingen_hohenscheid
state: partlycloudy
- condition: template
alias: Precipitation
value_template: >-
{{
(states('weather.dwd_weather_solingen_hohenscheid.attributes.forecast[0].precipitation_probability')
| int(0)) < 20 }}
- condition: time
after: '05:00:00'
before: '10:00:00'
Hey all
I can confirm that with the above code the temperature and rain prediction is working like anticipated.
I can not give enought thanks to each and everyone of you guys. Without you I would not have be able to do this.
Thanks!
1 Like