Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

OpenWeatherMap Script for CumulusMX in Windows 10

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
glarsen
Posts: 7
Joined: Sat 24 May 2014 7:54 pm
Weather Station: Davis VP2
Operating System: Windows 7
Location: Calgary, Alberta, Canada

OpenWeatherMap Script for CumulusMX in Windows 10

Post by glarsen »

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

::
::Variables
::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
setlocal
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>}]"  http://api.openweathermap.org/data/3.0/measurements?appid=%apikey%
goto :EOF

:GetUnixTime
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 "https://curl.haxx.se/download.html" 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.
Locked