Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106727

Help needed with calendar.create event

$
0
0

hi team!

I’m trying to build a little system that would create an event in the calendar, however I can’t seem to parse date correctly. Can someone spot where the issue lies??

This is my automation:

alias: Handle Time Off Approval
description: ""
triggers:
  - event_type: mobile_app_notification_action
    event_data:
      action: APPROVE_TIME_OFF
    trigger: event
actions:
  - variables:
      balance: "{{ states('input_number.remaining_balance') | float }}"
      start: "{{ states('input_datetime.start_date') | as_datetime }}"
      end: "{{ states('input_datetime.end_date') | as_datetime }}"
      duration: "{{ states('input_number.last_time_off_duration') | float }}"
      new_balance: "{{ balance - duration }}"
  - target:
      entity_id: input_number.remaining_balance
    data:
      value: "{{ new_balance }}"
    action: input_number.set_value
  - data:
      title: Time Off Approved
      message: "✅ Request approved. Remaining balance: {{ new_balance }} days"
    action: notify.mobile_app_asus_i005da
  - action: calendar.create_event
    metadata: {}
    data:
      start_date: "{{ start.strftime('%Y-%m-%d') }}"
      end_date: "{{ (end + timedelta(days=1)).strftime('%Y-%m-%d') }}"
      summary: Aupair - Time Off
    target:
      entity_id:
        - calendar.olamike
        - calendar.gezin
mode: single

And this is the error I am receiving:
Error: Error rendering data template: UndefinedError: ‘str object’ has no attribute ‘strftime’

It shows up on the last step of the automation, so it’s tied to the calendar event.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106727

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>