Comments (7)
It looks like the list is append to itself, hence the double entries in the legend. It was doing the same for me and I had once tripled the listings. My HA is running Debian 11 on an old Dell Latitude E6410.
Looks like adding self._points.clear()
to the def _load_points(self): section of bodies.py did the trick for me. It is basically repopulating the list on each load.
def _load_points(self):
"""Initialize the objects representing the Sun, moon, and planets."""
self._points.clear()
for name, planet_label, color, size in BODIES:
if self._planet_list is not None and name not in self._planet_list:
# planet not requested. skip it.
continue
self._points.append(
Point(name, self._planets[planet_label], color, size, self)
)
from ha_skyfield.
Good find. I can probably also just check to see if there are any points before loading the points to avoid this problem with a bit more performance. I didn't realize that was getting double called sometimes. Thanks.
from ha_skyfield.
I've seen this before, but was unable to replicate today. I've also seen related funny-business when there are multiple tabs showing the skyfield. In 43e73a5 I made a few upgrades that I think should stabilize this. I released it as 1.2
. Can you try it and see if it helps?
from ha_skyfield.
I redownloaded via HACS to wipe my change but still no luck. I needed to add self._points.clear()
back in on the bodies.py.
A thing that happen with v.1.1 and this version is that the initial load on the lovelace tab is correct with one copy of the legend, but after the image reloads, that is when it duplicates. It stays duplicated throughout the entire session. Changing tabs, etc. not "reload". It could also be associated the the camera properties.
Wonder if the speed of the server may make a difference, too.
from ha_skyfield.
Huh! Well I have no idea how those extra points could be added twice. Anyway I guess I'll have to do another version that checks to see if _points is empty before appending more. Did you try that option out by chance? I like it because it should be less overall cpu cycles than clearing and repopulating ever time.
from ha_skyfield.
I did not check if _points were emptied. Not sure the exact syntax with python. Now, with the little bit of reverse engineering, it would be weird if BODIES or _planet_list is being called twice, or maybe it thinks that it is null when the second reload occurs.
Ever since my C++ computer science courses 20 years ago, I still to this day dislike this kind of programming. I prefer servers or networks hands down anyday. I'm 3 months into HA running on Debian 11. A steeper learning curve than I expected with the HA syntax, but I'm loving that I'm using HA now though.
from ha_skyfield.
Ok well I pushed a clear. Hopefully works now as you report.
from ha_skyfield.
Related Issues (16)
- Make HACS compliant HOT 6
- Can't rotate image for my real nort positon.. HOT 5
- Breaks on Home assistant 2022.04 with width issue
- constellation issue : AttributeError: 'Sky' object has no attribute '_constellation_names' HOT 2
- Get planet positions as sensors HOT 3
- Add a option to change interval of image redraw (it's actually10secondes)
- CPU Usage 100% with Home Assistant 2022.10.2
- Option to Flip projection left to right
- Switch from PNG to JPG to conserve bandwidth HOT 2
- High CPU usage HOT 6
- Javascript front end HOT 2
- Documentation
- constellations_list how to? HOT 3
- plz add 'version' to the manifest.json since required by latest HA HOT 1
- UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ha_skyfield.