Skip to content

caiosweet/Home-Assistant-custom-components-NASA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Assistant - Custom Components Nasa APIs

Logo

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.

hacs Validate

GitHub latest release GitHub Release Date Maintenancebadge GitHub issuesbadge

Websitebadge Forum telegrambadge facebookbadge

Don't buy me a coffee


Introduction

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.

Authentication

Although not strictly required to begin interacting with the NASA API, it is recommended to Generate API Key.

Information

TODO

GitHub All Releases

Installation

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.

  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 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

Configuration

Config flow

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

Open your Home Assistant instance and start setting up a new integration.

Setup

Now the integration is added to HACS and available in the normal HA integration installation

  1. In the HomeAssistant left menu, click Configuration
  2. Click Integrations
  3. Click ADD INTEGRATION
  4. Type Nasa and select it
  5. Enter the data:
    • 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)

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.

TODO Description of the sensors

TODO Preview - Usage

Preview

Icon

Dashboard (card markdown)

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

Thanks

This integration uses the following Python Library:

License

Information provided by NASA APIs a central catalog and key service for public APIs.

Contributions are welcome


Trademark Legal Notices

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.