scw2wi
(Walter Schlögl)
November 17, 2025, 4:57pm
1
Since I’ve seen this great card here I’m trying to create the same for my dashboard.
For the card I would need the constellation data (azimuth & elevation) of all visible planets.
For the sun I can get the data via state_attr(‘sun.sun’, ‘azimuth’) and state_attr(‘sun.sun’, ‘elevation’).
For the moon I can get the same via Lunar Phase (or via Moon Astro ).
For planets I found ha_skyfield which is only for displaying the planets, not for providing raw-data.
My question is now, how I get the planet information into an HA-sensor?
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
November 17, 2025, 5:00pm
2
Search here is a wonderful tool.
I want to create a template sensor that has a state and has its own sensor attributes. I would like to get some help.
Futhermore: The sensor and its attributes should have no values at Home Assistant reboot / restart.
I have a templates.yaml that holds a lot of working template sensors.
So far I have come up with this code in my templates.yaml:
- sensor:
name: Laatste Deconz Tijden
icon: mdi:weather-sunny
state: none
attribute_templates:
nadir: none
night_en…
scw2wi
(Walter Schlögl)
November 17, 2025, 5:11pm
3
I’m not sure how this could solve my issue.
Here is the template sensor code I’m using for the sun.
- sensor:
- name: "Sun Azimuth"
unique_id: 8eb9eec1-409c-447e-ad60-aeb3d6d043d4
icon: mdi:sun-compass
unit_of_measurement: "°"
state_class: measurement
state: "{{ state_attr('sun.sun', 'azimuth') }}"
- sensor:
- name: "Sun Elevation"
unique_id: cb321e75-73e1-45a3-84f2-d3306bb579f4
icon: mdi:sun-angle
unit_of_measurement: "°"
state_class: measurement
state: "{{ state_attr('sun.sun', 'elevation') }}"
It’s working fine, but for creating such a template sensor also for planet data, I would need the planet data first.
k8gg
November 17, 2025, 5:17pm
4
I could not help on the planet data feeds, but am curious: What kind of automation would you need the planet data for?
scw2wi
(Walter Schlögl)
November 17, 2025, 5:24pm
5
It’s not an automation, it’s a very nice card showing the movement of sun & moon and the positions of the planets.
I am using this one in combination with compass-card: Astronomy API - Free To Use, Astronomy API For Developers
this is the sensor from which I can use it in the card…with jq one can bend/squeeze/fold more if/where needed of course
command_line:
- sensor:
name: Planetary Positions
command: >
curl -X GET 'https://api.astronomyapi.com/api/v2/bodies/positions?longitude=YOURLON&latitude=YOURLAT&elevation=50&from_date={{ now().date() }}&to_date={{ now().date() }}&time={{ now().strftime('%H:%M:%m') }}' -H 'Authorization: Basic YOURAPIKEY' | jq '{"planets": .[].table.rows}'
value_template: "{{ now() }}"
json_attributes:
- planets
scan_interval: 600
1 Like
IOT7712
November 18, 2025, 4:08am
8
At the risk of being shouted down here, I find the separate app Heavens Above is up to date, knows my current orientation in all four dimensions, and even has night mode and search abilities for when I actually venture outside to see a new passing comet. Highly recommended.
Now back to trying to squeeze all the stars into your display, and have it update in real time, and add random star music in the background…
You want it for when? Yesterday, tomorrow? 2038? Music too?
A beautiful sympathy for you if you missed out on the lovely aurora display the other evening. [Not my video - done in 2018 - click through for the back story - actually time lapse, not direct video]
I have seen a most wonderful aurora display around 30 years ago in unexpected latitudes that reminds me of this. Enjoy the beautifully haunting music too.
athua
(Gus)
November 18, 2025, 5:35am
9
For Sun and Moon data, you can that from the following integration:
Asynchronous Astro Weather Forecast for Home Assistant
And from the same author, there is the UpTonight scripts to get the planet data but it looks a little more involved to get setup.
scw2wi
(Walter Schlögl)
November 22, 2025, 9:43am
10
Thanks a lot for this command_line sensor, this was exactly the solution I was searching for - and it’s already working.