How to automate my awning (sunscreen)

Since we’re all sharing; here’s an update of my most recent version of the ‘sunscreen’ automation :slight_smile:

Changes:

  1. Weather Underground is no longer available if you’re not operating your own weather station. I just installed my own weather station, it’s been especially helpful for wind so far.
  2. The forecast for ‘high temperature today’ is coming from DarkSky now (not Weather Underground).
  3. There are now 2 automations for automatically rolling it up: 1 for ‘urgent up’ (rain/wind/sunset) and 1 for ‘regular up’. The ‘urgent up’ automation is always active, while the ‘regular up’ is inactive if you choose to operate the awning manually (= from Google Home in my case). This has increased the WAF significantly.

Automations:

- alias: Awning automatically down
  trigger:
  - platform: time_pattern
    minutes: '/1'
    seconds: 1
  condition:
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sun.sun
      value_template: '{{ states.sun.sun.attributes.azimuth }}'
      above: 130
      below: 265
    - condition: state
      entity_id: sun.sun
      state: 'above_horizon'
    - condition: state
      entity_id: cover.zonnescherm_level
      state: open
      for:
        minutes: 30
    - condition: sun
      before: sunset
      before_offset: -00:45:00
    - condition: numeric_state
      entity_id: sensor.dark_sky_daytime_high_temperature_0d
      above: 18
    - condition: numeric_state
      entity_id: sensor.wind_kph_avg_mean
      below: 7
    - condition: numeric_state
      entity_id: sensor.br_precipitation_forecast_total
      below: 0.1
    - condition: template
      value_template: '{{ now().month > 2 }}'
    - condition: template
      value_template: '{{ now().month < 10 }}'
    - condition: numeric_state
      entity_id: sensor.irradiance_avg_mean
      above: 350
    - condition: state
      entity_id: input_boolean.vacation_mode
      state: 'off'
    - condition: state
      entity_id: input_boolean.sunscreen_manual_up
      state: 'off'
  action:
    - service: switch.turn_on
      entity_id: switch.sunscreenswitch
    - service: notify.by_telegram
      data:
        message: The awning has automatically rolled down.

- alias: Sunscreen up with urgency
  trigger:
  - platform: sun
    event: sunset
    offset: -00:45:00
  - platform: numeric_state
    entity_id: sensor.wind_kph_avg_mean
    above: 7
  - platform: numeric_state
    entity_id: sensor.br_precipitation_forecast_total
    above: 0.2
  condition:
    condition: state
    entity_id: cover.zonnescherm_level
    state: closed
    for:
      seconds: 30
  action:
  - service: switch.turn_off
    entity_id: switch.sunscreenswitch
  - service: input_boolean.turn_off
    entity_id: input_boolean.sunscreen_manual_down
  - service: notify.by_telegram
    data:
      message: The awning was rolled up because of wind, predicted rain or nearing sunset. 

- alias: Awning automatically up low sunlight
  trigger:
    - platform: numeric_state
      entity_id: sensor.irradiance_avg_mean
      below: 290   # low sunlight
    - platform: numeric_state
      entity_id: sun.sun
      value_template: '{{ states.sun.sun.attributes.azimuth }}'
      above: 270   # the sun is no longer hitting the window
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: cover.zonnescherm_level
      state: closed
      for:
        seconds: 30  # the time it takes for the awning to fully open or close
    - condition: state
      entity_id: input_boolean.sunscreen_manual_down
      state: 'off'    # the awning was not manually opened
    - condition: sun
      after: sunset
      after_offset: "-4:00:00"  # sunset is within 4 hours
  action:
  - service: switch.turn_off
    entity_id: switch.sunscreenswitch
  - service: notify.by_telegram
    data:
      message: The awning was rolled up because of low sunlight (< 290 W/m2 or azimuth > 270) and sunset is within 4 hours.
4 Likes