Send push notification on mobile from calendar


Why this isnt working? The push notification i get has unknown in it instead of summary of the calender event.

Its btw a all day event. I want a trigger when theres a all day event on my phone with the title of it.

Can you post the yaml please?

alias: Kliko notify
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-24:0:0"
    entity_id: calendar.afvalkalender
condition: []
action:
  - device_id: 52a560b4500d72698d3f85531b2075e2
    domain: mobile_app
    type: notify
    message: test send {{ states("calendar.afvalkalender") }}
    title: test
mode: single

AFAIK, device actions don’t accept templates, use a call service action with the proper service for your phone. Also, as shown in the Calendar docs, you should use the trigger variable to extract the calendar event data, not the state() function.

alias: Kliko notify
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-24:0:0"
    entity_id: calendar.afvalkalender
condition: []
action:
  - service: notify.mobile_app_YOUR_PHONE
    data:
      message: test send {{ trigger.calendar_event.summary }}
      title: test
mode: single

EDIT: fixed service data

If i copy paste this one and change service to my phone i get the following error:

Message malformed: extra keys not allowed @ data[‘action’][0][‘message’]

use quotes

alias: Kliko notify
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-24:0:0"
    entity_id: calendar.afvalkalender
condition: []
action:
  - service: notify.mobile_app_s22_sonny
    message: test send "{{ trigger.calendar_event.summary }}"
    title: test
mode: single

Still the same error :confused:


  - service: notify.mobile_app_ios
    data:
      title: "{{ notification_title }}"
      message: "{{ notification_message }}"

my mistake…

oke now no more error:

alias: Kliko notify
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-224:0:0"
    entity_id: calendar.afvalkalender
condition: []
action:
  - service: notify.mobile_app_s22_sonny
    data:
      message: test send "{{ trigger.calendar_event.summary }}"
      title: test
mode: single

But still no message on my phone, when i look into the tracing i see the following:
Error: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘calendar_event’

But you’ll have to check your developertool/state & template editor on how exactly your calendar’s attribute states looks like (as I am using another afval sensor)
image

Ohh now i get a Restafval message.

Im trying to learn and understand HA :wink:

So now im trying to achieve that i get a push message every evening up front at around 19 o clock that i need to put it outside. I guess i can make a time based trigger with this yaml so if theres a event next day i get a trigger.

Thanks btw for the help so far :slight_smile:

I understood that… :thinking:

It is custom that you mark a topic as ‘solved’ when someone enters a solution :wink:

Im still bussy with fixing the last part than i mark it as solved. Cause i cant get it to work :stuck_out_tongue:

And cant find solved button xD

Probably because your post ain’t in any category :wink:

Which afval calendar are you using ??
Is it on HACS ??

Its a local added calendar into my google calendar. So i see the calendar in my HA


So the blue ones are the days that dustbin is collected. And i need the day upfront a notification at 19 o clock :smiley:

Ofc it is possible to use your own calendar (just have to figure out how).

But…wouldn’t it be easier to use an existing solution from HACS?

Lol i will take a look into this thanks!

My place was inside the afvalinfo but too bad they closed the api (RMN) for this use. So i need to stick to google calendar again…