I started to make an automation for my Terrace blind. The 4 conditions to open the sun cover are:
7:00 am
between 10th of June and 10th of September (i’m using a blueprint for date conversion)
AND when I’m home
AND when the weather is good (sunny or partly cloudy)
Here is the automation yaml. As I’m french, some part are french too…
Did I make a mistake ? How could I make it work? I’m pretty confident about the time and date conditions, less for the weather and presence.
My presence update (linked to the homeassistant app on IOS) seems to be working fine (map updated).
alias: Store terrasse
description: Uniquement en été quand il fait beau
trigger:
- platform: time
at: '7:00'
condition:
- condition: state
entity_id: person.thomas
state: home
- condition: and
conditions:
- condition: numeric_state
entity_id: input_number.month_day
above: '0610'
below: '0910'
- condition: and
conditions:
- condition: state
entity_id: weather.maison
state: sunny, partlycloudy
action:
- service: cover.close_cover
target:
entity_id: cover.store_terrasse
mode: single
I think your condition: and is wrong. It looks like you have 2 different and conditions and are both missing the second and conditions.
How about this?
alias: Store terrasse
description: Uniquement en été quand il fait beau
trigger:
- platform: time
at: '7:00'
condition:
- condition: state
entity_id: person.thomas
state: home
- condition: and
conditions:
- condition: numeric_state
entity_id: input_number.month_day
above: '0610'
below: '0910'
- condition: state
entity_id: weather.maison
state: sunny, partlycloudy
action:
- service: cover.close_cover
target:
entity_id: cover.store_terrasse
mode: single
Conditions are andby default. I’m not sure the weather condition would pass as true with both states listed. You may need to use AND and OR conditions.
- alias: Store terrasse
description: Uniquement en été quand il fait beau
trigger:
- platform: time
at: '7:00'
condition:
condition: and
conditions:
- condition: state
entity_id: person.thomas
state: home
- condition: numeric_state
entity_id: input_number.month_day
above: '0610'
below: '0910'
- condition: or
conditions:
- condition: state
entity_id: weather.maison
state: sunny
- condition: state
entity_id: weather.maison
state: partlycloudy
action:
- service: cover.close_cover
target:
entity_id: cover.store_terrasse
mode: single
It seems it’s only working with “or condition” for the weather.
Here is the code working fine:
alias: Store terrasse
description: Uniquement en été quand il fait beau
trigger:
- platform: time
at: '07:00'
condition:
- condition: state
entity_id: person.thomas
state: home
- condition: template
value_template: '{{ (6,10) <= (now().month, now().day) <= (9,10) }}'
- condition: or
conditions:
- condition: state
entity_id: weather.maison
state: sunny
- condition: state
entity_id: weather.maison
state: partlycloudy
action:
- service: cover.close_cover
target:
entity_id: cover.store_terrasse
mode: single
I’m back with some more. This automation works fine however I would like to make sure that if the rain come after the automation triggered, my blind will automatically open. Or in any case when rain is comming.
This time it should be:
when it’s rainy, lightening, …
What i’m not sure is, do the weather change state will trigger the automation? So I also included a time trigger (every 15 min the system check the weather).
I’m not sure if it’s possible to add a condition like “only when the blind is already close”.
Here is my code:
alias: Store terasse pluie
description: quand il pleut
trigger:
- platform: time_pattern
minutes: '15'
condition:
- condition: or
conditions:
- condition: state
entity_id: weather.home
state: hail
- condition: state
entity_id: weather.home
state: lightning-rainy
- condition: state
entity_id: weather.home
state: pouring
- condition: state
entity_id: weather.home
state: rainy
- condition: state
entity_id: weather.home
state: lightning
action:
- service: cover.open_cover
target:
entity_id: cover.store_terrasse
mode: single
But of course it seems to be not working. Right now my weather.home state is “rainy” but the automation is not triggered.
If you want every 15 minutes, you need minutes: '/15' (docs). Yours is triggering at xx:15 only.
Why not trigger off the weather directly though? Example below: you cannot use the UI editor to write the trigger list like that though. You’ll also need to check if my “cover is closed” condition works, as I don’t have any covers to know what the state looks like:
alias: Store terasse pluie
description: quand il pleut
id: ace1de9d-9ad1-4742-b0dd-dc3a363b4a4d
trigger:
- platform: state
entity_id: weather.home
to:
- "hail"
- "lightning-rainy"
- "pouring"
- "rainy"
- "lightning"
condition:
- condition: state
entity_id: cover.store_terrasse
state: 'closed'
action:
- service: cover.open_cover
target:
entity_id: cover.store_terrasse