This automation automatically retracts your awnings to protect them from damage when rain or strong wind is detected. It continuously monitors specific weather sensors to react timely and avoid unnecessary wear or damage.
Before retracting, the automation verifies that at least one awning is currently extended (open). Notifications are sent immediately to your configured mobile devices whenever the awnings are retracted, including details about the weather conditions that triggered the action.
Before deploying this automation, verify the following entities exist and are properly integrated into your Home Assistant system:
sensor.gw2000a_rain_rate – Rainfall rate sensor (mm/hour)sensor.gw2000a_wind_speed – Current wind speed sensor (km/h)sensor.gw2000a_max_daily_gust – Maximum daily wind gust sensor (km/h)sensor.gw2000a_wind_direction – Wind direction sensor (degrees, 0-360)cover.shelly2pmg3_8cbfea9f0c90 and cover.markiese – Your awning cover entitiesnotify.mobile_app_iphone_von_jessica, notify.mobile_app_iphone_randy)
        The automation triggers when any of the defined weather thresholds are exceeded for at least one minute. It also includes wind direction checks to limit retraction only to critical wind directions, reducing unnecessary awning movement during harmless winds. Finally, the automation confirms if at least one awning is currently extended (state open) before attempting to retract.
      
alias: Retract Awnings on Rain or Wind
description: >
  Retracts awnings when rainfall exceeds 0.2 mm/h or strong winds from sensitive
  directions are detected. Only acts if awnings are currently open.
triggers:
  - platform: numeric_state
    entity_id: sensor.gw2000a_rain_rate
    above: 0.2
    for: "00:01:00"
  - platform: numeric_state
    entity_id: sensor.gw2000a_wind_speed
    above: 20
    for: "00:01:00"
  - platform: numeric_state
    entity_id: sensor.gw2000a_max_daily_gust
    above: 30
    for: "00:01:00"
conditions:
  - condition: or
    conditions:
      - condition: numeric_state
        entity_id: sensor.gw2000a_rain_rate
        above: 0.2
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.gw2000a_wind_speed
            above: 20
          - condition: template
            value_template: >
              {{ 190 < states('sensor.gw2000a_wind_direction')|float < 260 }}
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.gw2000a_wind_speed
            above: 30
          - condition: or
            conditions:
              - condition: numeric_state
                entity_id: sensor.gw2000a_wind_direction
                below: 190
              - condition: numeric_state
                entity_id: sensor.gw2000a_wind_direction
                above: 260
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.gw2000a_max_daily_gust
            above: 30
          - condition: or
            conditions:
              - condition: numeric_state
                entity_id: sensor.gw2000a_wind_direction
                below: 190
              - condition: numeric_state
                entity_id: sensor.gw2000a_wind_direction
                above: 260
  - condition: or
    conditions:
      - condition: state
        entity_id: cover.shelly2pmg3_8cbfea9f0c90
        state: 'open'
      - condition: state
        entity_id: cover.markiese
        state: 'open'
actions:
  - service: notify.mobile_app_iphone_von_jessica
    data:
      title: "Awning Automation"
      message: "Awnings are retracting due to rain or strong wind."
  - service: notify.mobile_app_iphone_randy
    data:
      title: "Awning Automation"
      message: "Awnings are retracting due to rain or strong wind."
  - choose:
      - conditions:
          - condition: state
            entity_id: cover.shelly2pmg3_8cbfea9f0c90
            state: 'open'
        sequence:
          - service: cover.close_cover
            target:
              entity_id: cover.shelly2pmg3_8cbfea9f0c90
      - conditions:
          - condition: state
            entity_id: cover.markiese
            state: 'open'
        sequence:
          - service: cover.close_cover
            target:
              entity_id: cover.markiese
mode: single
      mode: single to avoid interrupting an ongoing retraction if triggered multiple times in short succession.