caiosweet / Home-Assistant-custom-components-NASA

Home Assistant custum integration for the Nasa APIs
MIT License
10 stars 0 forks source link

Feature Request: Personally Hosted API support #4

Open cody0303 opened 1 year ago

cody0303 commented 1 year ago

Since the APOD API you're using has been down for a couple days, I looked into and am successfully hosting my own API locally. I'd love to have an option to point at that using this integration. I'm going to make an attempt myself, but this integration is more complex than anything I've tackled before.

caiosweet commented 1 year ago

Well. 👍

Unfortunately I'm not a programmer and for me it was an experiment. I took some examples on the internet and made this integration. I'd like to get back to work, but I'm not able to deal with it quickly. :0(

We can try to match the jobs, or we should do a new, simpler integration.

Anyway, will you publish your API?

cody0303 commented 1 year ago

Simpler integration may be the way to go. I'm running the API in Docker, following the instructions here. It was very easy. I think I'm actually just going to make some REST sensors in HA to collect the data, and skip over this integration altogether.

caiosweet commented 1 year ago

REST sensors is the right solution. Especially for APOD. I will archive this project as soon as I can. :-)

cody0303 commented 1 year ago

Here's the sensor, if you're interested (obviously point to your own internal IP). All the integrations/lovelace I made around your sensor seems to work the same for this one, so far.

#NASA APOD
- platform: rest
  name: nasa_apod
  method: GET
  resource: "http://192.168.88.14:5000/v1/apod"
  value_template: "OK"
  json_attributes:
    - "copyright"
    - "date"
    - "explanation"
    - "hdurl"
    - "url"
    - "media_type"
    - "title"
caiosweet commented 1 year ago

OK thank you. Not everyone knows how to install the script on their server, meanwhile I'll follow what happens API returns error code 503 (Service Unavailable) but APOD site running fine.