so I reconfigured 2 semi bare systems, and have moon and sun setup on both, without any customization whatsoever.
they show like:
so both states are alright, and the more info shows that. But both icons are way off… Sun shows a moon sensor, and the moon shows the incorrect one, at least if the change to have the moon show according to the state has been implemented yet (not really sure, but the pr was merged I think).
What could be going on here? Lets focus on the sun, which is most off
Hmm - strange. Just tried this and can confirm that the sun sensor uses the right icon… until you configure the moon sensor in HA! That’s when things get messy and it no longer uses the right icon, as far as I can tell.
I think (I will test again) that even with the moon sensor added to configuration.yaml - the sun showed the correct icon in Lovelace, until I added the Moon badge to Lovelace. Even after then removing it from lovelace, the sun shows the moon icon.
I have now removed the moon from my configuration.yaml - the moon.moon entity no longer exists. However, Lovelace has now replaced the sun icon by the moon icon, and it seems stuck.
Looks like a bug to me.
With regards the moon badge, it shows text. If you want to show an icon to represent the moon state, have a look here.
guess we have a bug here…sun showing moon is silly, especially while the more info is correct.
and yes, I am aware of the moon sensor, Ive contributed to a few other threads on the subject no issues there.
Also, thats not the issue here. Right now I am experiencing the out of the box error, of a uncustomized HA instance showing the incorrect icon in the frontend.
ha look what we have here:
feel almost embarrassed to ask, but is it so the sun iteration only shows the sun icon when above horizon, and shows the moon icon (mdi:brightness-3
) when below horizon? Must confess I hadn’t realized that in almost 3 years HA use…
Cant find the reference to an icon in the code https://github.com/home-assistant/home-assistant/blob/d5419b77f9c245e5af006143eb55ae4dda3f174e/homeassistant/components/sun/init.py
but this would certainly hint to that, will of course check later today…
but, even if so, showing a moon icon on the sun integration is confusing …
Agreed. When I read your post and tested, I was doing so at about the time the sun sets. SO my first test showed the sun, after configuring the moon sensor, I got the moon showing, and could not get the sun back (yesterday). I did wonder about your supposition regarding the moon icon after sunset, but that is the behaviour I am seeing also. Well spotted.
yep, I had completely forgotten that on my main system I’ve been using this customization for ages:
if (state =='above_horizon') return 'mdi:weather-sunny';
Which of course also is a Moon, but once accustomed to that, one doesnt see it anymore.
since I wanted to have 2 new bare installs, I have no customizations loaded, and the moon shows on the sun
only other option are the sunset icons, but, those illustrate the event of sunset/sunrise to me, rather than the sun being down… all a matter of taste perhaps