diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb4105e..8ab5d7d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+# [0.60.0](https://github.com/mawinkler/astroweather/compare/v0.50.4...v0.60.0) (2024-09-13)
+
+### Changes
+
+- AstroWeather can now analyse the UpTonight report on solar system bodies (planets). This makes it possible to know which planets will be in the sky tonight, when they will be at their maximum elevation and in which direction they can be observed.
+
+### Fixes
+
+- Return ISO format datetime from get_forecasts service. Fixes [Issue 60](https://github.com/mawinkler/astroweather/issues/60).
+
# [0.50.4](https://github.com/mawinkler/astroweather/compare/v0.50.2...v0.50.4) (2024-07-07)
### Changes
diff --git a/README.md b/README.md
index 958185a..813bb43 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# AstroWeather
-![GitHub release](https://img.shields.io/badge/Release-v0.50.4-blue)
+![GitHub release](https://img.shields.io/badge/Release-v0.60.0-blue)
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)
![hacs installs](https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=Installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.astroweather.total)
@@ -24,7 +24,7 @@ Amongst other calculations, the deep sky viewing conditions are calculated out o
>
> [AstroLive](https://github.com/mawinkler/astrolive) - Monitor your observatory from within Home Assistant.
>
-> [UpTonight](https://github.com/mawinkler/uptonight) - Calculate the best astro photography targets for the night at a given location.
+> [UpTonight](https://github.com/mawinkler/uptonight) - Calculate the best astro photography targets (deep sky objects and planets) for the night at a given location.
## Table of Content
@@ -150,7 +150,8 @@ To update the targets on a daily basis I run UpTonight every lunch time via cron
For Home Assistant two files are relevant:
-- `uptonight-report.json` - The calculated targets.
+- `uptonight-report.json` - The calculated deep sky objects.
+- `uptonight-bodies-report.json` - The calculated solar system bodies (planets).
- `uptonight-plot.png` - A plot of the astronomical night.
To embed the list of targets into my Lovelace I use the markdown card:
@@ -160,24 +161,21 @@ type: markdown
content: |-
- UpTonight
+ UpTonight DSO 1-20
- {% if states('sensor.astroweather_backyard_uptonight')|is_number %}
+ {%- if states('sensor.astroweather_backyard_uptonight')|is_number %}
{%- for item in state_attr("sensor.astroweather_backyard_uptonight", "objects") %}
-
- {%- if loop.index <= 20 %}
- {%- set astrobin = item.name |
- regex_replace('^.*\((.*)\,.*\,.*$', '\\1') |
- regex_replace('\s', '+') %}
- {{ loop.index }}. {{ item.name }},
- {{ item.type }} in {{ item.constellation }}
- {% endif %}
- {% endfor %}
- {% else %}
+ {%- if loop.index <= 20 %}
+
+ {%- set astrobin = item.name | regex_replace('^.*\((.*)\,.*\,.*$', '\\1') | regex_replace('\s', '+') %}
+ {{ loop.index }}. {{ item.name }}, {{ item.type }} in {{ item.constellation }}
+ {%- endif %}
+ {%- endfor %}
+ {%- else %}
Waiting for AstroWeather
- {% endif %}
+ {%- endif %}
```
@@ -185,6 +183,30 @@ The resulting list is sorted top down according to the fraction of time obeserva
![alt text](images/lovelace-uptonight-02.png "Uptonight")
+If you're interested in our solar system bodies you can list them similarily:
+
+```yaml
+type: markdown
+content: |-
+
+
+ UpTonight Bodies
+
+
+
+ {%- if states('sensor.astroweather_backyard_uptonight')|is_number %}
+ {%- for item in state_attr("sensor.astroweather_backyard_uptonight", "bodies") %}
+ {%- if loop.index <= 20 %}
+
+ {{ loop.index }}. {{ item.name }}, Altitude: {{ item.max_altitude | round}}°, Azimuth {{ item.azimuth | round }}° at {{ item.max_altitude_time | as_local | as_timestamp | timestamp_custom('%H:%M') }}
+ {%- endif %}
+ {%- endfor %}
+ {%- else %}
+ Waiting for AstroWeather
+ {%- endif %}
+
+```
+
For the plot, a picture-entity card showing a template image does the trick for me. I'm using [browser_mod](https://github.com/thomasloven/hass-browser_mod) from @thomasloven for the tap_action to get a zoomed view.
Template Image:
diff --git a/custom_components/astroweather/manifest.json b/custom_components/astroweather/manifest.json
index 4ff225a..7050b46 100644
--- a/custom_components/astroweather/manifest.json
+++ b/custom_components/astroweather/manifest.json
@@ -10,7 +10,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/mawinkler/astroweather/issues",
"requirements": [
- "pyastroweatherio==0.50.4"
+ "pyastroweatherio==0.60.3"
],
- "version": "0.50.4"
+ "version": "0.60.0"
}
diff --git a/custom_components/astroweather/sensor.py b/custom_components/astroweather/sensor.py
index cfe9e62..e2d0290 100644
--- a/custom_components/astroweather/sensor.py
+++ b/custom_components/astroweather/sensor.py
@@ -499,17 +499,31 @@ def extra_state_attributes(self) -> {}:
if (
self._sensor == UPTONIGHT
- and self.coordinator.data[SENSOR_NAME].uptonight is not None
):
dso_list = []
- for dso in self.coordinator.data[SENSOR_NAME].uptonight_list:
- obj = {
- "name": dso.target_name,
- "type": dso.type,
- "constellation": dso.constellation,
- "foto": dso.foto,
- }
- dso_list.append(obj)
- # dso_list.insert(0, obj)
- return {"objects": dso_list}
+ if self.coordinator.data[SENSOR_NAME].uptonight is not None:
+ for dso in self.coordinator.data[SENSOR_NAME].uptonight_list:
+ obj = {
+ "name": dso.target_name,
+ "type": dso.type,
+ "constellation": dso.constellation,
+ "foto": dso.foto,
+ }
+ dso_list.append(obj)
+
+ bodies_list = []
+ if self.coordinator.data[SENSOR_NAME].uptonight_bodies is not None:
+ for body in self.coordinator.data[SENSOR_NAME].uptonight_bodies_list:
+ obj = {
+ "name": body.target_name,
+ "max_altitude": body.max_altitude,
+ "azimuth": body.azimuth,
+ "max_altitude_time": body.max_altitude_time,
+ "foto": body.foto,
+ }
+ bodies_list.append(obj)
+
+ return {"objects": dso_list,
+ "bodies": bodies_list}
+
return None