added a little bonus
assuming you have custom-ui installed? be sure to check the quotes are true single quotes, the forum software sometimes makes these funny curly quotes here. And, be sure to check the state (āonlineā seems unlikely) is the real state. case-sensitive.
Thanks for the help guys I will give this a try, also now that you mention custom-ui, I think I am going to āre-installā that also. Will let you guys know what happens.
@Mariusthvdb - you are correct the state āonlineā is a custom config, what I did was use nmap device tracker which as you know returns home or not_home, but I was not happy with those states. so i created template sensors instead as below:
ok, thats what I suspected. I that case, ditch the icon template I added, cause that wont work with template sensors, since they have their own icon_template as you already use.
the icon_color should be good then.
orā¦
you could do away with the template sensor, and use my above customization on the device_tracker, and add:
device_tracker.googlewifi_upstairs:
show_last_changed: true
templates:
icon: >
if (state === 'home') return 'mdi:wifi';
return 'mdi:wifi-off';
icon_color: >
if (state === 'home') return 'green';
return 'red'; #or use 'grey' which is better on the eye unless u really want an alert...
_stateDisplay: >
if (state === 'home') return 'online';
return 'offline';
@Mariusthvdb - Thanks for the config examples I have not seen _stateDisplay for the device tracker, where can I find out more on those kind of configs? Double checked the HA page on device tracker and it doesnāt mention that, probably because its under an advanced page somewhere.
OK so its working again, turns out its not a config issue but a browser issue, came across a post with custom ui issues and HA 0.7+, honestly didnāt think to look for custom ui posts around this issue. Anyway turns out I just needed to flush my browser cache, in chrome specifically I just flushed ācached images and filesā and everything came back.
Sorry wasting your time with config help, but I did learn new things, thanks so much for the help guys @petro and @Mariusthvdb , very much appreciated.
well, its a first for me, I never new template sensors could have their icon_color set through customize like this, native HA, without custom-ui installed Itās undocumentedā¦
strangest thing is he uses the custom-ui format of
templates:
icon_color:
without having custom-ui installed. So I am a bit baffledā¦
Yes I know.
The Jinja was from a template sensor , and because I needed the same logic now in another sensor, needed to use the custom-ui, that uses JavaScriptā¦
icon_color isnāt a valid entry for a template sensor. Not sure where you got this idea from. Everything in this thread is for custom_ui and it goes in the customize section. Always consult the documents. If the documents do not contain a entry/field, then you canāt use that entry/field.
@Mariusthvdbās post has the documents for custom ui