IMPORTANT! The server may go down soon - possibly permanently. Please read the latest post in Announcements and News

I strongly advise all users using my server for their web site to make alternative arrangements.

Outgoing mail is disabled because of the malware on the server. No new forum registrations are currently possible, and mail to the forum administrator will not work.

Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

OpenWeatherMap Script for CumulusMX in Windows 10

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
Posts: 7
Joined: Sat May 24, 2014 7:54 pm
Weather Station: Davis VP2
Operating System: Windows 7
Location: Calgary, Alberta, Canada

OpenWeatherMap Script for CumulusMX in Windows 10

Postby glarsen » Mon Jul 16, 2018 1:35 pm

Hi, I've created a script to send data from CumulusMX to OpenWeatherMap. It's based on the use of curl as suggested in a post elsewhere in this forum, but has been adapted to run on Windows 10. Since it uses curl, it should be easily adapted to run on other platforms as well.

Save this script as OpenWeatherMap.bat in your CumulusMX folder/directory:

Code: Select all

::change here
set apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (your api key)
set station_id=xxxxxxxxxxxxxxxxxxxxxxxx (your station_id)
set curlpwd=C:\curl\bin (wherever curl is located)

::@echo off
call :GetUnixTime UNIX_TIME
::echo %UNIX_TIME% seconds have elapsed since 1970-01-01 00:00:00

::use curl

%curlpwd%\curl.exe -g -X POST -H "Content-Type: application/json" --data "[{\"station_id\": \"%station_id%\",\"dt\": %UNIX_TIME%,\"temperature\": <#temp>,\"dewpoint\": <#dew>,\"wind_deg\": <#bearing>,\"wind_speed\": <#wspeed>,\"wind_gust\": <#wgust>,\"pressure\": <#press>,\"humidity\": <#hum>,\"rain_1h\": <#rhour>,\"rain_24h\": <#r24hour>}]"
goto :EOF

setlocal enableextensions
for /f %%x in ('wmic path win32_utctime get /format:list ^| findstr "="') do (
    set %%x)
set /a z=(14-100%Month%%%100)/12, y=10000%Year%%%10000-z
set /a ut=y*365+y/4-y/100+y/400+(153*(100%Month%%%100+12*z-3)+2)/5+Day-719469
set /a ut=ut*86400+100%Hour%%%100*3600+100%Minute%%%100*60+100%Second%%%100
endlocal & set "%1=%ut%" & goto :EOF

You'll need to download and install curl for windows from "" as the version that comes with Windows 10 doesn't work properly. The downloaded version works more like that found in linux.

Then, using the CumulusMX console Settings tab, Internet Settings, ensure "Auto update" is enable in Web/FTP settings and set "Upload Interval" to 15 or higher.

Under "External Programs" add "C:\CumulusMx\openweather_processed.bat" in "Program"

Next, under "Settings", "Extra Web Files", add "C:\CumulusMX\OpenWeatherMap.bat" under "Local Filename" and "C:\CumulusMX\openweather_processed.bat" under "Remote Filename" (change locations to suit your individual installation). Ensure the tickbox under "Process" is ticked.

That's it. I tried using a simpler approach using "Custom HTTP" but OpenWeatherMap uses time in Linux Epoch format which isn't easily available in Windows. Thus the extra code in the script to derive it from Windows time.

Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 3 guests