Pulling Google Calendar Message details

I’m looking for a way to pull out a specific piece of information from an entity.

The entity is calendar.kids_location
This entity contains the following information:

message: School
all day: false
offset reached: false
start time: 2019-09-12 09:00:00
end time: 2019-09-12 15:00:00
location: School

I would like to pull out the value assigned to message but I am not sure how to do this.

I tried creating a sensor with this bit in sensors.yaml:

  - platform: template
        value_template: "{{ value_json.message }}"
        friendly_name: "Kids_Location"

The sensor is created but the state is unknown

your value template does not reference any sensor/calendar, so it’s not surprising it doesn’t return anything.
You need to reference your calendar, something like:

value_template: "{{state_attr('calendar.INSERT_CALENDAR_NAME_HERE', 'message')}}"

You may also want to list the calendar as the entity to monitor, so add a line to your template sensor:

entity_id: calendar.INSERT_CALENDAR_NAME_HERE
1 Like

@lolouk44 Thank you! Worked like a charm

1 Like

Thanks. Feel free to mark it as a solution so others can easily find it if they have a similar issue.