Skip to content

Automation Examples

Fischer, Fabian edited this page Apr 28, 2026 · 1 revision

Automation Examples

Storm & Severe Weather

Close roller shutters before a thunderstorm

automation:
  - alias: "Close shutters before thunderstorm"
    trigger:
      - platform: state
        entity_id: binary_sensor.kachelmannwetter_thunderstorm_expected
        to: "on"
    action:
      - service: cover.close_cover
        target:
          area_id: wohnzimmer
      - service: notify.mobile_app
        data:
          title: "⛈️ Gewitter erwartet"
          message: "Rollläden wurden geschlossen."

Wind warning — secure outdoor furniture

automation:
  - alias: "Wind warning"
    trigger:
      - platform: numeric_state
        entity_id: sensor.kachelmannwetter_wind_gust_today
        above: 60
    action:
      - service: notify.mobile_app
        data:
          title: "💨 Sturmwarnung"
          message: >
            Windböen bis {{ states('sensor.kachelmannwetter_wind_gust_today') }} km/h erwartet.
            Gartenmöbel sichern!

Rain & Precipitation

Umbrella reminder when leaving home

automation:
  - alias: "Umbrella reminder"
    trigger:
      - platform: state
        entity_id: person.your_name
        from: "home"
    condition:
      - condition: state
        entity_id: binary_sensor.kachelmannwetter_rain_expected_3h
        state: "on"
    action:
      - service: notify.mobile_app
        data:
          title: "🌧️ Regenschirm mitnehmen!"
          message: >
            Regenwahrscheinlichkeit: {{ states('sensor.kachelmannwetter_precipitation_probability_today') }}%

Garden irrigation — skip when rain expected

automation:
  - alias: "Garden irrigation"
    trigger:
      - platform: time
        at: "06:00:00"
    condition:
      - condition: state
        entity_id: binary_sensor.kachelmannwetter_rain_expected_3h
        state: "off"
      - condition: numeric_state
        entity_id: sensor.kachelmannwetter_precipitation_probability_today
        below: 30
    action:
      - service: switch.turn_on
        target:
          entity_id: switch.garden_irrigation
      - delay: "00:30:00"
      - service: switch.turn_off
        target:
          entity_id: switch.garden_irrigation

Close roof window when rain starts

automation:
  - alias: "Close roof window on rain"
    trigger:
      - platform: state
        entity_id: binary_sensor.kachelmannwetter_rain_expected_3h
        to: "on"
    condition:
      - condition: state
        entity_id: cover.dachfenster
        state: "open"
    action:
      - service: cover.close_cover
        target:
          entity_id: cover.dachfenster
      - service: notify.mobile_app
        data:
          title: "🌧️ Dachfenster geschlossen"
          message: "Regen in den nächsten 3 Stunden erwartet."

Frost & Cold

Frost warning notification

automation:
  - alias: "Frost warning tonight"
    trigger:
      - platform: state
        entity_id: binary_sensor.kachelmannwetter_frost_expected_tonight
        to: "on"
    condition:
      - condition: time
        after: "16:00:00"
        before: "22:00:00"
    action:
      - service: notify.mobile_app
        data:
          title: "🥶 Frostwarnung"
          message: >
            Heute Nacht wird es {{ state_attr('weather.kachelmannwetter', 'forecast')[0].native_templow }}°C kalt.
            Pflanzen reinholen!

Activate frost protection on heating

automation:
  - alias: "Frost protection heating"
    trigger:
      - platform: state
        entity_id: binary_sensor.kachelmannwetter_frost_expected_tonight
        to: "on"
    action:
      - service: climate.set_preset_mode
        target:
          entity_id: climate.garage
        data:
          preset_mode: "frost_protection"

Solar & Energy

PV forecast morning briefing

automation:
  - alias: "PV forecast morning briefing"
    trigger:
      - platform: time
        at: "07:00:00"
    action:
      - service: notify.mobile_app
        data:
          title: "☀️ Solar-Prognose"
          message: >
            Heute: {{ states('sensor.kachelmannwetter_global_radiation_today') }} Wh/m²
            ({{ states('sensor.kachelmannwetter_sun_hours_today') }}h Sonne, {{ states('sensor.kachelmannwetter_sun_hours_relative_today') }}%)
            Morgen: {{ states('sensor.kachelmannwetter_global_radiation_tomorrow') }} Wh/m²
            ({{ states('sensor.kachelmannwetter_sun_hours_tomorrow') }}h Sonne)

Delay dishwasher/washing machine for sunny hours

automation:
  - alias: "Run appliances during solar peak"
    trigger:
      - platform: time
        at: "08:00:00"
    condition:
      - condition: numeric_state
        entity_id: sensor.kachelmannwetter_global_radiation_today
        above: 3000
    action:
      - service: notify.mobile_app
        data:
          title: "☀️ Sonniger Tag!"
          message: >
            {{ states('sensor.kachelmannwetter_global_radiation_today') }} Wh/m² erwartet.
            Guter Tag für Waschmaschine & Spülmaschine zwischen 11–15 Uhr.

EV charging preference on sunny days

automation:
  - alias: "EV charge on solar surplus"
    trigger:
      - platform: time
        at: "09:00:00"
    condition:
      - condition: numeric_state
        entity_id: sensor.kachelmannwetter_sun_hours_today
        above: 6
    action:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.ev_solar_charging_preferred

Lighting

Outdoor lights based on civil dusk/dawn

automation:
  - alias: "Outdoor lights on at civil dusk"
    trigger:
      - platform: template
        value_template: >
          {{ now().isoformat()[:19] == states('sensor.kachelmannwetter_civil_dusk')[:19] }}
    action:
      - service: light.turn_on
        target:
          area_id: vorgarten

  - alias: "Outdoor lights off at civil dawn"
    trigger:
      - platform: template
        value_template: >
          {{ now().isoformat()[:19] == states('sensor.kachelmannwetter_civil_dawn')[:19] }}
    action:
      - service: light.turn_off
        target:
          area_id: vorgarten

Adjust indoor lighting based on cloud coverage

automation:
  - alias: "Boost indoor lights on cloudy days"
    trigger:
      - platform: numeric_state
        entity_id: sensor.kachelmannwetter_cloud_coverage_low
        above: 80
    condition:
      - condition: state
        entity_id: binary_sensor.kachelmannwetter_daytime
        state: "on"
    action:
      - service: light.turn_on
        target:
          area_id: wohnzimmer
        data:
          brightness_pct: 80

Moon & Astronomy

Full moon notification for astrophotography

automation:
  - alias: "Full moon tonight"
    trigger:
      - platform: numeric_state
        entity_id: sensor.kachelmannwetter_moon_illumination
        above: 95
    condition:
      - condition: numeric_state
        entity_id: sensor.kachelmannwetter_cloud_coverage_high
        below: 30
    action:
      - service: notify.mobile_app
        data:
          title: "🌕 Vollmond bei klarem Himmel"
          message: >
            Mondbeleuchtung: {{ states('sensor.kachelmannwetter_moon_illumination') }}%
            Bewölkung: {{ states('sensor.kachelmannwetter_cloud_coverage_high') }}%
            Perfekt für Astrofotografie!

API Monitoring

Rate limit warning

automation:
  - alias: "API rate limit warning"
    trigger:
      - platform: numeric_state
        entity_id: sensor.kachelmannwetter_api_requests_remaining
        below: 50
    action:
      - service: notify.mobile_app
        data:
          title: "⚠️ KachelmannWetter API"
          message: >
            Nur noch {{ states('sensor.kachelmannwetter_api_requests_remaining') }} API-Requests übrig.
            Eventuell Update-Intervall erhöhen.

Daily Weather Summary (TTS / Notification)

Morning weather briefing

automation:
  - alias: "Morning weather briefing"
    trigger:
      - platform: time
        at: "07:30:00"
    action:
      - service: notify.mobile_app
        data:
          title: "🌤️ Wetter heute"
          message: >
            {{ state_attr('weather.kachelmannwetter', 'temperature') }}°C,
            {{ states('weather.kachelmannwetter') | replace('partlycloudy', 'teilweise bewölkt') | replace('sunny', 'sonnig') | replace('cloudy', 'bewölkt') | replace('rainy', 'regnerisch') }}.
            Max: {{ state_attr('weather.kachelmannwetter', 'forecast')[0].native_temperature }}°C.
            {% if is_state('binary_sensor.kachelmannwetter_rain_expected_3h', 'on') %}☔ Regen erwartet. {% endif %}
            {% if is_state('binary_sensor.kachelmannwetter_thunderstorm_expected', 'on') %}⛈️ Gewitter möglich! {% endif %}
            Sonne: {{ states('sensor.kachelmannwetter_sun_hours_today') }}h

Clone this wiki locally