Making an automation send every X seconds

Hey guys,

First time poster, long time reader.

I’ve set up my ESP32 with a DHT22 that sends temp readings to HASS. All working very find and dandy…

The next step is to send an email whenever the humidity goes over 75%. I am able to get them to send, but since the the temp can stay over 75C%for upwards of 5 - 6 hours, my email gets smashed with spam.

Here is the code I have at the moment:

- id: '1573536536560'
  alias: Humidity over 75%
  description: ''
  - above: '75'
    entity_id: sensor.humidity
    platform: numeric_state
  - condition: template
    value_template: '{{ as_timestamp(now()) - as_timestamp(states.automation.humidity_over_75.attributes.last_triggered) | int > 60 }}'
  - alias: ''
      message: Humidity over 75 omg
      title: Humidity over 75 omg
    service: notify.sendme

This however, doesn’t work at all - not even the annoying spam.

since the the temp can stay over 75C%for upwards of 5 - 6 hours, my email gets smashed with spam

That should not be the case. It should only trigger when crossing from below 75 to above 75. Once above it will not trigger again until it goes below 75 then above again.

Is your sensor becoming unavailable regularly or dropping below 75% regularly?

There are some minor changes I would make to your automation. Try this:

- id: '1573536536560'
  alias: 'Humidity over 75%'
  - above: 75
    entity_id: sensor.humidity
    platform: numeric_state
  - service: notify.sendme
      message: "Humidity is {{ states('sensor.humidity') }}"
      title: Humidity over 75 omg

If your sensor is hovering around 75%, dipping below and above regularly you could use this threshold binary sensor that can be configured to include a bit of hysteresis, so it triggers when going above 75 but does not reset until going below, say 70%. Then trigger off that instead.

  - platform: threshold
    name: 'Humidity Above 75%'
    entity_id: sensor.humidity
    upper: 72.5
    hysteresis: 2.5