Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Raspberry e Openweathermap
Moderator: mcrossley
-
nicmarco
- Posts: 1
- Joined: Fri 27 May 2016 8:10 pm
- Weather Station: wmr 180
- Operating System: raspbian
- Location: Nova Siri, Italia
Raspberry e Openweathermap
Hello everyone, I just installed cumulusMx on a raspberry Pi3 , and I would like to send the station on openweathermap , someone can help me ? Thank you
-
water01
- Posts: 3670
- Joined: Sat 13 Aug 2011 9:33 am
- Weather Station: Ecowitt HP2551
- Operating System: Windows 10/11 64bit Synology NAS
- Location: Burnham-on-Sea
- Contact:
Re: Raspberry e Openweathermap
Sorry but I don't think Cumulus MX has an interface to OpenWeatherMap.
- philpugh
- Posts: 428
- Joined: Tue 24 May 2011 8:34 am
- Weather Station: See Signature
- Operating System: Debian 12 (RPi5)
- Location: Antrobus, Cheshire, UK
- Contact:
Re: Raspberry e Openweathermap
You can do it reasonably simply using a bit of Python code. I attach a modified version of the one I use - which pulls data from the MySQL databases I use. You could use other methods to generate the required info though. Something along the lines of the realtimegaugesMXT.txt for instance. Sorry about the code insert - couldn't get the file upload to work for some reason
NB endstr should contain your openweathermap access info (username, password, API key)
posstr contains lat, long and name of your weather station
Code: Select all
#!/usr/bin/python
import MySQLdb
import subprocess
# To read databases and submit info to OpenWeatherMap
# Should be run via crontab every 15 mins (suggested)
# some constants
mphtms = 0.447 # convert mph to m/s
db1 = MySQLdb.connect(host="localhost", user="xxx", passwd="yyy", db="ws3083")
db2 = MySQLdb.connect(host="localhost", user="mmm", passwd="nnn", db="weather")
# create Cursor objects.
cur1 = db1.cursor()
cur2 = db2.cursor()
# Use all the SQL you like
cur1.execute("SELECT Windspeed, Windbearing, UVindex, SolarRad FROM Monthly ORDER BY LogDateTime DESC LIMIT 1")
cur2.execute("SELECT LogDateTime, Temp, Humidity, TodayRainSoFar, Pressure FROM Monthly ORDER BY LogDateTime DESC LIMIT 1")
# process result - should only be one record - the last record entered
for row in cur1.fetchall():
ws = row
for row in cur2.fetchall():
dv = row
db1.close()
db2.close()
# now generate the command to send
endstr = " --user 'user:password' -H 'x-api-key:apikey' http://openweathermap.org/data/post"
posstr = "&lat=nn.nn&long=-nn.nn&alt=mmm&name=MyStation" + "'"
val1 = "'"+"temp="+str(dv[1])+"&wind_speed="+str("%1.1f"%(float(ws[0])*mphtms))+"&wind_dir="+str(ws[1])+"&pressure="+str(dv[4])
val2 = "&rain_today="+str(dv[3])+"&uv="+str(ws[2])+"&radiation="+str(ws[3])
cmd = "curl -d "+val1+val2+posstr+endstr
#print cmd
subprocess.call(cmd, shell=True)posstr contains lat, long and name of your weather station
Phil Pugh
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/
- philpugh
- Posts: 428
- Joined: Tue 24 May 2011 8:34 am
- Weather Station: See Signature
- Operating System: Debian 12 (RPi5)
- Location: Antrobus, Cheshire, UK
- Contact:
Re: Raspberry e Openweathermap
Sorry - edited code above as I had left in a debug comment in front of the first database close.
The commented out "print cmd" is there for testing - you can see the string you are going to send.
The commented out "print cmd" is there for testing - you can see the string you are going to send.
Phil Pugh
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/
- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Raspberry e Openweathermap
Could you use the custom http options in MX?
- philpugh
- Posts: 428
- Joined: Tue 24 May 2011 8:34 am
- Weather Station: See Signature
- Operating System: Debian 12 (RPi5)
- Location: Antrobus, Cheshire, UK
- Contact:
Re: Raspberry e Openweathermap
Can't see why not Mark - I should have investigated this first.
Having said that the OpenWeatherMap.com site is pretty much useless and I guess they 'sell' the information we provide to app developers that want cheap access to weather information - e.g. smart watch developers. I was having difficulty recovering the data I was sending and the tech support provided a link that returned JSON style info - it was my data but I was thrown by the temp value until it dawned on me they seem to display the value in degrees Kelvin - useful for certain weather calculations I guess, but not a common thing to display.
Having said that the OpenWeatherMap.com site is pretty much useless and I guess they 'sell' the information we provide to app developers that want cheap access to weather information - e.g. smart watch developers. I was having difficulty recovering the data I was sending and the tech support provided a link that returned JSON style info - it was my data but I was thrown by the temp value until it dawned on me they seem to display the value in degrees Kelvin - useful for certain weather calculations I guess, but not a common thing to display.
Phil Pugh
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/
GW1100 + WH65/WH57/WH31;GW1100 + WS68/WH40A (also with HP25xx console); GW2001 WittBoy
CumulusMX V4 / CUtils V7
Raspberry Pi 5 64bit
https://goosegate.uk/