First time post, trying to look for some help that I can’t find an answer for.
I am trying to setup a template sensor with an attribute from inside the Xbox Live Sensor. The sensor has some attributes that have spaces in them and I can’t figure out how to get their values.
Attributes shown in the developer tools states menu are below:
XboxOne Background: Home
XboxOne Full: Plex
friendly_name: PawnyNZ
icon: mdi:xbox
I can successfully get the friendly name value via:
Awesome!
I can confirm that the below works and realised how great the Dev Template section is for checking. And here I was restarting Home Assistant every time I wanted to change something ><
If anyone is interested for using this for themselves, I ended up with the template sensor setup as the below so that the sensor shows as Offline rather than null/nothing when the Xbox is turned off. Note: replace “pawnynz” with your xbox live ID:
That seems to work fine with strings, unfortunately I have to process a date in such an attribute.
This works fine in template editor, but when I try to put it into a template helper I get “strptime() argument 1 must be str, not TupleWrapper”
It’s always safer to use bracket format and the functions for accessing states and attributes — see here, including the warning at the bottom of the section: