Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation for sending notification 'afval for tomorrow' #385

Open
ViezeVisNL opened this issue Jan 20, 2025 · 1 comment
Open

Automation for sending notification 'afval for tomorrow' #385

ViezeVisNL opened this issue Jan 20, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ViezeVisNL
Copy link

ViezeVisNL commented Jan 20, 2025

The problem

In 2 previous versions it was possible to receive a notification for the trash what was going to be picked up the next day but for some reasons after 2 releases this broke. I think due to the sensors being changed or something. Is there a working notification automation available which sends a notification at 16.30 which trash is being picked up the next day? I got this now:


`alias: Afval (package) - Send notification for tomorrow
triggers:
  - hours: /3
    trigger: time_pattern
conditions:
  - condition: and
    conditions:
      - condition: time
        after: "16:30:00"
        before: "23:00:00"
      - condition: template
        value_template: "{{ states('sensor.afvalwijzer_tomorrow_formatted') != 'Geen' }}"
actions:
  - data:
      title: "{{ states.sensor.afvalwijzer_tomorrow_formatted.state }} aan de weg!"
      message: >-
        Vergeet niet om {{ states.sensor.afvalwijzer_tomorrow_formatted.state }}
        aan de weg te zetten. Wordt morgen opgehaald: {{ (as_timestamp(now()) +
        (24*3600)) | timestamp_custom("%d-%m-%Y", True) }}!
      data:
        actions:
          - action: MARK_WASTE_MOVED
            title: Afval verwerkt
            activationMode: background
            authenticationRequired: false
            destructive: true
            behavior: default
        push:
          badge: 5
        action_data:
          entity_id: input_boolean.trash_outside
    action: notify.all_devices
`

And the new version I tried when the state changes but this generates false notification. (Trash 'geen' will be picked up).

`alias: Afval NEW (package) - Send notification for tomorrow
triggers:
  - hours: /3
    trigger: time_pattern
  - trigger: state
    entity_id:
      - sensor.afvalwijzer_tomorrow_2
    from: Geen
    to: null
conditions:
  - condition: and
    conditions:
      - condition: time
        after: "16:30:00"
        before: "23:00:00"
      - condition: template
        value_template: "{{ states('sensor.afvalwijzer_tomorrow_2') != 'Geen' }}"
        enabled: false
actions:
  - data:
      title: "{{ states.sensor.afvalwijzer_tomorrow_formatted.state }} aan de weg!"
      message: >-
        Vergeet niet om {{ states.sensor.afvalwijzer_tomorrow_formatted.state }}
        aan de weg te zetten. Wordt morgen opgehaald: {{ (as_timestamp(now()) +
        (24*3600)) | timestamp_custom("%d-%m-%Y", True) }}!
      data:
        actions:
          - action: MARK_WASTE_MOVED
            title: Afval verwerkt
            activationMode: background
            authenticationRequired: false
            destructive: true
            behavior: default
        push:
          badge: 5
        action_data:
          entity_id: input_boolean.trash_outside
    action: notify.all_devices
`

Version of afvalwijzer integration having the issue?

2025.01.01

Version of Home Assistant Core having the issue?

2024.12.3

Anything in the logs that might be useful for us?

Additional information

No response

@ViezeVisNL ViezeVisNL added the bug Something isn't working label Jan 20, 2025
@xirixiz
Copy link
Owner

xirixiz commented Jan 20, 2025

Hi, I have it configured as below (via the ui automation). However, did you configure the integration via the UI setup (config_flow) or do you have the afvalwijzer component still configured in configuration.yaml (or in your package file) manually? If manually, please remove and use the UI to configure the component.

  • If you configured it via the UI, by default the waste type "geen" is lowercase, you can modify it during setup
  • What does the state of "sensor.afvalwijzer_tomorrow_formatted" says when a certain trash type is ready to be picked up?
  • Do you receive other notifications from hass?
  • Make sure the sensors are showing correct values, as tomorrow_formatted depends on it.
alias: Afval - Verzend notificatie - Tomorrow
description: ""
triggers:
  - hours: /1
    trigger: time_pattern
conditions:
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.waste_moved
        state: "off"
      - condition: state
        entity_id: input_boolean.waste_reminder
        state: "on"
      - condition: time
        after: "18:00:00"
        before: "23:00:00"
      - condition: template
        value_template: "{{ states('sensor.afvalwijzer_tomorrow_formatted') != 'Geen' }}"
actions:
  - data:
      title: Afval
      message: >-
        Het is vandaag - {{ now().strftime("%d-%m-%Y") }}. Afvaltype(n): {{
        states.sensor.afvalwijzer_tomorrow_formatted.state }} wordt opgehaald
        op: {{ (as_timestamp(now()) + (24*3600)) | timestamp_custom("%d-%m-%Y",
        True) }}!
      data:
        actions:
          - action: MARK_WASTE_MOVED
            title: Afval verwerkt
            activationMode: background
            authenticationRequired: false
            destructive: true
            behavior: default
        push:
          badge: 5
        action_data:
          entity_id: input_boolean.waste_outside
    action: notify.family
mode: single


alias: Afval - Bevestig notificatie
description: ""
triggers:
  - event_type: mobile_app_notification_action
    event_data:
      action: MARK_WASTE_MOVED
    trigger: event
conditions: []
actions:
  - entity_id: input_boolean.waste_moved
    action: input_boolean.turn_on
  - entity_id: input_boolean.waste_outside
    action: input_boolean.turn_on
  - data:
      title: Afval
      message: >-
        Afvaltype(n): {{ states.sensor.afvalwijzer_tomorrow_formatted.state }}
        zijn aan de straat gezet.
      data:
        push:
          badge: 0
    action: notify.family
mode: single

alias: Afval - Herstel notificatie
description: ""
triggers:
  - entity_id: input_boolean.waste_moved
    to: "on"
    for:
      hours: 12
    trigger: state
conditions: []
actions:
  - entity_id: input_boolean.waste_moved
    action: input_boolean.turn_off
  - entity_id: input_boolean.waste_reminder
    action: input_boolean.turn_on
mode: single

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants