{"product_id":"home-assistant-nasa-apod-nearest-asteroid-sensor-n8n","title":"Home Assistant NASA APOD + Nearest Asteroid Sensor (n8n)","description":"\u003ch3\u003eGet NASA’s APOD and the nearest asteroid into Home Assistant—automatically\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow fetches NASA’s \u003cstrong\u003eAstronomy Picture of the Day (APOD)\u003c\/strong\u003e and the \u003cstrong\u003eclosest near-Earth asteroid\u003c\/strong\u003e from NASA’s feeds, then upserts both results as \u003cstrong\u003eHome Assistant sensors\u003c\/strong\u003e for dashboards and automations.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns daily at 6:00 AM\u003c\/strong\u003e (and can also be triggered on-demand via a manual trigger).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePulls NASA APOD\u003c\/strong\u003e using the NASA API (with thumbnail support enabled), then extracts:\n    \u003cul\u003e\n      \u003cli\u003eAPOD \u003cstrong\u003etitle\u003c\/strong\u003e, \u003cstrong\u003edate\u003c\/strong\u003e, \u003cstrong\u003emedia type\u003c\/strong\u003e\n\u003c\/li\u003e\n      \u003cli\u003eBest-available \u003cstrong\u003eimage\/thumbnail URL\u003c\/strong\u003e\n\u003c\/li\u003e\n      \u003cli\u003eTrims the \u003cstrong\u003eexplanation to 280 characters\u003c\/strong\u003e\n\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUpserts a Home Assistant sensor\u003c\/strong\u003e at \u003ccode\u003esensor.nasa_apod\u003c\/code\u003e with the APOD title as state and attributes including the image URL, explanation, media type, and date.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePulls NASA NEO data\u003c\/strong\u003e for today through the next \u003cstrong\u003ethree days\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eFlattens returned asteroids, \u003cstrong\u003esorts by miss distance\u003c\/strong\u003e, and selects the \u003cstrong\u003eclosest approach\u003c\/strong\u003e, including:\n    \u003cul\u003e\n      \u003cli\u003edistance, estimated diameter, velocity\u003c\/li\u003e\n      \u003cli\u003ehazard flag\u003c\/li\u003e\n      \u003cli\u003easteroid name and total count\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUpserts a Home Assistant sensor\u003c\/strong\u003e at \u003ccode\u003esensor.nasa_asteroid\u003c\/code\u003e with the asteroid name as state and relevant attributes.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eDisplay \u003cstrong\u003eNASA APOD\u003c\/strong\u003e and the latest space scene in a Home Assistant wall tablet or dashboard.\u003c\/li\u003e\n  \u003cli\u003eCreate automations that react to the \u003cstrong\u003ehazard flag\u003c\/strong\u003e or update alerts when the closest asteroid changes.\u003c\/li\u003e\n  \u003cli\u003eGive SaaS operators and automation engineers a clean example of \u003cstrong\u003eAPI-to-Home Assistant sensor upsert\u003c\/strong\u003e patterns in n8n.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes\/blocks:\u003c\/strong\u003e set, code, sticky note, HTTP Request, Home Assistant, Manual Trigger\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNASA API key:\u003c\/strong\u003e create a free key at \u003ca href=\"https:\/\/api.nasa.gov\" target=\"_blank\" rel=\"noopener\"\u003ehttps:\/\/api.nasa.gov\u003c\/a\u003e and add it as an HTTP Query Auth credential (\u003ccode\u003eapi_key\u003c\/code\u003e) for both requests.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eHome Assistant integration:\u003c\/strong\u003e configure instance URL and a \u003cstrong\u003elong-lived access token\u003c\/strong\u003e, and select them in both Home Assistant upsert steps.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46086671401139,"sku":"N8N-19849","price":14.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/IjKi9i1YwBb5zHewE5acQ_u4JC2yfd.png?v=1790327711","url":"https:\/\/buyflowscripts.com\/products\/home-assistant-nasa-apod-nearest-asteroid-sensor-n8n","provider":"N8N Commerce","version":"1.0","type":"link"}