macraj
(Macraj)
March 10, 2021, 7:07pm
1
Hi,
Im trying to use weather forecast in my automation. I would like to use weather state ( ‘sunny’ ) to close blinds but without success. I prepared test with TV trigger, the weather state is ‘Sunny’ but not working.
What’s wrong with this ?
mode: single
- id: '1615108999721'
alias: Test
description: ''
trigger:
- platform: state
entity_id: weather.home
attribute: forecast
to: sunny
- platform: device
device_id: d299138eaaf0b16575f8ef26fedb2336
domain: media_player
entity_id: media_player.sony_bravia_tv
type: turned_off
- platform: device
device_id: d299138eaaf0b16575f8ef26fedb2336
domain: media_player
entity_id: media_player.sony_bravia_tv
type: turned_on
condition:
- condition: state
entity_id: weather.home
state: sunny
attribute: forecast
action:
- device_id: 018bc1495c2dc842e24d5e8d9532bd88
domain: mobile_app
type: notify
title: Weather Report
message: Weather changed state!
123
(Taras)
March 10, 2021, 8:38pm
3
In addition, remove the State Condition because, in this case, it’s redundant.
macraj
(Macraj)
June 7, 2021, 9:56am
5
Again, new problems. I added new conditions it’s stops working.
- id: '1615020332816'
alias: TV ON at day
description: ''
trigger:
- platform: device
device_id: d299138eaaf0b16575f8ef26fedb2336
domain: media_player
entity_id: media_player.sony_bravia_tv
type: turned_on
condition:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: '60'
- condition: state
entity_id: weather.home
state: sunny
- condition: or
conditions:
- condition: state
entity_id: weather.home
state: partlycloudy
action:
- scene: scene.close_roller_when_sunny_and_tv
mode: single
Executed: 7 czerwca 2021, 12:35:48
Result:
result: false
conditions/0
Executed: 7 czerwca 2021, 12:35:48
Result:
result: true
conditions/0/entity_id/0
Executed: 7 czerwca 2021, 12:35:48
Result:
result: true
state: partlycloudy
wanted_state: partlycloudy
conditions/1
Executed: 7 czerwca 2021, 12:35:48
Result:
result: false
conditions/1/conditions/0
Executed: 7 czerwca 2021, 12:35:48
Result:
result: false
conditions/1/conditions/0/entity_id/0
Executed: 7 czerwca 2021, 12:35:48
Result:
result: false
state: partlycloudy
wanted_state: sunny
Why is wanted state: sunny.
Automatition should work: when Sun is below 60.0 and weather state is partlycloudly or sunny
T1ppes
June 7, 2021, 10:55am
6
Your current defined conditions read as follows:
The sun’s elevation is below 60° and
It is currently sunny and
It is currently partly sunny or […]
In other words your hierarchy seems to be wrong at the moment you define an or related condition, but only provide one condition. Try moving the Or relationship up, so that it relates to sunny and partly sunny.
123
(Taras)
June 7, 2021, 11:30am
7
- id: '1615020332816'
alias: TV ON at day
description: ''
trigger:
- platform: device
device_id: d299138eaaf0b16575f8ef26fedb2336
domain: media_player
entity_id: media_player.sony_bravia_tv
type: turned_on
condition:
- "{{ state_attr('sun.sun', 'elevation') < 60) }}"
- "{{ states('weather.home') in ['sunny', 'partlycloudy'] }}"
action:
- scene: scene.close_roller_when_sunny_and_tv
mode: single
macraj
(Macraj)
June 7, 2021, 2:09pm
8
Thanx, look professional
I changed conditions like this:
- id: '1615020332816'
alias: TV ON at day
description: ''
trigger:
- platform: device
device_id: d299138eaaf0b16575f8ef26fedb2336
domain: media_player
entity_id: media_player.sony_bravia_tv
type: turned_on
condition:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: '65.0'
- condition: or
conditions:
- condition: state
entity_id: weather.home
state: partlycloudy
- condition: or
conditions:
- condition: state
entity_id: weather.home
state: sunny
action:
- scene: scene.close_roller_when_sunny_and_tv
mode: single
and now works.
Thanks a lot