AitorDB / home-assistant-sun-card

Home assistant sun card based on Google weather design
MIT License
409 stars 187 forks source link

Suggestion re: known issue of tomorrow's sunrise #66

Open tomlut opened 3 years ago

tomlut commented 3 years ago

Regarding the known issue of the card displaying the next events rather than the previous, the card could be adapted to use the Sun2 integration that always has these values available.

https://github.com/pnbruckner/ha-sun2

AitorDB commented 3 years ago

Thanks for the suggestion! The issue is that probably not too many people use this integration, so it would force people to install extra things, which is not great imo. I have been considering whether to replace the sun integration with a JS/TS library to fix it and maybe even been able to implement moon functionalities, but I need to check what are the options out there.

kroimon commented 3 years ago

I guess it would be better to improve the sun integration to provide more values. Home Assistant always appreciates pull requests :-)

pabigot commented 3 years ago

@AitorDB Thanks for providing this card.

I have been considering whether to replace the sun integration with a JS/TS library to fix it and maybe even been able to implement moon functionalities, but I need to check what are the options out there.

I would much rather see a solution like that of https://github.com/mishaaq/sun-card where the source of data can be configured by the user, defaulting to the standard sun component but allowing people who use sun2 to leverage it. If this were converted to use an external library the times it calculates may disagree with those of automations that use an HA platform.

Personally I really prefer the way this card displays the information, but the fact it displays tomorrow's dawn (from sun.next_dawn) bothers me.

AitorDB commented 3 years ago

Current changes in dev should help to do that @pabigot but I haven't had time to test that part yet and it probably will need some tweaking, more info here

pabigot commented 3 years ago

@AitorDB I saw some of that. It didn't look trivial to swap in the sun2 component; it provides its values as separate state entities like sensor.sunrise or sensor.elevation, rather than as multiple attributes on a single sun entity. But then I don't read typescript very well, so maybe it's easy to bridge the difference.