{"product_id":"home-assistant-n8n-workflow-nasa-apod-near-earth-asteroid","title":"Home Assistant n8n Workflow: NASA APOD \u0026 Near-Earth Asteroid","description":"\u003ch3\u003eBring NASA’s latest space discoveries into your Home Assistant—automatically\u003c\/h3\u003e\n\u003cp\u003eThis \u003cstrong\u003eHome Assistant n8n Workflow\u003c\/strong\u003e 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 NEO feed, then upserts both as \u003cem\u003esensor entities\u003c\/em\u003e in Home Assistant for dashboard viewing.\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 (or you can start it manually via a manual trigger).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalls the NASA APOD API\u003c\/strong\u003e to retrieve today’s picture metadata, including thumbnail URLs for video content.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFormats and upserts APOD data\u003c\/strong\u003e to Home Assistant as \u003ccode\u003esensor.nasa_apod\u003c\/code\u003e—including title, date, media type, image\/thumbnail URL, and a NASA explanation capped to a configurable `280-character` length.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalls NASA’s Near-Earth Object (NEO) feed\u003c\/strong\u003e for a rolling \u003cstrong\u003e3-day window\u003c\/strong\u003e starting today.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFlattens, sorts, and selects the nearest asteroid\u003c\/strong\u003e by miss distance, then extracts key fields such as \u003cstrong\u003edistance\u003c\/strong\u003e, \u003cstrong\u003esize\u003c\/strong\u003e, \u003cstrong\u003espeed\u003c\/strong\u003e, a \u003cstrong\u003ehazard flag\u003c\/strong\u003e, and the \u003cstrong\u003etotal count\u003c\/strong\u003e of matched close-approach entries.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUpserts the nearest-asteroid details\u003c\/strong\u003e to Home Assistant as \u003ccode\u003esensor.nasa_asteroid\u003c\/code\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eDaily dashboards showing \u003cstrong\u003eNASA APOD\u003c\/strong\u003e with a fresh image\/thumbnail and short explanation.\u003c\/li\u003e\n  \u003cli\u003eHome Assistant screens for \u003cstrong\u003enear-Earth asteroid awareness\u003c\/strong\u003e—always highlighting the closest object from the next few days.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers and SaaS operators demonstrating reliable \u003cstrong\u003eAPI-to-home dashboard\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\/tech stack:\u003c\/strong\u003e set, code, sticky note, http request, home assistant, manual trigger.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNASA authentication:\u003c\/strong\u003e add a NASA API key from \u003ccode\u003ehttps:\/\/api.nasa.gov\u003c\/code\u003e as an HTTP Query Auth credential (e.g., \u003ccode\u003eapi_key\u003c\/code\u003e), used by both NASA HTTP requests.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eHome Assistant authentication:\u003c\/strong\u003e configure a Home Assistant API credential (base URL + long-lived access token) and select it in both Home Assistant upsert steps.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eConfigurable:\u003c\/strong\u003e schedule time, asteroid look-ahead window end date, APOD explanation length, and target entity IDs (\u003ccode\u003esensor.nasa_apod\u003c\/code\u003e, \u003ccode\u003esensor.nasa_asteroid\u003c\/code\u003e).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46086669369523,"sku":"N8N-19851","price":18.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/5pwfYmrWf4Jl1VSf0sxyx_hULKvLJ9.png?v=1790327664","url":"https:\/\/buyflowscripts.com\/products\/home-assistant-n8n-workflow-nasa-apod-near-earth-asteroid","provider":"N8N Commerce","version":"1.0","type":"link"}