{"id":23151919,"url":"https://github.com/mawinkler/astroweather","last_synced_at":"2025-04-06T08:14:23.972Z","repository":{"id":43845171,"uuid":"334076222","full_name":"mawinkler/astroweather","owner":"mawinkler","description":"Asynchronous Astro Weather Forecast for Home Assistant","archived":false,"fork":false,"pushed_at":"2024-11-20T07:29:05.000Z","size":4709,"stargazers_count":90,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-30T07:08:47.349Z","etag":null,"topics":["7timer","astronomy","forecast","homeassistant","homeassistant-integration"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mawinkler.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-29T08:00:36.000Z","updated_at":"2025-02-22T01:47:12.000Z","dependencies_parsed_at":"2023-10-03T14:52:13.171Z","dependency_job_id":"b7953f8f-6a99-4581-ab2c-40b4ebbd148b","html_url":"https://github.com/mawinkler/astroweather","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawinkler%2Fastroweather","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawinkler%2Fastroweather/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawinkler%2Fastroweather/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawinkler%2Fastroweather/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mawinkler","download_url":"https://codeload.github.com/mawinkler/astroweather/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451665,"owners_count":20940944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["7timer","astronomy","forecast","homeassistant","homeassistant-integration"],"created_at":"2024-12-17T19:08:10.800Z","updated_at":"2025-04-06T08:14:23.950Z","avatar_url":"https://github.com/mawinkler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AstroWeather\u003c!-- omit in toc --\u003e\n\n![GitHub release](https://img.shields.io/badge/Release-v0.72.0-blue)\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)\n![hacs installs](https://img.shields.io/badge/dynamic/json?color=41BDF5\u0026logo=home-assistant\u0026label=Installs\u0026cacheSeconds=15600\u0026url=https://analytics.home-assistant.io/custom_integrations.json\u0026query=$.astroweather.total)\n\nThis is a *Custom Integration* for [Home Assistant](https://www.home-assistant.io/) 2023.9+. It uses the forecast data from [Met.no](https://api.met.no/weatherapi/locationforecast/2.0/documentation) and optionally [Open-Meteo](https://open-meteo.com/en/docs) and [7Timer!](http://www.7timer.info/doc.php?lang=en#machine_readable_api) to generate sensor data for an astronomical condiditions forecast in Home Assistant.\n\n![alt text](images/lovelace.png \"Live\")\n\nThere is currently support for the following entity types within Home Assistant:\n\n* Sensor\n* Binary Sensor\n* Weather\n\nThere is also a custom weather card available [here](https://github.com/mawinkler/astroweather-card) as seen in the screenshot above.\n\n\u003e ***Other Peojects by me***:\n\u003e \n\u003e [AstroLive](https://github.com/mawinkler/astrolive) - Monitor your observatory from within Home Assistant.\n\u003e\n\u003e [UpTonight](https://github.com/mawinkler/uptonight) - Calculate the best astro photography targets (deep sky objects, planets, and comets) for the night at a given location.\n\n## Table of Content\u003c!-- omit in toc --\u003e\n\n- [How It Works](#how-it-works)\n- [Usage](#usage)\n  - [HACS installation](#hacs-installation)\n  - [Manual Installation](#manual-installation)\n  - [Configuration](#configuration)\n  - [Lovelace](#lovelace)\n- [UpTonight (optional)](#uptonight-optional)\n\n## How It Works\n\n- The AstroWeather integration has a dependency to [pyastroweatherio](https://github.com/mawinkler/pyastroweatherio) which is in charge to retrieve the forecast data and do the required calculations.\n- During setup of the integration you're asked for some location info via a config flow.\n- AstroWeather will then create a couple of sensors, binary sensors and a weather component to integrate with Home Assistant.\n- For Lovelace you can either build your own configuration or use the [AstroWeather Card](https://github.com/mawinkler/astroweather-card). The card does provide a config editor for customization.\n- All data is updated within a configurable interval in between 1 minute to 4 hours.\n- It is possible to use multiple instances of AstroWeather at the same time, even within different timezones.\n\n## Usage\n\n### HACS installation\n\nThis Integration is part of the default HACS store, so go to the HACS page and search for *AstroWeather* within the integrations.\n\n### Manual Installation\n\nTo add AstroWeather to your installation, create this folder structure in your /config directory:\n\n`custom_components/astroweather`.\n\nThen drop the following files into that folder:\n\n```yaml\n__init__.py\nbinary_sensor.py\nconfig_flow.py\nconst.py\nentity.py\nmanifest.json\nsensor.py\nstrings.json\nweather.py\ntranslation (Directory with all files)\n```\n\n### Configuration\n\nTo add AstroWeather to your installation, go to the Integration page inside the configuration panel and AstroWeather.\n\nDuring installation you will have the option to:\n\n- verify the longitude and latitude for the forecast\n- set the elevation\n- set the timezone\n- set the interval for updating forecast data\n- set the weightings for for the condition calculation\n- (optional) set the path pointing to your `/conf/www`-directory. Required only for UpTonight (see below)\n- (optional) enable or disable experimental features. When enabled, AstroWeather will calculate the astronomical seeing, transparency and lifted index on the available data of Met.no and does not use 7Timer.\n- (optional) enable one of the supported Open-Meteo services.\n\nThe interval for updating forecast data and the weightings can also be changed after you add the Integration, by using the *Options* link on the Integration widget.\n\n### Lovelace\n\nThere is a custom weather card available [here](https://github.com/mawinkler/astroweather-card).\n\nIt contains some of the sensor values as additional state attributes for use in the custome Lovelace card.\n\n## UpTonight (optional)\n\n[![astropy](https://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org/)\n[![skyfield](https://img.shields.io/badge/powered%20by-Skyfield-orange.svg?style=flat)](https://rhodesmill.org/skyfield/)\n\nEver wanted to know tonights best possible targets? Astroweather in combination with [UpTonight](https://github.com/mawinkler/uptonight) is here to help. UpTonight calculates the best astro photography targets for the night at a given location. The default built in deep sky object list is a merge of Gary Imm's [My Top 100 Astrophotography Targets](https://www.astrobin.com/uc8p37/) and the top 200 taken from his incredible [Deep Sky Compendium](http://www.garyimm.com/compendium). In addition, UpTonight calculates the observability of the solar system bodies. Finally, it can calculate the brightest visible comets based on the [Minor Planet Center](https://www.minorplanetcenter.net/data) database.\n\nUpTonight uses AstroPy which cannot be used asynchronously, so it needs to be separated from Home Assisntant.\n\nPlease refer to the documentation of [UpTonight](https://github.com/mawinkler/uptonight) on how to get it running. Below is the setup I'm using:\n\nI run Home Assistant as a Container. It's `config`-directory is mapped to `/home/markus/smarthome/homeassistant`. Ideally run UpTonight via docker-compose.yaml. Example:\n\n```yaml\nversion: \"3.2\"\nservices:\n  homeassistant:\n    container_name: homeassistant\n    image: homeassistant/home-assistant:2023.10\n    depends_on:\n      - influxdb\n      - mqtt\n    volumes:\n      - /home/markus/smarthome/homeassistant:/config\n      - /etc/localtime:/etc/localtime:ro\n      - /etc/timezone:/etc/timezone:ro\n    ports:\n      - 8123:8123\n    restart: always\n    network_mode: host\n\n  uptonight:\n    image: mawinkler/uptonight:latest\n    container_name: uptonight\n    environment:\n      - LONGITUDE=48d7m36.804s\n      - LATITUDE=11d34m38.352s\n      - ELEVATION=519\n      - TIMEZONE=Europe/Berlin\n      - PRESSURE=1.022\n      - TEMPERATURE=18\n      - RELATIVE_HUMIDITY=0.7\n    volumes:\n      - /home/markus/smarthome/homeassistant/www:/app/out\n```\n\nThe UpTonight container is not continuously running. When started it does the calculation, drops the output to the file system, and the exits. This just takes a couple of seconds.\n\nTo update the targets on a daily basis I run UpTonight every lunch time via cron:\n\n```cron\n0 12 * * * /usr/local/bin/docker-compose -f /home/markus/docker-compose.yaml up uptonight\n```\n\nFor Home Assistant two files are relevant:\n\n- `uptonight-report.json` - The calculated deep sky objects.\n- `uptonight-bodies-report.json` - The calculated solar system bodies (planets).\n- `uptonight-comets-report.json` - The calculated comets.\n- `uptonight-plot.png` - A plot of the astronomical night.\n\nTo embed the list of targets into my Lovelace I use the markdown card. In the below example Astrobin search links and links to the altitude vs. time diagrams are embedded.\n\n```yaml\ntype: markdown\ncontent: |-\n  \u003ch2\u003e\n    \u003cha-icon icon='mdi:creation-outline'\u003e\u003c/ha-icon\u003e\n    UpTonight DSO\n  \u003c/h2\u003e\n  \u003chr\u003e\n  {%- if states('sensor.astroweather_backyard_uptonight')|is_number %}\n    {%- for item in state_attr(\"sensor.astroweather_backyard_uptonight\", \"objects\") %}\n      {%- if loop.index \u003c= 20 %}\n        {%- if item.foto \u003e= 0.95 %}\n  \u003ctable\u003e\u003ctr\u003e\n    {%- set astrobin = '%22' + item.id | regex_replace('\\s', '%20') + '%22' %}\n    {%- set alttime = item.id | regex_replace('\\s', '-') | lower %}\n    \u003ca href=\"https://astrobin.com/search/?q={{ astrobin }}\"\u003e{{ item.name }}\u003c/a\u003e\u003cbr\u003e{{ item.type }} in {{ item.constellation }},\n    \u003ca href=\"https://astrobin.com/search/?q={{ astrobin }}\u0026d=i\u0026subject=\u0026telescope=\u0026camera=\u0026integration_time_min=0\u0026integration_time_max=16\u0026telescope_focal_length_min=600\u0026telescope_focal_length_max=850\u0026color_or_mono=C\u0026telescope_diameter_min=100\u0026telescope_diameter_max=130\u0026sort=-likes\"\u003eEsprit\u003c/a\u003e,\n    \u003ca href=\"http://192.168.1.129:8123/local/uptonight-alttime-{{ alttime }}.png\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eGraph\u003c/a\u003e\n        {%- endif %}\n      {%- endif %}\n    {%- endfor %}\n  {%- else %}\n    Waiting for AstroWeather\n  {%- endif %}\n  \u003c/tr\u003e\u003c/table\u003e\n```\n\nThe resulting list is sorted top down according to the fraction of time obeservable during astronomical darkness down to 95%. It shows only the top 20 targets including [AstroBin](https://www.astrobin.com/) search links.\n\nIf you're interested in our solar system bodies you can list them similarily:\n\n```yaml\ntype: markdown\ncontent: |-\n  \u003ch2\u003e\n    \u003cha-icon icon='mdi:creation-outline'\u003e\u003c/ha-icon\u003e\n    UpTonight Bodies\n  \u003c/h2\u003e\n  \u003chr\u003e\n  {%- if states('sensor.astroweather_backyard_uptonight')|is_number %}\n    {%- for item in state_attr(\"sensor.astroweather_backyard_uptonight\", \"bodies\") %}\n      \u003ctable\u003e\u003ctr\u003e\n      {{ loop.index }}. {{ item.name }}, Alt: {{ item.max_altitude | round}}°, Az: {{ item.azimuth | round }}° at {{ item.max_altitude_time | as_local | as_timestamp | timestamp_custom('%H:%M') }}, Mag: {{ item.visual_magnitude | round(1) }},\n      \u003ca href=\"http://homeassistant.local/local/uptonight-alttime-{{ item.name | lower }}.png\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eGraph\u003c/a\u003e\n    {%- endfor %}\n  {%- else %}\n    Waiting for AstroWeather\n  {%- endif %}\n  \u003c/tr\u003e\u003c/table\u003e\n```\n\nAre you looking for comets?:\n\n```yaml\ntype: markdown\ncontent: |-\n  \u003ch2\u003e\n    \u003cha-icon icon='mdi:creation-outline'\u003e\u003c/ha-icon\u003e\n    UpTonight Comets\n  \u003c/h2\u003e\n  \u003chr\u003e\n  {%- if states('sensor.astroweather_backyard_uptonight')|is_number %}\n    {%- for item in state_attr(\"sensor.astroweather_backyard_uptonight\", \"comets\") %}\n      \u003ctable\u003e\u003ctr\u003e\n      {{ loop.index }}. {{ item.designation }}, Mag: {{ item.visual_magnitude | round(1) }}, Rise time: {{ item.rise_time | as_local | as_timestamp | timestamp_custom('%H:%M') }}, Distance: {{ item.distance_au_earth | round(2) }}au,\n      \u003ca href=\"http://homeassistant.local/local/uptonight-alttime-{{ item.designation | lower | replace('/', '-') }}.png\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eGraph\u003c/a\u003e\n    {%- endfor %}\n  {%- else %}\n    Waiting for AstroWeather\n  {%- endif %}\n  \u003c/tr\u003e\u003c/table\u003e\n```\n\nFor 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.\n\nTemplate Image:\n\n```yaml\ntemplate:\n  - trigger:\n    - platform: time_pattern\n      # This will update every ten minutes\n      minutes: /10\n  - image:\n    - name: UpTonight\n      url: http://192.168.1.115:8123/local/uptonight-plot.png\n```\n\nPicture entity:\n\n```yaml\ntype: picture-entity\nentity: image.uptonight\ncamera_view: live\nshow_state: false\nshow_name: false\ntap_action:\n  action: fire-dom-event\n  browser_mod:\n    service: browser_mod.popup\n    data:\n      title: UpTonight\n      size: wide\n      content:\n        type: picture-entity\n        entity: image.uptonight\n```\n\nResult:\n\n![alt text](images/lovelace-uptonight-01.png \"Uptonight\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmawinkler%2Fastroweather","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmawinkler%2Fastroweather","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmawinkler%2Fastroweather/lists"}