Skip to content

Commit

Permalink
0.60.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinkler committed Sep 13, 2024
1 parent 4613072 commit b507e75
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 29 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AstroWeather<!-- omit in toc -->

![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)

Expand All @@ -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<!-- omit in toc -->

Expand Down Expand Up @@ -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:
Expand All @@ -160,31 +161,52 @@ type: markdown
content: |-
<h2>
<ha-icon icon='mdi:creation-outline'></ha-icon>
UpTonight
UpTonight DSO 1-20
</h2>
<hr>
{% 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") %}
<table><tr>
{%- if loop.index <= 20 %}
{%- set astrobin = item.name |
regex_replace('^.*\((.*)\,.*\,.*$', '\\1') |
regex_replace('\s', '+') %}
{{ loop.index }}. <a href="https://astrobin.com/search/?q={{ astrobin }}">{{ item.name }}</a>,
{{ item.type }} in {{ item.constellation }}
{% endif %}
{% endfor %}
{% else %}
{%- if loop.index <= 20 %}
<table><tr>
{%- set astrobin = item.name | regex_replace('^.*\((.*)\,.*\,.*$', '\\1') | regex_replace('\s', '+') %}
{{ loop.index }}. <a href="https://astrobin.com/search/?q={{ astrobin }}">{{ item.name }}</a>, {{ item.type }} in {{ item.constellation }}
{%- endif %}
{%- endfor %}
{%- else %}
Waiting for AstroWeather
{% endif %}
{%- endif %}
</tr></table>
```
The resulting list is sorted top down according to the fraction of time obeservable during astronomical darkness. It shows only the top 20 targets including [AstroBin](https://www.astrobin.com/) search links.
![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: |-
<h2>
<ha-icon icon='mdi:creation-outline'></ha-icon>
UpTonight Bodies
</h2>
<hr>
{%- if states('sensor.astroweather_backyard_uptonight')|is_number %}
{%- for item in state_attr("sensor.astroweather_backyard_uptonight", "bodies") %}
{%- if loop.index <= 20 %}
<table><tr>
{{ 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 %}
</tr></table>
```
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:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/astroweather/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
36 changes: 25 additions & 11 deletions custom_components/astroweather/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b507e75

Please sign in to comment.