How to resolve the restriction on sending repeated notifications to my phone?

Hi, I’d like to ask for advice on how to resolve the restriction on sending repeated notifications to my phone.
I have a level meter in the well and an automation set up that sends notifications to my phone if the level meter measures a certain level, which I consider to be full water.
The problem is that the level sometimes drops a little below the upper limit and overnight (or when I’m not at home) the level rises again a little above the upper limit and the automation sends notifications again.
Sometimes it oscillates like this several times a day.
It is enough for me only to send a notification once and the maximum level and then when the water in the well is at the minimum level, so that the notification about the minimum level comes. I made an auxiliary timer which, after sending the notification, starts counting down 36 hours and during this time does not allow sending notifications again.
But I find such a complicated solution.
I don’t know how many hours of countdown will be ideal to set.
And there is also the disadvantage that the countdown will be inactive when the RPi is restarted, no matter how much time is left.
Don’t have a better idea how to solve this?


- id: '1615030560316'
  alias: Notifikace o nízké hladině vody ve studni
  description: ''
  trigger:
  - platform: numeric_state
    for: '1200'
    entity_id: sensor.ts_ft002_38_d
    above: '1030'
  condition:
  - condition: state
    entity_id: timer.casovac
    state: idle
  action:
  - device_id: b217d35d300b78be20b279023bb2367c
    domain: mobile_app
    type: notify
    message: Přepnout na vodovod!
    title: Hladinoměr studna
  - device_id: 0b8b170a85a8824d8c15f9c2a6faf980
    domain: mobile_app
    type: notify
    message: Přepnout na vodovod!
    title: Hladinoměr studna
  - service: timer.start
    data:
      duration: '0'
    target:
      entity_id: timer.casovac
  mode: single
- id: '1615031512088'
  alias: Notifikace o vysoké hladině vody ve studni
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.ts_ft002_38_d
    for: '1200'
    below: '720'
  condition:
  - condition: state
    entity_id: timer.casovac
    state: idle
  action:
  - device_id: b217d35d300b78be20b279023bb2367c
    domain: mobile_app
    type: notify
    message: Přepnout na studnu!
    title: Hladinoměr studna
  - device_id: 0b8b170a85a8824d8c15f9c2a6faf980
    domain: mobile_app
    type: notify
    message: Přepnout na studnu!
    title: Hladinoměr studna
  - service: timer.start
    data:
      duration: '0'
    target:
      entity_id: timer.casovac
  mode: single

You could create a threshold binary sensor.

This has configurable hysteresis. So you can set it to only turn on at the maximum level and off at the minimum.

If you then use this as a state trigger (with no state specified) for a single notification automation it will only notify you at the max and min levels.

You can use a template in the message to tell you the level.

Thank you for answer. But I’m not sure that’s what I need. I can’t set it up.
The point is that I have the notification for the maximum level set, for example, at a level height of 3.5 m. And it is at this level that I receive a notification to turn on the water supply tap from the well.
At a level height of 3.5 m, I will receive a notification and turn on the water tap from the well. The level drops to 3.4m. Then at night the level will rise again to 3.5m and I will receive a notification again. At that time, however, the water supply tap from the well is still on and will be on until the level is 0.2 m.

You might disable the automation.
When you reach the maximum, you disable the “maximum” automation and enable "the “minimum” one, and vice-versa.

- service: automation.turn_off
  data:
    entity_id: automation.notifikace_o_nizke_hladine_vody_ve_studni
- service: automation.turn_on
  data:
    entity_id: automation.notifikace_o_vysoke_hladine_vody_ve_studni

This binary sensor will turn on at 3.5m and off at 0.2m:

binary_sensor:
  - platform: threshold
    name: Well Min Max
    entity_id: sensor.ts_ft002_38_d
    upper: 1.85
    hysteresis: 1.65

This automation will notify you to turn your well tap on at 3.5m and off at 0.2m

- id: '1615030560316'
  trigger:
  - platform: state
    entity_id: binary_sensor.well_min_max
  action:
  - service: notify.mobile_app
    data:
      message: "Well level is {{ '3.5m' if is_state('binary_sensor.well_min_max', 'on') else '0.2m' }}"