Embed variable into a URL on Custom Tile

Hi all,
I’d like to take an attribute from my WeatherUnderground driver (say, an icon code that represents the image for that day’s weather conditions, hence it’s dynamic) and embed that into a URL that would retrieve the actual icon image from GitHub into the tile itself. I’ve figured out how to set a variable for an attribute and keep it updated, so that part is good.

The closest thing I’ve seen to grabbing a variable’s value and making it into a usable URL for sharptools, is by means of Custom Tiles → JS Library. I can do some coding but I’m not good with Java. Is this the only way, and could someone give me a hand over this hurdle?

Many thanks!

Can you share a sample URL to an image and what the related variable value would be?

I would also note that there’s a community developed Open Weather Custom Tile that you might find interesting:

Open Weather Tile
:sunny: Weather Tile - Open Weather - Current and Forecast

Sure, URLs look like:

…where the 39 in this case is the icon for rain. That’s all I would likely use a variable for, is the code for the needed icon.

I’m also open to other sources for “todays/tonight’s weather” such as Open Weather, as long as it supports Canadian locales, metric, etc.

Thanks Josh!

Yes, the custom tile I linked to has support for global regions and locales (even localizing the weather terminology to a local language).

Here’s a sample Custom Tile that does what you’re asking for. It demonstrates the basics of using a Variable as a ‘setting’ for the Custom Tile and using the variable value within the Custom Tile:

:arrow_double_down: Import Weather Icon Variable Custom Tile

1 Like

Wow you even wrote up an entire prototype. Top notch customer service, Josh. I will be subscribing today. Now I just need to decide on Open Weather or custom. Maybe both! Thanks again!