Somehow it seems to endup with mdi:xbox-controller while Netflix is on… Can’t see whats wrong, eyes wide shut apparently. Im struggling with the bit between [ ] because when i put [“XboxOne Full”] the template complains about : Error rendering template: TemplateSyntaxError: expected token ',', got 'XboxOne'
Wouldn’t know how to do it otherwise and it does work when use like this:
The reason the " is failing is because your is_state(" section starts with a " and you are closing out the string. You could excape the " with \ or you could use ' to create different strings. With '' I’m not really sure what you are causing to happen because it looks like 2 empty strings with random chacaters in the middle that the template should be complaining about.
Also, is_state checks the state of an entity, and you are attempting to point it to an attribute. You want to use is_state_attr('sensor.gamertag', 'XboxOne Full', 'Netflix')
(test it out in the developer tools section in the GUI, it’ll save you a lot of time).
thanks!!
i was already testing in the dev tools, but didnt know about the is_state_attr, and was testing only between the [" "] because of the space between XboxOne and Full.
tried with and without quotes around green, no change though. any thoughts here too please? maybe theme_template. Think it tried that already, no such luck.
FYI, you don’t need quotes around the template if you use the > to indicate a multiline template. You probably don’t need/want the ' around green and default.
Your templates look fine to me. If they work the the developer tool section and return the results you expect, then odds are you have a syntax problem with whatever your component is. I’m not familiar with any template->theme or template->rgb_color fields, what component are you using?
So, then it isn’t a templating problem,but a problem of getting the right data to the component. You didn’t say which component you are trying to configure. I don’t recognize it, so its making me think you are using the custom front end, which I’m not familiar with.
You can do {{'green' if is_state('domain.my_device', 'state') else 'red'}}
I don’t know, I’ve never tried. I’m guessing it’ll work because the YAML parser should interpret the !secret prior to the jinja engine parsing the template.
accidentally i posted an answer in the wrong thread, here’s the link:
not so promising after all. seems to not cause any errors, but always end with the latest ‘else’… because the {{gamertag}} wasn’t read apparently. Back to original for now.