Polar plot of the Sun, Moon, a few planets, and the solstices

I wanted a card that shows where the sun is in my location, so I made this. It basically takes the lat/long from Home Assistant and then plots where the sun is right now. It also throws in the moon, Jupiter, Mars, Venus, and Saturn. It also puts dotted lines for the sun path during winter solstice and summer solstice.

It’s super fun. Needs customization and other polish but it’s now meaningfully functional.

6 Likes

As an amateur astronomer I really wanted to install this. But unfortunately I’m pretty sure this command is not available using the Hassio NUC image:

pip3 install skyfield matplotlib numpy

I’m just using a “regular old” virtualenv install of hass and haven’t tried the Hassio image yet. There’s probably a way to install new python dependencies (all those are available on PyPI) so I just have to figure out how hassio deals with dependencies and it will probably work. I’ll start by just defining the requirements/dependencies in a more standard fashion (rather than having the user install them manually and it may work).

The sun just set and I pulled out the binocs and was able to find Saturn and Venus in the sunset just fine thanks to this.

1 Like

I just updated the repo with a manifest.json file that defines the requirements as defined in the docs. I’m not sure if this works for custom components or what but at least it’s a step.

Almost!

https://paste.ubuntu.com/p/r8ZsYSQYYr/

Also I moved the manifest file into the ha_skyfield custom component sub directory, which is where it seems to live in my other custom components.

EDIT: just a suggestion and may not fit with your code but perhaps this would be better as a camera integration rather than a sensor?

1 Like

Thanks! Cool idea, installed, and so far works great. One note, on a rpi4, had a missing requirement for numpy, was unable to find libf77blas.so.3.

sudo apt-get install libatlas-base-dev

And everything is good.

1 Like

Can you make this HACS compliant.
This would be great for my soloar panel tracking.

1 Like

For sure. I haven’t made a HACS thing yet but will figure it out and get it compliant. I also like the suggestion of making it a camera component since it might update faster.

Thanks for the log. I wonder if it’s easy to apt install things like python3-matplotlib and python3-numpy rather than building from source via pip.

I took your suggestion to make it a camera entity just now and updated the repo. It makes a lot more sense. Thanks!

You might want to reach out to pnbruckner on here for how to install the requirements.

I know he used to install numpy back when his Life360 integration was still a custom component. I’m sure he can give you some technical advice.

1 Like

I made some changed to the repo structure to make it HACS compliant with a custom repo but haven’t tried it out yet. If you want to test it out, please let me know if it works.

It adds as a custom repository to HACS and enables you to install the integration. All of this can be done over the web interface.

You’ll have to wait until I can access my configuration.yaml after work to try it out. When I installed manually yesterday it failed to install mattplotlib. I am on docker on amd64 architecture.

I am running hassIO in a VM on an unraid machine.
I could not install pip3 install skyfield matplotlib numpy.
Though I did get the HACS version to install.
Is there an alternative to this type of installation.

Also, and not trying to be picky but in the directions the following line should be

Download the prerequisides:

Download the prerequisites:

Thanks, will await a reply.
carltonb

1 Like

I am using the official home assistant docker images and matplotlib will not install. It appears that the system is trying to compile something with gcc, and that is failing.

I assume that there is not a pre-built wheel file for my architecture, and as gcc does not seem to be present in the home-assistant docker image.

Pity, I’d love to get this to work.

This is great. I will try it when it works with hass.io for sure.

Platform error camera.ha_skyfield - Requirements for ha_skyfield not found: [‘matplotlib==3.1.2’].

Installed through HACS custom repository. Restarted. Added camera config. Restarted. No errors in the log but no camera either.

What are you running on @tom_l

Hassio NUC image.

I also installed through HACS, restarted HA, added the camera and ran the config check - that’s where I got the above error. Also running debian/docker/hassio

Are you seeing anything about matproplib matplotlib in the log?