Welcome to my repository Home Assistant - Custom Component NASA for the nasa.gov 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.
The goal is to integrate the largest number of Nasa APIs available, time and knowledge permitting. I am looking for a complete asynchronous python wrapper module for NASA's open APIs. This custom component is still in the development/testing phase. Bugs are still being worked out and breaking changes are common.
Although not strictly required to begin interacting with the NASA API, it is recommended to Generate API Key.
TODO
Using Home Assistant Community Store (recommended)
This integration can be added to HACS as a custom repository:
- 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.
- Search for
Nasa
- Click the
INSTALL THIS REPOSITORY IN HACS
button - Restart Home Assistant
To install this integration manually you have to download nasa.zip and extract its contents to config/custom_components/nasa
directory:
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
To configure this integration go to: Configurations
-> Integrations
-> ADD INTEGRATIONS
button, search for Nasa
and configure the component.
You can also use following My Home Assistant link
Now the integration is added to HACS and available in the normal HA integration installation
- In the HomeAssistant left menu, click
Configuration
- Click
Integrations
- Click
ADD INTEGRATION
- Type
Nasa
and select it - Enter the data:
- Apy Key: default DEMO KEY
- Configure the Options:
Once you done that, you’re ready to start.
NB: If you leave the API KEY field blank, the DEMO KEY will be used. It's fine to start with, but it depends on the things to check out.
Preview
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
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
This integration uses the following Python Library:
Information provided by NASA APIs a central catalog and key service for public APIs.
All product names, trademarks and registered trademarks in the images in this repository, are property of their respective owners. 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.