Hello,
I’m trying to build off the snippet from Allen Porter, but running into a snag. I get the following two errors in my logs, and my sensors show nothing, or “unknown”.
log errors
Logger: homeassistant.components.sensor.helpers
Source: components/sensor/helpers.py:23
integration: Sensor (documentation, issues)
First occurred: 22:41:47 (1 occurrences)
Last logged: 22:41:47
sensor.next_location_start rendered invalid timestamp:
Logger: homeassistant.helpers.template
Source: helpers/template.py:2748
First occurred: 22:41:47 (3 occurrences)
Last logged: 22:41:48
Template variable warning: 'dict object' has no attribute 'events' when rendering '{{ agenda.events | rejectattr('location', 'undefined') | list }}'
Template variable warning: 'schedule_set' is undefined when rendering '{{ schedule_set }}'
Problem Info
I did make two changes to the sensor;
- service > action
- calendar.list_events > calendar.get_events
Anyone still using this successfully and willing to takes peak? Thanks!
- trigger:
- platform: homeassistant
event: start
- platform: time_pattern
hours: "/6"
action:
- action: calendar.get_events
target:
entity_id: calendar.s_schedule
data:
duration:
hours: 168
minutes: 0
seconds: 0
response_variable: agenda
- alias: Find upcoming events with locations
variables:
upcoming: "{{ agenda.events | rejectattr('location', 'undefined') | list }}"
sensor:
- name: "Next Location"
state: >
{% if upcoming|length > 0 %}
{{ upcoming[0].location }}
{% endif %}
- name: "Next Location Summary"
state: >
{% if upcoming|length > 0 %}
{{ upcoming[0].summary }}
{% endif %}
- name: "Next Location Start"
state: >
{% if upcoming|length > 0 %}
{{ upcoming[0].start }}
{% endif %}
device_class: timestamp
- trigger:
platform: event
event_type: tasker_event
sensor:
- name: Tasker State
state: "{{trigger.event.data.state}}"
Solution:
variables:
upcoming: "{{ agenda['calendar.schedule']['events'] | rejectattr('location', 'undefined') | list }}"
Per