Weather API examples & templates
Use these vals as a playground to view and fork Weather API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
charmaine
runGetWeather
Cron
In the following example code, we are using getWeather from stevekrouse/getWeather . It uses the free wttr.in service to get weather data. Add these lines to your code Replace Brooklyn, NY with your location Click Run Now View the output in the val’s logs import { getWeather } from "https://esm.town/v/stevekrouse/getWeather";
let weather = await getWeather("Brooklyn, NY");
console.log(weather.current_condition[0].FeelsLikeF)
0
stevekrouse
BIGweather
HTTP
Big Weather Display Displays the current day's weather information BIG so you can see it from far away. I LOVE this val. My girlfriend and I use it everyday. We have an old chromebook slate set up in the corner
of our apartment, so we can get the daily weather at a glance without our phones. Currently it's hardcoded for: prospect heights, brooklyn charts of the temp and % change of precipitation Probably easiest for you to fork it and change it to suit your needs vs making it customizable
0
stevekrouse
umbrellaReminder
Cron
☔️ Umbrella reminder if there's rain today Setup Fork this val 👉 https://val.town/v/stevekrouse.umbrellaReminder/fork Customize the location (line 8). You can supply any free-form description of a location. ⚠️ Only works for US-based locations (where weather.gov covers). How it works Geocodes an free-form description of a location to latitude and longitude – @stevekrouse.nominatimSearch Converts a latitude and longitude to weather.gov grid – @stevekrouse.weatherGovGrid Gets the hourly forecast for that grid Filters the forecast for periods that are today and >30% chance of rain If there are any, it formats them appropriately, and sends me an email
9