Weather automation help

Hi, I’m currently attempting to set up an automation that goes something like:

“close the bedroom blinds in the afternoon if the weather forecast is sunny”.

I’ve got the met.no integration set up, and the blind is controlled by an Aqara E1 Roller Shade via Zigbee.

The thing is, I’m not convinced I’m doing the automation right. So far I’ve got this:

alias: Close bedroom blind in afternoon if it's sunny
description: ""
trigger:
  - platform: time
    at: "14:00:00"
condition:
  - condition: state
    entity_id: weather.forecast_home
    state: sunny
action:
  - device_id: 8864f5bf28f130fa56d22c222adf9fb5
    domain: cover
    entity_id: 23e8c1ca396f9553d60dd0ecc2f9dc9c
    type: close
mode: single

Am I on the right track here?

Seems to be ok so far, at least there aren’t any obvious issues. :slight_smile:

I wouldn’t do it that way though, as this automation only reacts, if at exactly 14:00h the state is sunny. If the state changes from cloudy to sunny at 14:05h, the automation won’t react.

To be a little more flexible, I’d use a state change of the weather to sunny, and check the time within the condition, preferrably with a time frame, like *after 14:00h" and “before xx:00h”.

And on a sidenote, avoiding device_ids is recommended, see here:

Hi, I have done something similar.
My trigger is the azimuth changing.
Then the condition is if the azimuth has a certain value so that the automation will not run if the sun is not on that part of the house.
Another condition is the elevation of the sun so the automation will not trigger in the winter, fall or spring.

Awesome, thanks for the tips!

Here’s what I’ve got now. Hoping it works.

alias: Close bedroom blind in afternoon sun
description: ""
trigger:
  - platform: state
    entity_id:
      - weather.forecast_home
    from: null
    to: sunny
condition:
  - condition: time
    after: "14:00:00"
    before: "23:00:00"
action:
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.main_bedroom_blind_cover
mode: single

@Nick4 ok that sounds fancy - I’d like to explore doing that but don’t really know where to begin. Don’t suppose you could share some code?

Sounds like a plan! :slight_smile: :+1:

I didn’t mention it before, because I didn’t want to confuse you, but we do have some great integrations for such a thing. If you want to “go nuts” on your covers, I can highly recommend this custom integration from @basbrus:

Using it myself from the beginning (started as a blueprint grew into a full blown integration), I can only speak the best about it. Works like a charme, is supported very well, nothing bad to say.
It needs some time to configure it perfectly, but that is neglectable, if you aren’t Mr.Monk… :joy: Eg. it took me a few days, to find the ideal cover positions, but we’re talking here about 30% open or 31% open… :joy:

If you want your covers automated, this is the integration to go with! Give it a try, if you want to! :slight_smile:

1 Like

Wow that’s amazing - digging in to this now!

1 Like

Hmm, I’ve attempted to set this up, but it doesn’t seem to be working right - it seems to think my blinds should be closed most of the way - seemingly much more than would be required to block direct sunlight.

I wonder - is there a way to use this without the partial shading feature? Like - just have it fully open or fully closed?

Also, do you know what they mean by “Window Height”? Is it the distance from the top of the window to the bottom of the window, or the top of the window to the floor?

Thanks

So this is the automation that I came up with (and works)

alias: "Livingroom: Close curtains is sun is on side wall & to hot"
description: "with outside temp +25C & sun on side wall: close curtains"
trigger:
  - platform: state
    entity_id:
      - sensor.sun_azimuth
condition:
  - above: "25"
    condition: numeric_state
    entity_id: weather.home
    value_template: "{{ state_attr(\"weather.home\", \"temperature\") }}"
    enabled: true
  - condition: or
    conditions:
      - condition: state
        entity_id: weather.home
        state: sunny
      - condition: state
        entity_id: weather.home
        state: partlycloudy
  - condition: numeric_state
    entity_id: sensor.sun_azimuth
    above: 162
    below: 270
action:
  - if:
      - condition: state
        entity_id: switch.curtain_s1
        state: "on"
        for:
          hours: 1
          minutes: 0
          seconds: 0
    then:
      - data: {}
        entity_id: switch.curtain_s1
        service: switch.turn_off
  - delay: "00:00:03"
  - if:
      - condition: state
        entity_id: switch.curtain_s2
        state: "on"
        for:
          hours: 1
          minutes: 0
          seconds: 0
    then:
      - data: {}
        service: switch.turn_off
        target:
          entity_id: switch.curtain_s2
mode: single
1 Like

So… I am very interested in the Adaptive Cover integration, but it is quite involved setting it up and I haven’t quite got the hang of it yet. I was hoping I’d be able to use it with climate mode, but without presence detection. Also - I’m not really sure I want it calculating partially-open conditions - I probably want the blinds always fully open or fully closed, depending on whether the room is hot and whether the sun is shining in the window.

I’ll keep trying with it, but in the meantime, this is what I’ve got:

alias: Close bedroom blind in afternoon sun
description: ""
trigger:
  - platform: state
    entity_id:
      - weather.forecast_home
    from: null
    to: sunny
  - platform: time
    at: "14:00:00"
condition:
  - condition: time
    after: "14:00:00"
  - condition: state
    entity_id: weather.forecast_home
    state: sunny
action:
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.main_bedroom_blind_cover
mode: single

It’s not the position of the blinds/curtains that is controlled, they are either closed or open.
I take into consideration the position of the sun relative to the house so the curtains are not always closed.
Also, I don’t want this automation fire in the winter when it’s sunny.

I advice you to think ahead and make your automations so that you don’t have to change/disable them because of changing circumstances.
It’s one thing to automate stuff in your house, it becomes much more interesting if you make your house smart.

I had the same trouble, until I got the hang of it. But the best place to ask would be the thread of the integration. The developer, @basbrus (sorry for tagging you, it’s more of an FYI), does a great job in supporting people. Just ask, I’ll promise he won’t bite! :laughing:

This works fine, I’m using it like that! :slight_smile:

This is possible as well, but I can’t remember how. I accidentally had it configured that way first. :laughing:

As I said, please ask in the corresponding thread, there is help on the horizon! :slight_smile: I need to do this myself, because I had configured it for a friend (in his installation), and it seems I did it totally wrong… I won’t touch mine for the foreseeable future - never touch a running system… :rofl:

1 Like