partofthething / ha_skyfield Goto Github PK
View Code? Open in Web Editor NEWSee the apparent positions of the Sun, Moon, and planets in this home assistant custom component
License: GNU General Public License v3.0
See the apparent positions of the Sun, Moon, and planets in this home assistant custom component
License: GNU General Public License v3.0
For this project, using PNG doesn't provide valuable visual benefit over a more highly compressed format like JPG.
The bandwidth savings is especially important for remote observatories with limited connectivity options.
-rw-r--r-- 1 root root 47K Jan 19 16:59 skyfield.jpg
-rw-r--r-- 1 root root 111K Jan 19 17:03 skyfield.png
Additionally, jpg
compression is generally easier to perform on low power systems like the single board, ARM computers.
I got a report from a user with this traceback:
Logger: aiohttp.server
Source: components/camera/__init__.py:569
First occurred: April 25, 2022, 15:42:00 (113 occurrences)
Last logged: 20:17:32
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 724, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 742, in handle
image = await _async_get_image(
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 163, in _async_get_image
if image_bytes := await camera.async_camera_image(
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 569, in async_camera_image
return await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
TypeError: camera_image() got an unexpected keyword argument 'width'
System Info:
System Health
version: core-2022.4.7
installation_type: Home Assistant OS
dev: false
hassio: true
docker: true
user: root
virtualenv: false
python_version: 3.9.9
os_name: Linux
os_version: 5.10.103-v8
arch: aarch64
timezone: America/Detroit
This is great, just works out of the box. Thank you.
So that dopes like me can add it easily it I leave this note for future visitors: where it says "just add a gui picture", all that means is you add an entity in lovelace and in code view paste the following.
type: picture-entity
entity: camera.skyfield
camera_view: live
In terms of customisation I tried changing to north_up=True in bodies.py but that didn't work so I just hard coded it in camera.py under def setup_platform. (I could comment out planets my eyes can't see in bodies.py though, which may help on the processing load.)
I will watch with eagerness for a fix to the refresh rate so that the burden on the rpi is less.
Thank you again. A really excellent and welcome contribution.
at the moment HA throws a warning, in the future it might not load one the best extensions.
Awesome plugin to HA for us space junkies....
Is there a dark mode picture that can be used for this?
Suggest changing:
ax.set_theta_direction(-1)
to
ax.set_theta_direction(1)
On line 170 in bodies.py
This is a nice one no question.
Since show_constellations: true resulted in heavy load I wanted to see how it might perform if only usra major being allowed as the one and only constellation. I would have continued evaluating if then adding ursa major would work aswell. Since 2-3 constellations surely make it somewhat easier to help around getting the correct location of a planet.
But I didn't manage to get it going. Any configuration help on constallations_list?
TIA
I'm not able to use constellation
I set this configuration :
camera:
platform: ha_skyfield
show_constellations: true
constellations_list:
- UrsaMajor
- Andromeda
- Aquarius
- Aquila
- Ara
- Aries
- Auriga
- Cancer
- Capricornus
- Carina
- Cassiopeia
- Centaurus
- Circinus
- Cygnus
- Lynx
- Lyra
- Orion
- Pegasus
- Sagitta
- Sagittarius
- Scorpius
- Taurus
- Vela
- Virgo
it's display moon and other Planets but it's not displaying any constellation
after putting the extension in debug mode, i saw this crash :
mai 17 11:59:57 rasp hass[14720]: 2022-05-17 11:59:57 ERROR (MainThread) [aiohttp.server] Error handling request
mai 17 11:59:57 rasp hass[14720]: Traceback (most recent call last):
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
mai 17 11:59:57 rasp hass[14720]: resp = await request_handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
mai 17 11:59:57 rasp hass[14720]: resp = await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
mai 17 11:59:57 rasp hass[14720]: return await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
mai 17 11:59:57 rasp hass[14720]: return await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 222, in forwarded_middleware
mai 17 11:59:57 rasp hass[14720]: return await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
mai 17 11:59:57 rasp hass[14720]: return await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/auth.py", line 219, in auth_middleware
mai 17 11:59:57 rasp hass[14720]: return await handler(request)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/view.py", line 137, in handle
mai 17 11:59:57 rasp hass[14720]: result = await result
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 736, in get
mai 17 11:59:57 rasp hass[14720]: return await self.handle(request, camera)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 754, in handle
mai 17 11:59:57 rasp hass[14720]: image = await _async_get_image(
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 174, in _async_get_image
mai 17 11:59:57 rasp hass[14720]: if image_bytes := await camera.async_camera_image(
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 581, in async_camera_image
mai 17 11:59:57 rasp hass[14720]: return await self.hass.async_add_executor_job(
mai 17 11:59:57 rasp hass[14720]: File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
mai 17 11:59:57 rasp hass[14720]: result = self.fn(*self.args, **self.kwargs)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/.homeassistant/custom_components/ha_skyfield/camera.py", line 145, in camera_image
mai 17 11:59:57 rasp hass[14720]: self.sky.load(self._tmpdir)
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/.homeassistant/custom_components/ha_skyfield/bodies.py", line 75, in load
mai 17 11:59:57 rasp hass[14720]: self._run_initial_computations()
mai 17 11:59:57 rasp hass[14720]: File "/data/homeassistant/.homeassistant/custom_components/ha_skyfield/bodies.py", line 94, in _run_initial_computations
mai 17 11:59:57 rasp hass[14720]: self, self._constellation_names
mai 17 11:59:57 rasp hass[14720]: AttributeError: 'Sky' object has no attribute '_constellation_names'
It's running on a Rasberry Pi 4 on Debian 10 armv7l
Started getting this error after upgrading to home assistant 2021.06
/home/homeassistant/.homeassistant/custom_components/ha_skyfield/bodies.py:152: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
and the component is broken. will need to look into.
Right now, the system uses matplotlib on the backend to make PNG images to be shown in the browser. This has some disadvantages in backend speed and theme matching.
A version of this with a javascript front-end might be really awesome.
Since this integration is already calculating the positions of the planets, it would be nice to have it provide sensors for the:
of each planet, dwarf planet, the sun, and the moon.
An example would be something like this: https://www.timeanddate.com/astronomy/night/usa/new-york
Actually, the image is redraw every 10secondes.
It's should be good if it's exist a option to increase the delay between refresh.
Originally posted by @roumano in #4 (comment)
This component uses a LOT of CPU, especially when running with constellations (but even without). In profiling, we can see that the python-skyfield library computing positions is a lot of work. Here is the profiler trace with constellations:
We could alternatively make a sun-only mode that uses the alternative library pysolar which would likely be much faster.
The picture element does nog loaf anymore and shows: Entity not available: camera.skyfield
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.