Help with automatisation needed

Hi there :slight_smile:

I have some issues with an automatisation here…
The automatisation is based on the “waste scheduler” integration - which does provide information when waste will be collected.

There is a sensor, which does count the days untill the next collection. So far, so good…
The Automatisation should send a notification to the smartphne app, whenever one of the sensors is switching from 2 (days) to 1 (days) - so the notification will let us know, that tomorrow our paper waste will be collected or whatever collection it might be.

To prevent, that we’re receiving the notification at midnight, when the sensor is switching from 2 to 1 I thought, it might be ok to configure the automatisation in a way, that the state 1 must be set for 18 hrs.
That should send the notification in the evening at 18:00 … and it did work… more or less.

I think, the main issue is - when the sensor is switching to 1 - the counter for the 18 hrs will start - but if HomeAssistant will be rebooted in that time - and before the notification was sent, then the rule will become invalid.
Therefore, after reboot, the 18hrs of the state change isn’t true anymore and I don’t get any notification.

Do you have an Idea, how I can solve this problem?

- id: '1633179179384'
  alias: WasteCollection Schedule-Message
  description: Sends a notification for the waste-collection
  trigger:
  - platform: state
    entity_id: sensor.restmuell_daysto
    to: '1'
    for:
      hours: 18
      minutes: 0
      seconds: 0
      milliseconds: 0
  - platform: state
    entity_id: sensor.papier_daysto
    to: '1'
    for:
      hours: 18
      minutes: 0
      seconds: 0
      milliseconds: 0
  - platform: state
    entity_id: sensor.biomuell_daysto
    to: '1'
    for:
      hours: 18
      minutes: 0
      seconds: 0
      milliseconds: 0
  - platform: state
    entity_id: sensor.wertstoffe_daysto
    to: '1'
    for:
      hours: 18
      minutes: 0
      seconds: 0
      milliseconds: 0
  condition: []
  action:
  - device_id: 595e6d7767b0a8a7fa4ef7cd20fe1546
    domain: mobile_app
    type: notify
    title: New Message from Waste-Scheduler
    message: '{{states.sensor.abfallkalender.state}}'
  - device_id: 68ca672e69524af2096efe5b491da3f9
    domain: mobile_app
    type: notify
    message: '{{states.sensor.abfallkalender.state}}'
    title: New Message from Waste-Scheduler
  mode: single

Trigger on the hour going to 18, and include three or conditions for each sensor being 1.

2 Likes

ah… thanks … it could have been so easy :smiley:

new automatisation config:

- id: '1633179179384'
  alias: Müllabfuhr Benachrichtigung
  description: Benachrichtigung über einen bevorstehenden Termin der Müllabfuhr
  trigger:
  - platform: time
    at: '18:00'
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: sensor.restmuell_daysto
      state: '1'
    - condition: state
      entity_id: sensor.papier_daysto
      state: '1'
    - condition: state
      entity_id: sensor.wertstoffe_daysto
      state: '1'
    - condition: state
      entity_id: sensor.biomuell_daysto
      state: '1'
  action:
  - device_id: 595e6d7767b0a8a7fa4ef7cd20fe1546
    domain: mobile_app
    type: notify
    title: Neue Mitteilung von Abfall-Kalender
    message: '{{states.sensor.abfallkalender.state}}'
  - device_id: 68ca672e69524af2096efe5b491da3f9
    domain: mobile_app
    type: notify
    message: '{{states.sensor.abfallkalender.state}}'
    title: Neue Mitteilung von Abfall-Kalender
  mode: single

Will observe this when the next collection will come up :slight_smile: