Calendar Entry Prompt Notification

Hi, I’d like to automate a journal with the new calendar.create_event service.
Everyday at fixed times, e.g. 7am and 7pm an automation shall send me a notificaation to my phone that has an empty input field. whatever I type there will be saved to my calendar with the current time stamp.
Is that possible? Update: If the free text input is not possible, how about an actionable notification with three smiley buttons: :slight_smile: :confused: :frowning:

I put this together a few days ago for another user on the FB group… I have no idea what the character limit for actionable replies is, so it might not be fit for your purpose. The other user needed it to keep a very simple note related to his child’s egg allergy.

alias: ztest Actionable Reply
description: save reply from actionable notification to a helper
trigger:
  - platform: time
    at: "09:00:00"
condition: null
action:
  - alias: Ask for Reply
    service: notify.mobile_app
    data:
      message: Reply with words
      data:
        actions:
          - action: REPLY
            title: Reply
  - alias: Wait for a response
    timeout: "00:05:00"
    wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: REPLY 
  - alias: Perform the action
    choose:
      - conditions:
          - condition: template
            value_template: "{{ wait.trigger.event.data.action == 'REPLY' }}"
        sequence:
          - service: calendar.create_event
            data:
              summary: "{{ wait.trigger.event.data.reply_text }}"
              description: ""
              start_date_time: "{{ now()}}"
              end_date_time: "{{now()}}"
            target:
              entity_id: calendar.YOUR_CALENDAR
          - delay: 90
          - service: notify.mobile_app
            data:
              message: clear_notification
    default:
      - service: calendar.create_event
        data:
          summary: "NO RESPONSE FROM NOTIFICATION"
          description: ""
          start_date_time: "{{ now()}}"
          end_date_time: "{{now()}}"
        target:
          entity_id: calendar.YOUR_CALENDAR
      - delay: 5    
      - service: notify.mobile_app
        data:
          message: clear_notification
mode: single
2 Likes

Nice job! I changed the sservice from notify.mobile_app to notify.notify and entered my calendar.ID, but while the notification and input field appear on my phone, the entries are not yet written back into the calendar. But it’s already a good start, I’ll try to somehow map it onto three buttons to make input even easier

Just a note… there seems to be an issue with how the calendar.create_event service is handling the basic {{ now() }} template. The following work around using string slicing is working for me:

sequence:
  - service: calendar.create_event
    data:
      summary: "{{ wait.trigger.event.data.reply_text }}"
      description: ""
      start_date_time: "{{(now() | string | replace(' ','T'))[:-13] }}"
      end_date_time: "{{(now() | string | replace(' ','T'))[:-13] }}"

If you are interested, you can shrink the template to this:

{{ now().isoformat()[:19] }}

Example

2 Likes