RogerSelwyn / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
195 stars 15 forks source link

Using Attribute State in template sensor (QUESTION) #230

Closed smarthomefamilyverrips closed 4 months ago

smarthomefamilyverrips commented 4 months ago

@RogerSelwyn I want to us a attribute state in a template sensor but now i have the below in attributes

data:

I would like to use the summary state but somehow it seems this is not seen as a attribute, only data i am able to get state off .... you have any idea if i can use the state of summary somehow for a template sensor?

RogerSelwyn commented 4 months ago

The data attribute is an array. Please look at this issue for some details on how to access an array attribute.

https://github.com/RogerSelwyn/O365-HomeAssistant/issues/44

RogerSelwyn commented 4 months ago

Also here https://github.com/RogerSelwyn/O365-HomeAssistant/issues/13#issuecomment-1009095758

smarthomefamilyverrips commented 4 months ago

@RogerSelwyn

this template did do the trick for me to acces the value I needed

{{ state_attr('calendar.cam4_agenda_cam4', 'data')[0].summary }}

Thank you for your help 💯

smarthomefamilyverrips commented 4 months ago

Close as solved! 👍