Please help to create trigger to send alert every hour based on condition

Would someone kindly assist me with my poor scripting skills. I would like to get a notification every hour once my garage temperature has dropped below a certain temperature until it goes back to normal. At the moment it only triggers once. Thanks kindly in advance

- alias: "Garage Temperature Low"
  initial_state: "on"
  trigger:
    - platform: numeric_state
      entity_id: sensor.garage_temperature
      below: "25.0"
  condition:
    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.sensor.garage_temperature.attributes.last_triggered | default(0)) | int > 600)}}'
  action:
    - service: notify.alert
      data:
        title: 'Low Temperature!'
        message: > 
         {% if states('sensor.garage_temperature') | float < 25 %}
         Temperature is {{states.sensor.garage_temperature.state}}ยบC and dropping, the garage broiler may not be working!
         {% endif %}

I think you meant it the other way, time as the tigger and temp is the condition.

TIME TRIGGER

Time can be triggered in many ways. The most common is to specify at and trigger at a specific point in time each day. Alternatively, you can also match if the hour, minute or second of the current time has a specific value. You can prefix the value with a / to match whenever the value is divisible by that number. You cannot use at together with hour, minute or second.

automation:
  trigger:
    platform: time
    # Matches every hour at 5 minutes past whole
    minutes: 5
    seconds: 00

Maybe use the Alert component that is designed for this exact purpose?

1 Like

Thanks for the info and correction on what I wanted. When I apply one of the time triggers it does notify me now regardless if the temp is below or above 25 C. I can’t seem to build the intelligence in the script to stop once the temp has gone above 25 C.

```
automation 3:
  trigger:
    platform: time
    # You can also match on interval. This will match every 5 minutes
    minutes: '/5'
    seconds: 00
```

As @anon43302295 wrote, why not use the alert component?

This is what I use to remind me that my garage door is still open after 5min every 5min:

alert:
  garage_door_open_long:
    name: Garage Door is still open!
    entity_id: binary_sensor.garage_door_sensor
    state: 'off'   # Optional, 'on' is the default value
    repeat: 5
    can_acknowledge: true  # Optional, default is true
    skip_first: true  # Optional, false is the default
    notifiers:
      - mypushbullet

Perfect I will give it a go. Thx

If anyone else is looking for the answer, every hour on the hour:

  trigger:
  - platform: time_pattern
    hours: '*'
2 Likes