How to get WeatherFlow Forecast Data: Script Sample

Posted on
Mon Jun 12, 2023 5:16 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

How to get WeatherFlow Forecast Data: Script Sample

With the shutdown of DarkSky API, getting decent forecast data is becoming harder.

I have always found my WeatherFlow Tempest app data to be as good as any, but the plugin doesn't provide forecast data that I could find.

For me, daily forecast data is really just high and low temps, and maybe chance of rain, though there is a lot more that WeatherFlow provides through their REST API. Documents here and here

I took a stab at reusing an old Python script, and it works good. I am sure a real programmer could come up with a cleaner script.

The only thing you need is your Station ID and a Personal Use Token, which you insert in the URL. I think I also needed to install the Python "requests" library with pip install requests on the Mac running Indigo.

Here is the script that gets the high and low temps for today and tomorrow and inserts them into Indigo Variables, while also stripping the trailing zero (59.0 becomes 59):

Code: Select all
import requests

#WeatherFlow Better Forecast GET
url = ""
body = {}
headers = {}

response_01 = requests.request("GET", url, data=body, headers=headers)
response_02 = response_01.json()

better_forecast_air_temp_high_01 = response_02["forecast"]["daily"][0]["air_temp_high"]
better_forecast_air_temp_low_01 = response_02["forecast"]["daily"][0]["air_temp_low"]
better_forecast_air_temp_high_02 = response_02["forecast"]["daily"][1]["air_temp_high"]
better_forecast_air_temp_low_02 = response_02["forecast"]["daily"][1]["air_temp_low"]

indigo.variable.updateValue(1965927598, u"{0:.0f}".format(better_forecast_air_temp_high_01))  # Indigo Variable ID for High Temp Today
indigo.variable.updateValue(261445057, u"{0:.0f}".format(better_forecast_air_temp_low_01))  # Indigo Variable ID for Low Temp Today
indigo.variable.updateValue(1786425257, u"{0:.0f}".format(better_forecast_air_temp_high_02))  # Indigo Variable ID for High Temp Tomorrow
indigo.variable.updateValue(1123217000, u"{0:.0f}".format(better_forecast_air_temp_low_02))  # Indigo Variable ID for Low Temp Tomorrow

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest