Google calendar integration basics issue

I have my google calendars talking to my HA so I do get an entity showing each calendar with the current or next event showing in the attributes. They look like this:

message: DeNessa
all_day: false
offset_reached: false
start_time: 2018-10-24 15:00:00
end_time: 2018-10-27 11:00:00
location: 2101
friendly_name: 2101

However, when I try setting up a sensor to extract the attributes, i.e.

- platform: template
      value_template: "{{ states.calendar.2101.attributes.message }}"
      friendly_name: "Next Event"

I always get a state of “unknown” in the entity “sensor.event_title”.
What am I missing here?

your entity is numeric so you need to enclose it in brackets states.calendar.['2101'].attributes.message
check the 2nd notes section on the templating page:

If your template uses an entity_id that begins with a number (example: states.device_tracker.2008_gmc ) you must use a bracket syntax to avoid errors caused by rendering the entity_id improperly. In the example given, the correct syntax for the device tracker would be: states.device_tracker['2008_gmc']

1 Like

That did it! Like most things in life, it’s the little stuff that gets ya.
Thank you very much!

1 Like