National Weather Service API call


#1

Trying to get weather icon data from the NWS.
Getting this…

image

$response.properties.periods.[0].icon gives https://api.weather.gov/icons/land/day/few?size=medium

How do I get the actual icon into a variable ?

Putting https://api.weather.gov/icons/land/day/few?size=medium in my browser gives…

image


#2

I’m confused, what’s the end goal? It looks like you got the correct path already.


#3

I’m trying to put the icon into a Hubitat dashboard tile. I need the icon in the variable, not the url. Does that make sense? Or am I way off base here?


#4

Ah, yeah that makes sense but I don’t think we can do that. Is it the stock hubitat dashboard or are you using some sort of ‘super’ tile?


#5

I have asked the author if the “web tile” option can use a variable. Currently it requires a URL. But my weather image URL changes often and so I am trying to update my Hubitat variable with webcore. That is where I was going to put the icon image if I could get it into a variable. He also has an “image tile”, but it requires a URL and I cannot use a variable there either. I am probably making this WAY harder than it is…


#6

Do I remember you having a pi running in your network? Maybe you can download that image on a cron and just point the URL at your local pi.


#7

Good memory! Excellent suggestion. I’ll give it a try. Thanks.


#8

I’m not an expert on this, so din’t know how do do it exactly, but I suspect you could write a node.js app on the PI to scrape the image and return it as a variable.

I’ve done this with text, but sure with an image.


#9

I kinda do the same thing with bloomsky images that I put on my dashboard. It’s a little convoluted but it works lol. I have webCoRE pull the current image url from bloomsky, pass it on to node-red that executes a python script that downloads the image and renames it to something that I reference on the dashboard.


#10

Yep!