Hey Folks. I was wondering how to warn me before my whole water stuff outside freezes and bursts cause I forget to check the weather. The Solutions I found while searching the web did not click with me so here is what I came up with:

alias: Freezing Warning
description: ''
triggers:
  - trigger: time
    at: '07:00:00'
conditions: []
actions:
  - variables:
      message: Your massage to go out and close those Vales and empty the hoses
      mtittle: Freezing Alarm!
      minTemp: 2
  - action: weather.get_forecasts
    metadata: {}
    target:
      device_id: ChangeMe
    data:
      type: daily
    response_variable: daily
  - if:
      - condition: template
        value_template: |-
          {% set ns = namespace(freezing=false) %}
          {% for day in daily['weather.forecast_home'].forecast %}
            {% if day.templow < minTemp %}
              {% set ns.freezing = true %}
            {% endif %}
          {% endfor %}
          {{ ns.freezing }}
    then:
      - action: notify.send_message
        metadata: {}
        target:
          device_id: ChangeMe
        data:
          title: '{{ mtittle }}'
          message: '{{ message }}'
mode: single

Just a simple Automation. No editing template.yaml files. Could add a condition with a helper var like “I closed the vales etc” and don’t remind me every day. Guess I’ll do that… Be sure to change the ID of you location and ID of you mobile device for the message.

have fun, bye

  • ahmedezat_katteb@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 days ago

    Nice, this is one of those automations that pays for itself the first winter. Two small things that might make it nicer to live with:

    The loop with the namespace can be a one-liner, and you can limit it to the next couple of days so a cold snap six days out doesn’t nag you every morning all week:

    {{ (daily['weather.forecast_home'].forecast[:2]
        | map(attribute='templow') | min) < minTemp }}
    

    And to stop repeat alerts once you’ve actually done the work, pair it with an input_boolean like outdoor_water_winterized: add it as a condition (only notify when off), send the notification with an actionable button (“Done”) from the companion app, and have the button event flip the boolean on. Then a second automation turns it back off when the forecast lows climb above, say, 8 °C for a few days in spring. That also covers curbstickle’s point if you ever add more taps, one boolean per tap.