This is resolved on the front-end, yes and you’re already partially doing it by using the domainIcon function. The issue is that domainIcon is called by a higher-level function stateIcon to determine the icon used.
I think you just need to update your code to use the stateIcon function. We can add that to custom-card-helpers.
I came here to look for how to do almost exactly this. <3
Now I can skip a lot of template sensors to make the gui show device trackers for stuff at home (cameras, computers etc) and just remake the home and not_home states to show Offline or Online.
I made a custom field to show instead of regular state and added this code:
been seeing this for a while, but because of some dark background on my buttons, didn’t really see the issue.
disabled the color, and then see it more clearly: on my iPhone, doing a more-info on hold action on buttons near the rightsize of the screen results in odd behavior, described best as the full screen pulling back (a bit like a tsunami) and quickly restoring to the front again.
This seems to have to do with the grey circle (which appears when holding) touching the right side (scrollbar)
I must touch the buttons most left side, so this circle doesn’t touch the scrollbar and then things are alright.
Doesnt happen in a desktop browser as far as I can see
Also when it doesn’t work, usually it’s because your javascript is wrong, you can check the javascript console of your browser to understand what is happening, it will give you some hints
Thanks for posting this, I’m hoping it will solve an issue I’m having trying to create a button to unlock my front door that shows the state as ‘Locked/Unlocked’.
This is the code I have so far but the button doesn’t show in lovelace with the ‘custom_fields’ code, if I remove that code it shows and works fine.
Could you please assist me to see what I have wrong?
Here you have it: https://pastebin.com/mcmRKAuh
I utilize lovelace_gen too, but it should be rather obvious what’s what. I think you might be missing grid for example.
Thanks very much @teachingbirds I have the state working now, the grid info will help to sort out the placement of the fields which is a bit all over the place.
can we style (the color of) the more-info circle somehow? I have several buttons with a background color which makes it almost imposible to see the circle popup, as I now discover. Had thought it simply didnt work at all, but now I have a better display, I see the circle very faintly ;-)…
would be cool if we could set the color of the circle, but I wouldn’t know which item to try.