Feeding weewx from Meteobridge

145 views
Skip to first unread message

Ryan Stasel

unread,
May 5, 2020, 9:53:52 PM5/5/20
to weewx-user
Hi All,

I'd really like to feed weewx from my Meteobridge Nano SD. Looks like I could do this with the fileparse driver into weewx, just uploaded once a minute to weewx box, or possibly I could get Meteobridge to push data directly into the weewx archive DB (I saw a couple year old thread about that here: https://groups.google.com/forum/#!topic/weewx-user/1A8z8VUY98c). To answer the "why?" I like the format of Weewx's data archives, NOAA reports, graphs, etc. Would love to actually pump all my archive into weewx as well (over 10 years). 

Anyone have any input on how to do this? Anyone doing this? It should be super doable... but admittedly hacky as heck. =)

Thanks! 

Mike Harold Chan

unread,
May 5, 2020, 11:29:12 PM5/5/20
to weewx...@googlegroups.com
Im a meteobridge use, as far I know theres no yet available Interceptor yet available for weewx - meteobridge, I tried to research for that too long but so far theres none for meteobridge Interceptor 

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/930b652a-844e-4e07-abc8-3e1694b5aaaa%40googlegroups.com.

Ryan Stasel

unread,
May 6, 2020, 12:09:46 AM5/6/20
to weewx...@googlegroups.com
I mean. I could just have it use loop, as at least the nano will support doing that. But I’m trying to get away from handing off control to another system (I’m moving away from weathercat because of this). 

Fileparse may be the easiest. Will need to poke at it. 

On May 5, 2020, at 20:29, Mike Harold Chan <pimohd...@gmail.com> wrote:


You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/4FETwWj0OfA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAKjfRK%3Dyt%3Dazm%3D45uk9mvRoyfqFxp96vG2qBNpvKZsfhhrEChg%40mail.gmail.com.

Jacques Terrettaz

unread,
May 6, 2020, 5:18:46 AM5/6/20
to weewx-user

Hi,
The Meteobridge Nano SD emulates the network connectivity of a standard Davis IP datalogger. 
You can therefore configure weewx with the Vantage driver, with ethernet connection at the IP address of your Meteobridge Nano SD and using port 22222.

Ryan Stasel

unread,
May 6, 2020, 10:46:21 AM5/6/20
to weewx-user
Right, but that hands "Control" of the station over to weewx, which I'm trying to avoid (and why I'm trying to stop using weathercat, which is currently accessing my station that way). That is, according to Boris, the Meteobridge author. 

Was curious if there was another way, where Meteobridge remained "authoritative" (so to speak) and just handed data to weewx.

Thanks! 

mwall

unread,
May 6, 2020, 11:06:15 AM5/6/20
to weewx-user
On Wednesday, May 6, 2020 at 10:46:21 AM UTC-4, Ryan Stasel wrote:

Was curious if there was another way, where Meteobridge remained "authoritative" (so to speak) and just handed data to weewx.

you could use the weewx-interceptor driver as device 'wuclient' in listen mode, then point the meteobridge weather underground uploader to the computer on which interceptor is running.

meteobridge thinks it is uploading to wu, weewx thinks it is getting a feed from a generic wuclient

if you are already sending to wu and want to continue doing that, then use sniff mode in interceptor

Ryan Stasel

unread,
May 6, 2020, 2:41:25 PM5/6/20
to weewx-user
Ooooohhhh... this is cool! I could always have weewx relay the info to Wunderground (send meteobridge to weewx via the listen driver, then have weewx send to wunderground). I'm not seeing a way to point meteobridge at a different IP, but it could be stashed away somewhere, or as stated, hijack the data via router or DNS. 

Something to think about... 

I'm thinking another option would just be using Meteobridge's HTTP request to send to some php on the weewx server (I say php because I know it and don't know python) and have that write out to a file that just uses fileparse in weewx. That could easily run ever 5-10 seconds and would be quicker than doing a file upload that often. 

I need to actually start trying these things instead of just thinking about options... lol. 

I also need to see if I can get my data imported into weewx (or rather, I need to see if I can get my data OUT of Meteobridge). Worst case, I'll get it out of Meteotemplate. =)

Ryan Stasel

unread,
May 6, 2020, 9:45:43 PM5/6/20
to weewx-user
Okay, I have most of something working using an HTTP call from Meteobridge to php that outputs a file, and fileparse parses it. 

Right now, thought, I'm running into an issue with the datetime field. I've tried outputting from meteobridge in "[DD]/[MM]/[YYYY],[hh]:[mm]:[ss]" and in epoch, and both result in weewx barfing: 

"May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__: Caught unrecoverable exception:
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****  unsupported operand type(s) for -: 'NoneType' and 'int'
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****  Traceback (most recent call last):
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 154, in main
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      engine.run()
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 191, in run
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.NEW_LOOP_PACKET, packet=packet))
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      callback(event)
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/wxservices.py", line 89, in new_loop_packet
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      self.calc.new_loop_packet(event.packet)
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/wxservices.py", line 159, in new_loop_packet
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      self.rain_rater.add_loop_packet(loop_packet, self.db_manager)
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/wxservices.py", line 625, in add_loop_packet
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      self._setup(record['dateTime'], db_manager)
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/wxservices.py", line 662, in _setup
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****      start_ts = stop_ts - self.retain_period
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****  TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
May  6 18:41:44 raspi-server-misc weewx[26588] CRITICAL __main__:     ****  Exiting.
"

So... what format is datetime supposed to be in!? I can see in the schema it's "('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY')". So maybe YYYYMMDDHHMMSS?

Thanks!

gjr80

unread,
May 6, 2020, 9:55:32 PM5/6/20
to weewx-user
Um, fileparse does not obtain a timestamp from the file. The timestamp (WeeWX field dateTime) is taken as the WeeWX system time at the time the data file is read. Or are you using a modified fileparse driver.

Gary

gjr80

unread,
May 6, 2020, 10:02:11 PM5/6/20
to weewx-user
Actually, that’s not quite right. In the absence of a dateTime field the fileparse driver will use system time. If a dateTime field is provided it should override the default. The dateTime field should be an epoch timestamp, fileparse will return it as a float rather than an int, that may cause a problem down the line. But that is not the problem you have just now.

Gary

Ryan Stasel

unread,
May 7, 2020, 11:14:04 AM5/7/20
to weewx-user
Thank you! It works! 

For those curious, I've got Meteobridge every 15 seconds doing an HTTP call (under Services):


That's my weewx box. 

On that box, I've got just a simple PHP parsing that input and dumping it out to the file that fileparse is looking at. 

<?php
$file = '/var/tmp/datafile';
$w = $_GET['w'];
$array = explode(',', $w);
$ouputArray = array();
$outputArray[] = "dateTime=" . $array[0];
$outputArray[] = "barometer=" . $array[1];
$outputArray[] = "pressure=" . $array[2];
$outputArray[] = "inTemp=" . $array[3];
$outputArray[] = "outTemp=" . $array[4];
$outputArray[] = "inHumidity=" . $array[5];
$outputArray[] = "outHumidity=" . $array[6];
$outputArray[] = "windSpeed=" . $array[7];
$outputArray[] = "windDir=" . $array[8];
$outputArray[] = "windGust=" . $array[9];
$outputArray[] = "windGustDir=" . $array[10];
$outputArray[] = "rainRate=" . $array[11];
$outputArray[] = "rain=" . $array[12];
$outputArray[] = "dewpoint=" . $array[13];
$outputArray[] = "windchill=" . $array[14];
$outputArray[] = "heatindex=" . $array[15];
$output = implode("\n",$outputArray);
file_put_contents($file, $output);
echo "Success";
?>

Now, on to both removing all the Simulator data, and importing old data.... =)

Thanks all! Couldn't have done it without you! 

-Ryan Stasel
Reply all
Reply to author
Forward
0 new messages