diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 6d126a5..fb9c9f1 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -32,4 +32,3 @@ jobs: uses: "hacs/action@main" with: category: "integration" - ignore: "hacs brands" diff --git a/README.md b/README.md index f089ab8..f326aab 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Home Assistant - Custom Components Nasa APIs -![Nasa](assets/brand/logo.png) +![Logo](assets/brand/logo.png) Welcome to my repository Home Assistant - Custom Component NASA for the [nasa.gov][nasa] API. The Nasa platform uses the Nasa APIs to know a lot of information, such as, the image of the day, on asteroids near the Earth, photos from Mars and much more. -[![hacs][hacsbadge]][hacs] [![Validate](https://github.com/caiosweet/Home-Assistant-custom-components-NASA/actions/workflows/validate.yaml/badge.svg)](https://github.com/caiosweet/Home-Assistant-custom-components-NASA/actions/workflows/validate.yaml) +[![hacs][hacs_custom]][hacs] [![Validate](https://github.com/caiosweet/Home-Assistant-custom-components-NASA/actions/workflows/validate.yaml/badge.svg)](https://github.com/caiosweet/Home-Assistant-custom-components-NASA/actions/workflows/validate.yaml) [![GitHub latest release]][githubrelease] ![GitHub Release Date] [![Maintenancebadge]][maintenance] [![GitHub issuesbadge]][github issues] @@ -30,16 +30,34 @@ Although not strictly required to begin interacting with the NASA API, it is rec TODO +[![GitHub All Releases][downloads_total_shield]][githubrelease] + ## Installation ### Using [Home Assistant Community Store](https://hacs.xyz/) (recommended) -1. Click on HACS in the Home Assistant menu -2. Click on `Integrations` -3. Click the `EXPLORE & ADD REPOSITORIES` button -4. Search for `Nasa` -5. Click the `INSTALL THIS REPOSITORY IN HACS` button -6. Restart Home Assistant +This integration can be added to HACS as a [custom repository](https://hacs.xyz/docs/faq/custom_repositories): + +* URL: `https://github.com/caiosweet/Home-Assistant-custom-components-NASA` +* Category: `Integration` + +After adding a custom repository you can use HACS to install this integration using user interface. + +1. Search for `Nasa` +2. Click the `INSTALL THIS REPOSITORY IN HACS` button +3. Restart Home Assistant + +### Manual + +To install this integration manually you have to download [*nasa.zip*](https://github.com/caiosweet/Home-Assistant-custom-components-NASA/releases/latest/download/nasa.zip) and extract its contents to `config/custom_components/nasa` directory: + +```bash +mkdir -p custom_components/nasa +cd custom_components/nasa +wget https://github.com/caiosweet/Home-Assistant-custom-components-NASA/releases/latest/download/nasa.zip +unzip nasa.zip +rm nasa.zip +``` ## Configuration @@ -60,14 +78,14 @@ Now the integration is added to HACS and available in the normal HA integration 3. Click `ADD INTEGRATION` 4. Type `Nasa` and select it 5. Enter the data: - - **Apy Key**: default DEMO KEY + * **Apy Key**: default DEMO KEY 6. Configure the Options: - - [APOD] - Astronomy Picture of the Day - - [InSight] - Mars Weather Service API - - [EPIC] - Earth Polychromatic Imaging Camera - - [NeoWs] - Asteroids Near Earth Object Web Service - - [Exoplanet] - Exoplanet Archive - - Update interval (minutes, default 120) + * [APOD] - Astronomy Picture of the Day + * [InSight] - Mars Weather Service API + * [EPIC] - Earth Polychromatic Imaging Camera + * ~~[NeoWs] - Asteroids Near Earth Object Web Service~~ + * ~~[Exoplanet] - Exoplanet Archive~~ + * Update interval (minutes, default 120) Once you done that, you’re ready to start. @@ -79,11 +97,66 @@ Once you done that, you’re ready to start. Preview -![Logo](assets/brand/icon.png) +![Icon](assets/brand/icon.png) + +## Dashboard (card markdown) + +```yaml +type: markdown +content: >- + {% set sensor = "sensor.nasa_apod" %} + + {% set URL = iif(state_attr(sensor, 'hdurl'), 'hdurl', 'url') %} + + {% set link = state_attr(sensor, URL) %} + + {% if 'youtube' in link %} + + {% set id_regex = + '(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})\W' + %} + + {% set id = (link |regex_findall(find=id_regex))[0] %} + + [![MEDIA](https://img.youtube.com/vi/{{id}}/0.jpg)]({{ link }}) + + {% else %} + + [![PHOTO]({{ link }})]({{ link }}) + + {% endif %} + + + {{ state_attr(sensor, 'title') }} + + + {{ state_attr(sensor, 'explanation') }} + + + {{state_attr(sensor, 'media_type')}} +title: Astronomy Picture of the Day +``` + +```yaml +type: markdown +content: |+ + {% set sensor = "sensor.nasa_epic" %} + {% set link = state_attr(sensor, "url_7") %} + [![IMAGE]({{ link }})]({{ link }}) + {{ state_attr(sensor, 'date_7') }} + +title: Earth Polychromatic Imaging Camera +``` + +## Thanks + +This integration uses the following Python Library: + +* [Project: aionasa - Author: nwunderly](https://pypi.org/project/aionasa/) ## License -Information provided by [_NASA APIs_](https://api.nasa.gov/) a central catalog and key service for public APIs. +Information provided by [*NASA APIs*](https://api.nasa.gov/) a central catalog and key service for public APIs. ## Contributions are welcome @@ -95,11 +168,13 @@ All product names, trademarks and registered trademarks in the images in this re All images in this repository are used by the author for identification purposes only. The use of these names, trademarks and brands appearing in these image files, do not imply endorsement. - - + [hacs]: https://github.com/custom-components/hacs -[hacsbadge]: https://img.shields.io/badge/HACS-Custom-41BDF5.svg +[hacs_faq_custom]: https://hacs.xyz/docs/faq/custom_repositories +[hacs_custom]: https://img.shields.io/badge/HACS-Custom-41BDF5.svg [hacs_integration]: https://github.com/hacs/integration + + [github latest release]: https://img.shields.io/github/v/release/caiosweet/Home-Assistant-custom-components-NASA [githubrelease]: https://github.com/caiosweet/Home-Assistant-custom-components-NASA/releases [github release date]: https://img.shields.io/github/release-date/caiosweet/Home-Assistant-custom-components-NASA @@ -107,6 +182,9 @@ The use of these names, trademarks and brands appearing in these image files, do [maintenance]: https://github.com/caiosweet/Home-Assistant-custom-components-NASA/graphs/commit-activity [github issuesbadge]: https://img.shields.io/github/issues/caiosweet/Home-Assistant-custom-components-NASA [github issues]: https://github.com/caiosweet/Home-Assistant-custom-components-NASA/issues +[downloads_total_shield]: https://img.shields.io/github/downloads/caiosweet/Home-Assistant-custom-components-NASA/total + + [website]: https://hassiohelp.eu/ [websitebadge]: https://img.shields.io/website?down_message=Offline&label=HssioHelp&logoColor=blue&up_message=Online&url=https%3A%2F%2Fhassiohelp.eu [telegram]: https://t.me/HassioHelp @@ -116,7 +194,7 @@ The use of these names, trademarks and brands appearing in these image files, do [forum]: https://forum.hassiohelp.eu/ [forumbadge]: https://img.shields.io/badge/HassioHelp-Forum-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA0ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODcxMjY2QzY5RUIzMTFFQUEwREVGQzE4OTI4Njk5NDkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODcxMjY2QzU5RUIzMTFFQUEwREVGQzE4OTI4Njk5NDkiIH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QCQOYNXU8qBp//4TH/jkHZ3UCTXFoncQGKciP1SiN1JDVY2IJwgEjq3jYMVsZgC/HSBw9RnA8CgBjmS3MkdefE638sCV0WGQk9/QXYNRicH%2B7eWwYUGpOT4oq%2Bfq0Upw4SEPVOCLnwOWp5o%2BgskfWEoZe8Qg6CGwcp7XWFVxTc0UYdlMrLmQsP8zVuQcWFNiORFCTSvRQTWQs6W101SRXE7/xiDSBeC5BKywRLx/KqbuA44TYUQS4HHfsLHEcZyhulP32zjEUwL2ACuPt24%2BR0HhnONJBA8IoRlG/4P4/%2B57FTTyC9bUMAQk8OJ9Am69VsHjC2cOJbPaU0iQn4DxrjnSwVwp4eF2XwC63uBVLCchpXgQPAiUUrM8xBwlfeqs%2Bc7JwFn//KHKtAI8IkVejFgIgY8p2etEB7cPDbF32wSE8pwx926XTx6pAcPxxmFlzIo2o/qPy84sb4JTSMb7v3qiGFhJIaAzw1wbkmh8tu4IrqKm4v347V1qmvQGKvjJjEyf7v/pX3GmrGp%2BtT73UDyRHCPLMBDKwUj801dl4P7Fwc8fh0rLwiaBrp2dN2Do%2Bxfb%2Bd%2BE2GwEe%2BEPTYaW1gNQUiKaBP9T/ggwAJik5dEKYSC3AAAAAElFTkSuQmCC - + [APOD]: https://apod.nasa.gov/apod/astropix.html [EPIC]: https://epic.gsfc.nasa.gov/ [Exoplanet]: https://exoplanetarchive.ipac.caltech.edu/index.html