[weewx-user] Re: Crash with log info

2019-04-23 Thread vk3anz
AAGGHH - this is what happens when you try to refactor your code and forget 
about variable scoping.
The 'network_retry_count' variable IS set (with the line you added) in line 
493 which is right at the start of the 'getLoopPackets' function.
The next part of the process is to use the 'self.connectToWeatherStation()' 
function which originally only existed where the function call is located. 
However when I added the functionality to read the history data, I needed 
to connect to the weather station from several places and so I moved the 
code into a separate function. Of course that is when I forgot about the 
scope of the variable!
It also shows that my network is fairly reliable as I've obviously never 
triggered that error condition in my testing.
My apologies for the bugs and my thanks for helping me find them.
I'll update my repository tonight (hopefully).
Susan

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Receiving Davis Vantage weather data with a RTL-SDR dongle Update

2019-04-23 Thread rich T
Luc

A few showers came through this evening and everything is tracking the same 
between all consoles and the driver.  It probably was the some signal loss 
when the extremely heavy rains came through the other evening.

Rich 

On Tuesday, April 23, 2019 at 10:19:23 AM UTC-4, Luc Heijst wrote:

> On Sunday, 21 April 2019 01:54:08 UTC-3, rich T wrote:
>>
>> Not saying there is an issue, but just check it at your end.
>>
>
> Rich,
>
> Today it's very rainy in Paramaribo. Total 68.2 mm rain in the morning. 
> There is more rain expected this noon.
>
> Both meteostick and rtldavis show the same rain values.
>
> Luc
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Colin Larsen
With help from a friend I've got the data txt file sorted into the right
format so hopefully this will be easy from here.

I assume I still need some 'units' detail somewhere along the line in the
[FilePile] stanza?

Cheers
Colin

On Wed, Apr 24, 2019 at 7:48 AM Colin Larsen  wrote:

> This is how the data is constructed and sent in Arduino, it's sent as a
> complete line of ascii data
>
> // - AQI Data for Weewx -
>
> Data = F("AQI25=");
> Data += String(AQI_Monitor.AQI_PM2_5 / 10.0);
> Data += F(",AQI100=");
> Data += String(AQI_Monitor.AQI_PM10_0 / 10.0);
> Data += F(",AQIIndex=");
> Data += String(AQI_Monitor.AQI_Index / 10);
> Data += F(",AQICO2=");
> Data += String(AQI_Monitor.GAS_1);
>
> Then sent using
>
> //  Send AQI Datapacket 
>  udp1.beginPacket(broadcastIP, AQI_BROADCAST_PORT);
>  udp1.write((const uint8_t*)Data.c_str(), strlen(Data.c_str()));
>  udp1.endPacket();
>  udp1.stop();
>
> So I'm unsure how to get line feeds in there instead of the comma
> delimiter.
>
> Seems it would be easier to look for the comma in the txt file :)
>
> Cheers
> Colin
>
> On Wed, Apr 24, 2019 at 7:31 AM Colin Larsen 
> wrote:
>
>> Ok that sure looks like it would do the job but with my file format I
>> would need to use "," as a delimiter between records rather than a new line
>> something like (borrowed from another similar utility). I have never done
>> Python so I'm a little lost on how to change this sorry
>>
>> with open(self.filename) as f:
>> for line,row in enumerate(f.readlines()):
>> if line == 0:
>> names = row.strip().split(",")
>> if line == 0:
>> units = row.strip().split(",")
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Apr 24, 2019 at 1:40 AM Thomas Keffer  wrote:
>>
>>> Because of the syntax, it's tempting to look at a ConfigObj file and
>>> think of it as assigning the right hand side to the left hand side. But,
>>> it's really not. It's a mapping. The left hand side *maps to* the right
>>> hand side.
>>>
>>> As a key:value comes in from the file, we need to know what to do with
>>> the key. Given a key, what WeeWX name do we assign it to? With a mapping,
>>> we look it up, then do the assignment to the value. If we did it the other
>>> way around, we'd have to search all the *values* in the mapping to find
>>> what it should be mapped to. That's backwards from the way dictionaries
>>> work.
>>>
>>> -tk
>>>
>>> On Tue, Apr 23, 2019 at 5:51 AM Andrew Milner <
>>> andrew.s.r.mil...@gmail.com> wrote:
>>>
 Tom
 Forgive me for being a pedant - but shouldn't the label map for
 filepile have the arguments the other way round
 ie rather than
  myVoltage = Supply Voltage
 it should be
  SupplyVoltage = myVoltage
 ie
   weewx destination field = source data field

 normally left of equals sign is the result of operations right of
 equals sign
 eg
   a = 3 + 2 would put 5 into a



 On Tuesday, 23 April 2019 14:45:38 UTC+3, Thomas Keffer wrote:
>
> Take a look at Filepile . It may
> do what you want, or help you write your own.
>
> -tk
>
> On Mon, Apr 22, 2019 at 7:43 PM  wrote:
>
>> Hi all
>>
>> I have devised a method to export my Air Quality Data (AQI) from my
>> Arduino based weather station to Weewx (it can't be sent via the usb port
>> with the rest of the data). It involves sending the data via a UDP
>> broadcast packet from the station, this is then captured by a small 
>> Python
>> script on my Weewx Pi and written to a txt file.
>>
>> The txt file data looks like this
>> AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967
>>
>> From the Weewx wiki I have crafted the beginning of a service to
>> import the data to my Wewwx database (extended with the 4 new data 
>> fields)
>> but I'm not sure how to complete that task. So far I have this, which I
>> think will grab the first value - how do I parse the other 3? Is it as
>> simple as just adding more lines such as event.record['AQI100'] =
>> float(value) etc?
>>
>> *import* syslog
>>
>> *import* weewx
>>
>> *from* weewx.wxengine *import* StdService
>>
>>
>> *class* WDAQIService(StdService):
>>
>> *def** __init__*(self, engine, config_dict):
>>
>> super(WDAQIService, self).__init__(engine, config_dict)
>>
>> d = config_dict.get(*'WDAQIService'*, {})
>>
>> self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)
>>
>> syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* %
>> self.filename)
>>
>> self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
>>
>>
>> *def** read_file*(self, event):
>>
>> *try*:
>>
>> *with* open(self.filename) *as* f:
>>
>> value = f.read()

Re: [weewx-user] Support for upload to Windy

2019-04-23 Thread G Hammer


On Tuesday, April 23, 2019 at 7:22:09 PM UTC-4, mwall wrote:
>
> On Tuesday, April 23, 2019 at 11:13:35 AM UTC-4, G Hammer wrote:
>>
>> So, just how long is a Windy API key?
>> I signed up for one, installed Windy 0.3 from github, seems to not like 
>> the station ID.
>>
>
> the windy.com api specifies an integer station identifier.  you should 
> only have to specify the station id if you have multiple stations.  also, 
> there seems to be no provision for multiple stations when using the GET api.
>
> anyway, weewx-windy 0.4 defaults to station id of 0, so you should not 
> have to worry about it unless you are uploading to multiple stations.
>
> m
>  
>

Thank you for the change removing the station value.
All is working well now.
Still curious as to why my SDR driver had problems when I misconfigured 
windy.
 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] MQTT client service - proof of concept/alpha code

2019-04-23 Thread bellrichm
After experimenting and developing more, I decided this needs it own 
repository. You can now find it here, 
https://github.com/bellrichm/WeeWX-MQTTSubscribe

The service now supports binding to either new loop packets or new archive 
records. Since much of the code was similar to my MQTT driver, this has been 
added to the module. It is still a manual install process, but some 
documentation has been added.
-rich

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Support for upload to Windy

2019-04-23 Thread Tim Tuck

A Windy API key is looong

The station ID used by the windy 0.3 module is not the ID issued to you 
by windy.com


The station ID is 0 if you have only one reporting station.

If you have 2 more , their numbers would be 1 & 2.

An example of a JSON post with multiple station ID's looks like this...

|{ stations:[ {station:0, name:"My Home Station", lat:48.2, lon:28.6, 
elevation:80, tempheight:2, windheight:10}, {station:1, name:"My Other 
Station", "lat":47.1, lon:31.2, elevation:122, tempheight:2, 
windheight:8} ], |



details on reporting structure are here...

https://community.windy.com/topic/8168/report-you-weather-station-data-to-windy/2

The failure of your SDR driver might just be a side affect of this 
module failing.


Change your station ID to 0 and try again.

If your SDR driver fails after that it is most likely a separate problem.

regards

Tim






---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Support for upload to Windy

2019-04-23 Thread mwall
On Tuesday, April 23, 2019 at 11:13:35 AM UTC-4, G Hammer wrote:
>
> So, just how long is a Windy API key?
> I signed up for one, installed Windy 0.3 from github, seems to not like 
> the station ID.
>

the windy.com api specifies an integer station identifier.  you should only 
have to specify the station id if you have multiple stations.  also, there 
seems to be no provision for multiple stations when using the GET api.

anyway, weewx-windy 0.4 defaults to station id of 0, so you should not have 
to worry about it unless you are uploading to multiple stations.

m
 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: New sensor - WT0124 Pool Thermometer

2019-04-23 Thread Gazza


Thanks for that, I tried the file and there is no difference. The version 
of sdr.py I am using is 0.62.


Gary

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Colin Larsen
This is how the data is constructed and sent in Arduino, it's sent as a
complete line of ascii data

// - AQI Data for Weewx -

Data = F("AQI25=");
Data += String(AQI_Monitor.AQI_PM2_5 / 10.0);
Data += F(",AQI100=");
Data += String(AQI_Monitor.AQI_PM10_0 / 10.0);
Data += F(",AQIIndex=");
Data += String(AQI_Monitor.AQI_Index / 10);
Data += F(",AQICO2=");
Data += String(AQI_Monitor.GAS_1);

Then sent using

//  Send AQI Datapacket 
 udp1.beginPacket(broadcastIP, AQI_BROADCAST_PORT);
 udp1.write((const uint8_t*)Data.c_str(), strlen(Data.c_str()));
 udp1.endPacket();
 udp1.stop();

So I'm unsure how to get line feeds in there instead of the comma delimiter.

Seems it would be easier to look for the comma in the txt file :)

Cheers
Colin

On Wed, Apr 24, 2019 at 7:31 AM Colin Larsen  wrote:

> Ok that sure looks like it would do the job but with my file format I
> would need to use "," as a delimiter between records rather than a new line
> something like (borrowed from another similar utility). I have never done
> Python so I'm a little lost on how to change this sorry
>
> with open(self.filename) as f:
> for line,row in enumerate(f.readlines()):
> if line == 0:
> names = row.strip().split(",")
> if line == 0:
> units = row.strip().split(",")
>
>
>
>
>
>
>
> On Wed, Apr 24, 2019 at 1:40 AM Thomas Keffer  wrote:
>
>> Because of the syntax, it's tempting to look at a ConfigObj file and
>> think of it as assigning the right hand side to the left hand side. But,
>> it's really not. It's a mapping. The left hand side *maps to* the right
>> hand side.
>>
>> As a key:value comes in from the file, we need to know what to do with
>> the key. Given a key, what WeeWX name do we assign it to? With a mapping,
>> we look it up, then do the assignment to the value. If we did it the other
>> way around, we'd have to search all the *values* in the mapping to find
>> what it should be mapped to. That's backwards from the way dictionaries
>> work.
>>
>> -tk
>>
>> On Tue, Apr 23, 2019 at 5:51 AM Andrew Milner <
>> andrew.s.r.mil...@gmail.com> wrote:
>>
>>> Tom
>>> Forgive me for being a pedant - but shouldn't the label map for filepile
>>> have the arguments the other way round
>>> ie rather than
>>>  myVoltage = Supply Voltage
>>> it should be
>>>  SupplyVoltage = myVoltage
>>> ie
>>>   weewx destination field = source data field
>>>
>>> normally left of equals sign is the result of operations right of equals
>>> sign
>>> eg
>>>   a = 3 + 2 would put 5 into a
>>>
>>>
>>>
>>> On Tuesday, 23 April 2019 14:45:38 UTC+3, Thomas Keffer wrote:

 Take a look at Filepile . It may
 do what you want, or help you write your own.

 -tk

 On Mon, Apr 22, 2019 at 7:43 PM  wrote:

> Hi all
>
> I have devised a method to export my Air Quality Data (AQI) from my
> Arduino based weather station to Weewx (it can't be sent via the usb port
> with the rest of the data). It involves sending the data via a UDP
> broadcast packet from the station, this is then captured by a small Python
> script on my Weewx Pi and written to a txt file.
>
> The txt file data looks like this
> AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967
>
> From the Weewx wiki I have crafted the beginning of a service to
> import the data to my Wewwx database (extended with the 4 new data fields)
> but I'm not sure how to complete that task. So far I have this, which I
> think will grab the first value - how do I parse the other 3? Is it as
> simple as just adding more lines such as event.record['AQI100'] =
> float(value) etc?
>
> *import* syslog
>
> *import* weewx
>
> *from* weewx.wxengine *import* StdService
>
>
> *class* WDAQIService(StdService):
>
> *def** __init__*(self, engine, config_dict):
>
> super(WDAQIService, self).__init__(engine, config_dict)
>
> d = config_dict.get(*'WDAQIService'*, {})
>
> self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)
>
> syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* %
> self.filename)
>
> self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
>
>
> *def** read_file*(self, event):
>
> *try*:
>
> *with* open(self.filename) *as* f:
>
> value = f.read()
>
> syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found
> value of %s"* % value)
>
> event.record[*'AQI25'*] = float(value)
>
> *except* Exception *as* e:
>
> syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read
> value: %s"* % e)
>
> Thanks
> Colin
>
> --
> You received this message because you are subscribed to the Google
> Groups "weewx-user" group.

Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Colin Larsen
Ok that sure looks like it would do the job but with my file format I would
need to use "," as a delimiter between records rather than a new line
something like (borrowed from another similar utility). I have never done
Python so I'm a little lost on how to change this sorry

with open(self.filename) as f:
for line,row in enumerate(f.readlines()):
if line == 0:
names = row.strip().split(",")
if line == 0:
units = row.strip().split(",")







On Wed, Apr 24, 2019 at 1:40 AM Thomas Keffer  wrote:

> Because of the syntax, it's tempting to look at a ConfigObj file and think
> of it as assigning the right hand side to the left hand side. But, it's
> really not. It's a mapping. The left hand side *maps to* the right hand
> side.
>
> As a key:value comes in from the file, we need to know what to do with the
> key. Given a key, what WeeWX name do we assign it to? With a mapping, we
> look it up, then do the assignment to the value. If we did it the other way
> around, we'd have to search all the *values* in the mapping to find what
> it should be mapped to. That's backwards from the way dictionaries work.
>
> -tk
>
> On Tue, Apr 23, 2019 at 5:51 AM Andrew Milner 
> wrote:
>
>> Tom
>> Forgive me for being a pedant - but shouldn't the label map for filepile
>> have the arguments the other way round
>> ie rather than
>>  myVoltage = Supply Voltage
>> it should be
>>  SupplyVoltage = myVoltage
>> ie
>>   weewx destination field = source data field
>>
>> normally left of equals sign is the result of operations right of equals
>> sign
>> eg
>>   a = 3 + 2 would put 5 into a
>>
>>
>>
>> On Tuesday, 23 April 2019 14:45:38 UTC+3, Thomas Keffer wrote:
>>>
>>> Take a look at Filepile . It may
>>> do what you want, or help you write your own.
>>>
>>> -tk
>>>
>>> On Mon, Apr 22, 2019 at 7:43 PM  wrote:
>>>
 Hi all

 I have devised a method to export my Air Quality Data (AQI) from my
 Arduino based weather station to Weewx (it can't be sent via the usb port
 with the rest of the data). It involves sending the data via a UDP
 broadcast packet from the station, this is then captured by a small Python
 script on my Weewx Pi and written to a txt file.

 The txt file data looks like this
 AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967

 From the Weewx wiki I have crafted the beginning of a service to import
 the data to my Wewwx database (extended with the 4 new data fields) but I'm
 not sure how to complete that task. So far I have this, which I think will
 grab the first value - how do I parse the other 3? Is it as simple as just
 adding more lines such as event.record['AQI100'] = float(value) etc?

 *import* syslog

 *import* weewx

 *from* weewx.wxengine *import* StdService


 *class* WDAQIService(StdService):

 *def** __init__*(self, engine, config_dict):

 super(WDAQIService, self).__init__(engine, config_dict)

 d = config_dict.get(*'WDAQIService'*, {})

 self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)

 syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* %
 self.filename)

 self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)


 *def** read_file*(self, event):

 *try*:

 *with* open(self.filename) *as* f:

 value = f.read()

 syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found value
 of %s"* % value)

 event.record[*'AQI25'*] = float(value)

 *except* Exception *as* e:

 syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read
 value: %s"* % e)

 Thanks
 Colin

 --
 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...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit 

Re: [weewx-user] Support for upload to Windy

2019-04-23 Thread G Hammer
So, just how long is a Windy API key?
I signed up for one, installed Windy 0.3 from github, seems to not like the 
station ID.
As an additional problem, after installing windy 0.3 my working SDR driver 
is no longer working with WeeWX.

See attached files.


On Tuesday, April 23, 2019 at 1:55:57 AM UTC-4, Praveen Chandrasekaran 
wrote:
>
> Just saw that its already there:
>
> https://github.com/matthewwall/weewx-windy
>
> Great work!
>
> On Tue, 23 Apr 2019 at 11:21, Praveen Chandrasekaran  > wrote:
>
>> Windy is now accepting data from PWS.
>>
>> API details below:
>>
>> https://stations.windy.com/
>>
>> Would we be seeing a Weewx update soon to support this?
>>
>> -- 
>> 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/3nA3wxSBHKs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> weewx...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Apr 23 10:53:47 weewx1 weewx[20526]: restx: Windy: version is 0.3
Apr 23 10:53:47 weewx1 weewx[20526]: sdr: MainThread: shutdown process rtl_433 
-M utc -F json -p 39.741 -R 78 -f 91498
Apr 23 10:54:05 weewx1 weewx[20526]: sdr: MainThread: timed out waiting for 
stderr-thread
Apr 23 10:54:05 weewx1 weewx[20526]: engine: Caught unrecoverable exception in 
engine:
Apr 23 10:54:05 weewx1 weewx[20526]:   invalid literal for int() with 
base 10: 'f0750732'
Apr 23 10:54:05 weewx1 weewx[20526]:   Traceback (most recent call 
last):
Apr 23 10:54:05 weewx1 weewx[20526]: File 
"/home/weewx/bin/weewx/engine.py", line 884, in main
Apr 23 10:54:05 weewx1 weewx[20526]:   engine = 
engine_class(config_dict)
Apr 23 10:54:05 weewx1 weewx[20526]: File 
"/home/weewx/bin/weewx/engine.py", line 78, in __init__
Apr 23 10:54:05 weewx1 weewx[20526]:   
self.loadServices(config_dict)
Apr 23 10:54:05 weewx1 weewx[20526]: File 
"/home/weewx/bin/weewx/engine.py", line 142, in loadServices
Apr 23 10:54:05 weewx1 weewx[20526]:   
self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Apr 23 10:54:05 weewx1 weewx[20526]: File 
"/home/weewx/bin/user/windy.py", line 82, in __init__
Apr 23 10:54:05 weewx1 weewx[20526]:   **site_dict)
Apr 23 10:54:05 weewx1 weewx[20526]: File 
"/home/weewx/bin/user/windy.py", line 111, in __init__
Apr 23 10:54:05 weewx1 weewx[20526]:   self.station = int(station)
Apr 23 10:54:05 weewx1 weewx[20526]:   ValueError: invalid literal for 
int() with base 10: 'f0750732'
Apr 23 10:54:05 weewx1 weewx[20526]:   Exiting.

pr 23 10:55:11 weewx1 weewx[20662]: engine: Using configuration file 
/home/weewx/weewx.conf
Apr 23 10:55:11 weewx1 weewx[20662]: engine: Loading station type SDR (user.sdr)
Apr 23 10:55:11 weewx1 weewx[20647]:...done.
Apr 23 10:55:11 weewx1 systemd[1]: Started LSB: weewx weather system.
Apr 23 10:55:11 weewx1 weewx[20662]: sdr: MainThread: driver version is 0.58

Apr 23 10:55:11 weewx1 weewx[20662]: sdr: MainThread: startup process 'rtl_433 
-M utc -F json -p 39.741 -R 78 -f 91498'


pr 23 10:56:38 weewx1 weewx[20662]: sdr: MainThread: err: []
Apr 23 10:56:38 weewx1 weewx[20662]: engine: Main loop exiting. Shutting engine 
down.
Apr 23 10:56:38 weewx1 weewx[20662]: sdr: MainThread: shutdown process rtl_433 
-M utc -F json -p 39.741 -R 78 -f 91498
Apr 23 10:56:38 weewx1 weewx[20662]: engine: Caught WeeWxIOError: rtl_433 
process is not running
Apr 23 10:56:38 weewx1 weewx[20662]:   Waiting 60 seconds then retrying.




[weewx-user] Re: Crash with log info

2019-04-23 Thread Ron
I had another crash of the HP1000 driver yesterday. I made a change which 
will hopefully fix it in the future which was to add
>
> network_retry_count = self.max_retry
>
before the try enclosing line 324. I guess my setup is good for testing 
error conditions! I committed to my HP1000 repo. I still need to remove the 
superfluous login() calls from my copy though.

The exception details were

> HP1000: Timed out too many times

Apr 22 16:36:07 AllenWeather weewx[6000]: engine: Main loop exiting. 
> Shutting engine down.

Apr 22 16:36:07 AllenWeather weewx[6000]: engine: Shutting down StdReport 
> thread

Apr 22 16:36:07 AllenWeather weewx[6000]: engine: StdReport thread has been 
> terminated

Apr 22 16:36:07 AllenWeather weewx[6000]: restx: Shut down CWOP thread.

Apr 22 16:36:07 AllenWeather weewx[6000]: restx: Shut down StationRegistry 
> thread.

Apr 22 16:36:07 AllenWeather weewx[6000]: engine: Caught unrecoverable 
> exception in engine:

Apr 22 16:36:07 AllenWeather weewx[6000]:   local variable 
> 'network_retry_count' referenced before assignment

Apr 22 16:36:07 AllenWeather weewx[6000]:   Traceback (most recent 
> call last):

Apr 22 16:36:07 AllenWeather weewx[6000]: File 
> "/usr/share/weewx/weewx/engine.py", line 890, in main

Apr 22 16:36:07 AllenWeather weewx[6000]:   engine.run()

Apr 22 16:36:07 AllenWeather weewx[6000]: File 
> "/usr/share/weewx/weewx/engine.py", line 188, in run

Apr 22 16:36:07 AllenWeather weewx[6000]:   for packet in 
> self.console.genLoopPackets():

Apr 22 16:36:07 AllenWeather weewx[6000]: File 
> "/usr/share/weewx/user/HP1000.py", line 497, in genLoopPackets

Apr 22 16:36:07 AllenWeather weewx[6000]:  
>  self.connectToWeatherStation()

Apr 22 16:36:07 AllenWeather weewx[6000]: File 
> "/usr/share/weewx/user/HP1000.py", line 324, in connectToWeatherStation

Apr 22 16:36:07 AllenWeather weewx[6000]:   network_retry_count 
> -= 1

Apr 22 16:36:07 AllenWeather weewx[6000]:   UnboundLocalError: 
> local variable 'network_retry_count' referenced before assignment

Apr 22 16:36:07 AllenWeather weewx[6000]:   Exiting.

 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Receiving Davis Vantage weather data with a RTL-SDR dongle Update

2019-04-23 Thread Luc Heijst
On Sunday, 21 April 2019 01:54:08 UTC-3, rich T wrote:
>
> Not saying there is an issue, but just check it at your end.
>

Rich,

Today it's very rainy in Paramaribo. Total 68.2 mm rain in the morning. 
There is more rain expected this noon.

Both meteostick and rtldavis show the same rain values.

Luc

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] New sensor - WT0124 Pool Thermometer

2019-04-23 Thread Andy
>From here .

Try this untested

Andy



-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env python
# Copyright 2016-2017 Matthew Wall
# Distributed under the terms of the GNU Public License (GPLv3)
"""
Collect data from stl-sdr.  Run rtl_433 on a thread and push the output onto
a queue.

The SDR detects many different sensors and sensor types, so this driver
includes a mechanism to filter the incoming data, and to map the filtered
data onto the weewx database schema and identify the type of data from each
sensor.

Sensors are filtered based on a tuple that identifies uniquely each sensor.
A tuple consists of the observation name, a unique identifier for the hardware,
and the packet type, separated by periods:

  ..

The filter and data types are specified in a sensor_map stanza in the driver
stanza.  For example:

[SDR]
driver = user.sdr
[[sensor_map]]
inTemp = temperature.25A6.AcuriteTowerPacket
outTemp = temperature.24A4.AcuriteTowerPacket
rain_total = rain_total.A52B.Acurite5n1Packet

If no sensor_map is specified, no data will be collected.

The deltas stanza indicates which observations are cumulative measures and
how they should be split into delta measures.

[SDR]
...
[[deltas]]
rain = rain_total

In this case, the value for rain will be a delta calculated from sequential
rain_total observations.

To identify sensors, run the driver directly.  Alternatively, use the options
log_unknown_sensors and log_unmapped_sensors to see data from the SDR that are
not yet recognized by your configuration.

[SDR]
driver = user.sdr
log_unknown_sensors = True
log_unmapped_sensors = True

The default for each of these is False.

Eventually we would prefer to have all rtl_433 output as json.  Unfortunately,
many of the rtl_433 decoders do not emit this format yet (as of January 2017).
So this driver is designed to look for json first, then fall back to single-
or multi-line plain text format.

WARNING: Handling of units and unit systems in rtl_433 is a mess, but it is
getting better.  Although there is an option to request SI units, there is no
indicate in the decoder output whether that option is respected, nor does
rtl_433 specify exactly which SI units are used for various types of measure.
There seems to be a pattern of appending a unit label to the observation name
in the JSON data, for example 'wind_speed_mph' instead of just 'wind_speed'.
"""

from __future__ import with_statement
from calendar import timegm
import Queue
import fnmatch
import os
import re
import subprocess
import syslog
import threading
import time

try:
import cjson as json
setattr(json, 'dumps', json.encode)
setattr(json, 'loads', json.decode)
except (ImportError, AttributeError):
try:
import simplejson as json
except ImportError:
import json

import weewx.drivers
import weewx.units
from weeutil.weeutil import tobool


DRIVER_NAME = 'SDR'
DRIVER_VERSION = '0.62'

# The default command requests json output from every decoder
# -q - suppress non-data messages (for older versions of rtl_433)
# -M utc - print timestamps in UTC (-U for older versions of rtl_433)
# -F json - emit data in json format (not all rtl_433 decoders support this)
# -G - emit data for all rtl decoders (only available in newer rtl_433)
# Use the -R option instead of -G to indicate specific decoders.
#DEFAULT_CMD = 'rtl_433 -q -U -F json -G'
# as of 18.12-60-gccbc568 branch master at 201812311225
DEFAULT_CMD = 'rtl_433 -M utc -F json -G'


def loader(config_dict, _):
return SDRDriver(**config_dict[DRIVER_NAME])

def confeditor_loader():
return SDRConfigurationEditor()


def logmsg(level, msg):
syslog.syslog(level, 'sdr: %s: %s' %
  (threading.currentThread().getName(), msg))

def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)

def loginf(msg):
logmsg(syslog.LOG_INFO, msg)

def logerr(msg):
logmsg(syslog.LOG_ERR, msg)


class AsyncReader(threading.Thread):

def __init__(self, fd, queue, label):
threading.Thread.__init__(self)
self._fd = fd
self._queue = queue
self._running = False
self.setDaemon(True)
self.setName(label)

def run(self):
logdbg("start async reader for %s" % self.getName())
self._running = True
for line in iter(self._fd.readline, ''):
self._queue.put(line)
if not self._running:
break

def stop_running(self):
self._running = False


class ProcManager():
TS = re.compile('^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d[\s]+')

def __init__(self):
self._cmd = None
self._process = None

Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Thomas Keffer
Because of the syntax, it's tempting to look at a ConfigObj file and think
of it as assigning the right hand side to the left hand side. But, it's
really not. It's a mapping. The left hand side *maps to* the right hand
side.

As a key:value comes in from the file, we need to know what to do with the
key. Given a key, what WeeWX name do we assign it to? With a mapping, we
look it up, then do the assignment to the value. If we did it the other way
around, we'd have to search all the *values* in the mapping to find what it
should be mapped to. That's backwards from the way dictionaries work.

-tk

On Tue, Apr 23, 2019 at 5:51 AM Andrew Milner 
wrote:

> Tom
> Forgive me for being a pedant - but shouldn't the label map for filepile
> have the arguments the other way round
> ie rather than
>  myVoltage = Supply Voltage
> it should be
>  SupplyVoltage = myVoltage
> ie
>   weewx destination field = source data field
>
> normally left of equals sign is the result of operations right of equals
> sign
> eg
>   a = 3 + 2 would put 5 into a
>
>
>
> On Tuesday, 23 April 2019 14:45:38 UTC+3, Thomas Keffer wrote:
>>
>> Take a look at Filepile . It may do
>> what you want, or help you write your own.
>>
>> -tk
>>
>> On Mon, Apr 22, 2019 at 7:43 PM  wrote:
>>
>>> Hi all
>>>
>>> I have devised a method to export my Air Quality Data (AQI) from my
>>> Arduino based weather station to Weewx (it can't be sent via the usb port
>>> with the rest of the data). It involves sending the data via a UDP
>>> broadcast packet from the station, this is then captured by a small Python
>>> script on my Weewx Pi and written to a txt file.
>>>
>>> The txt file data looks like this
>>> AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967
>>>
>>> From the Weewx wiki I have crafted the beginning of a service to import
>>> the data to my Wewwx database (extended with the 4 new data fields) but I'm
>>> not sure how to complete that task. So far I have this, which I think will
>>> grab the first value - how do I parse the other 3? Is it as simple as just
>>> adding more lines such as event.record['AQI100'] = float(value) etc?
>>>
>>> *import* syslog
>>>
>>> *import* weewx
>>>
>>> *from* weewx.wxengine *import* StdService
>>>
>>>
>>> *class* WDAQIService(StdService):
>>>
>>> *def** __init__*(self, engine, config_dict):
>>>
>>> super(WDAQIService, self).__init__(engine, config_dict)
>>>
>>> d = config_dict.get(*'WDAQIService'*, {})
>>>
>>> self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)
>>>
>>> syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* %
>>> self.filename)
>>>
>>> self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
>>>
>>>
>>> *def** read_file*(self, event):
>>>
>>> *try*:
>>>
>>> *with* open(self.filename) *as* f:
>>>
>>> value = f.read()
>>>
>>> syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found value
>>> of %s"* % value)
>>>
>>> event.record[*'AQI25'*] = float(value)
>>>
>>> *except* Exception *as* e:
>>>
>>> syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read
>>> value: %s"* % e)
>>>
>>> Thanks
>>> Colin
>>>
>>> --
>>> 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...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Interceptor not sniffing packets, router configured correctly

2019-04-23 Thread Kev D
The goal is to continue to send to wu while sniffing from weewx. I had the 
router configured to the point where anything from the weather station IP 
was sent to the observer and still would not sniff (WU site even had it 
showing offline because of this). Maybe I should go the DNS hijack route 
then just have weewx send the data to wu. Would this mean I need to change 
the observer to listen mode rather than sniff?

Thanks,

Kev

On Tuesday, April 23, 2019 at 9:24:17 AM UTC-4, mwall wrote:
>
>
>
> On Monday, April 22, 2019 at 3:09:22 PM UTC-4, Kev D wrote:
>>
>> I am confident that the router is configured properly, but no matter what 
>> I try I simply cannot get the interceptor driver to capture any data. On a 
>> side note, I am also running PIHole on this device, but I had changed the 
>> admin console listening port away from port 80. Does anyone have any ideas 
>> for me? 
>>
>
> do you want the observer to send directly to wu, with weewx just sniffing?
>
> or do you want the observer to send directly to weewx?
>
> if you want the former, then the interceptor should be in sniff mode, and 
> you need to configure the router so that weewx can see the traffic from the 
> observer.
>
> if you want the latter, then you need to hijack dns so that queries for 
> the weather underground servers resolve to the machine running weewx.
>
> m 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Interceptor not sniffing packets, router configured correctly

2019-04-23 Thread mwall


On Monday, April 22, 2019 at 3:09:22 PM UTC-4, Kev D wrote:
>
> I am confident that the router is configured properly, but no matter what 
> I try I simply cannot get the interceptor driver to capture any data. On a 
> side note, I am also running PIHole on this device, but I had changed the 
> admin console listening port away from port 80. Does anyone have any ideas 
> for me? 
>

do you want the observer to send directly to wu, with weewx just sniffing?

or do you want the observer to send directly to weewx?

if you want the former, then the interceptor should be in sniff mode, and 
you need to configure the router so that weewx can see the traffic from the 
observer.

if you want the latter, then you need to hijack dns so that queries for the 
weather underground servers resolve to the machine running weewx.

m 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Re: weewx stop working

2019-04-23 Thread Leon Shaner
Damian,

These logs still do not state debug = 1.
It still could be that the weewx.conf isn't being parsed correctly, and isn't 
even able to read the debug = 1 setting.

Did you try my suggestions for how to "rebuild" the conf file?

Regards,
Leon
--
Leon Shaner :: Dearborn, Michigan (iPhone)


> On Apr 23, 2019, at 8:45 AM, Damjan Hajsek  wrote:
> 
> Hi
> I have followed your instruction so I did all as described
> first turn off monit
> stop weewx
> debug = 1 was already set
> than I run weewx manually
> here is a log from that
> 
> http://zerobin.povej.net/?a63b7ac09e222bcc#9Y5+B9WWtxXgUJWTKZWmzElusp9QRgEK5Pde606SvQc=
> 
> http://zerobin.povej.net/?7d382c267025fd54#0p/b4Z0y5k7U3qFc8T/2Sgl0CbbU8ZkYxdSFCRh/I4I=
> 
> 
> Dne nedelja, 21. april 2019 15.41.04 UTC+2 je oseba mwall napisala:
>> 
>> at this point in the thread it is not clear what is happening or what is the 
>> state of your system.
>> 
>> so start over and explain what your configuration looks like now
>> 
>> then, to diagnose weewx, do the following:
>> 
>> - remove whatever it is that keeps restarting weewx
>> - stop weewx if it is running
>> - set debug=1 in your weewx configuration
>> - run weewx directly, not as a daemon
>> - if weewx crashes, post (1) the log prior to the crash, (2) the stack trace 
>> or other output from the console in which you started it
>> 
>> m
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Re: weewx stop working

2019-04-23 Thread mwall
the logs that you posted do not have debug enabled

the logs that you posted do not show any crashes - they show you starting 
and stopping weewx 9 times.

why do you keep killing weewx?

you must do the following:

1 - set debug=1 in /etc/weewx/weewx.conf
2 - start weewx manually, i.e., 'sudo weewxd /etc/weewx/weewx.conf'
3 - let weewx run until it crashes
4 - when (if) weewx crashes,
4a - post the log from a few minutes prior to the crash up to the crash
4b - post the output from the console in which you ran weewx manually


On Tuesday, April 23, 2019 at 8:45:29 AM UTC-4, Damjan Hajsek wrote:
>
> Hi
> I have followed your instruction so I did all as described
> first turn off monit
> stop weewx
> debug = 1 was already set
> than I run weewx manually
> here is a log from that
>
>
> http://zerobin.povej.net/?a63b7ac09e222bcc#9Y5+B9WWtxXgUJWTKZWmzElusp9QRgEK5Pde606SvQc=
>
>
> http://zerobin.povej.net/?7d382c267025fd54#0p/b4Z0y5k7U3qFc8T/2Sgl0CbbU8ZkYxdSFCRh/I4I=
>

 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Andrew Milner
Tom
Forgive me for being a pedant - but shouldn't the label map for filepile 
have the arguments the other way round
ie rather than 
 myVoltage = Supply Voltage
it should be
 SupplyVoltage = myVoltage
ie
  weewx destination field = source data field

normally left of equals sign is the result of operations right of equals 
sign
eg
  a = 3 + 2 would put 5 into a



On Tuesday, 23 April 2019 14:45:38 UTC+3, Thomas Keffer wrote:
>
> Take a look at Filepile . It may do 
> what you want, or help you write your own.
>
> -tk
>
> On Mon, Apr 22, 2019 at 7:43 PM > wrote:
>
>> Hi all
>>
>> I have devised a method to export my Air Quality Data (AQI) from my 
>> Arduino based weather station to Weewx (it can't be sent via the usb port 
>> with the rest of the data). It involves sending the data via a UDP 
>> broadcast packet from the station, this is then captured by a small Python 
>> script on my Weewx Pi and written to a txt file.
>>
>> The txt file data looks like this 
>> AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967
>>
>> From the Weewx wiki I have crafted the beginning of a service to import 
>> the data to my Wewwx database (extended with the 4 new data fields) but I'm 
>> not sure how to complete that task. So far I have this, which I think will 
>> grab the first value - how do I parse the other 3? Is it as simple as just 
>> adding more lines such as event.record['AQI100'] = float(value) etc?
>>
>> *import* syslog
>>
>> *import* weewx
>>
>> *from* weewx.wxengine *import* StdService
>>
>>
>> *class* WDAQIService(StdService):
>>
>> *def** __init__*(self, engine, config_dict):
>>
>> super(WDAQIService, self).__init__(engine, config_dict)  
>>
>> d = config_dict.get(*'WDAQIService'*, {})
>>
>> self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)
>>
>> syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* % 
>> self.filename)
>>
>> self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
>>
>>
>> *def** read_file*(self, event):
>>
>> *try*:
>>
>> *with* open(self.filename) *as* f:
>>
>> value = f.read()
>>
>> syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found value 
>> of %s"* % value)
>>
>> event.record[*'AQI25'*] = float(value)
>>
>> *except* Exception *as* e:
>>
>> syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read 
>> value: %s"* % e)
>>
>> Thanks
>> Colin
>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Re: weewx stop working

2019-04-23 Thread Damjan Hajsek
Hi
I have followed your instruction so I did all as described
first turn off monit
stop weewx
debug = 1 was already set
than I run weewx manually
here is a log from that

http://zerobin.povej.net/?a63b7ac09e222bcc#9Y5+B9WWtxXgUJWTKZWmzElusp9QRgEK5Pde606SvQc=

http://zerobin.povej.net/?7d382c267025fd54#0p/b4Z0y5k7U3qFc8T/2Sgl0CbbU8ZkYxdSFCRh/I4I=


Dne nedelja, 21. april 2019 15.41.04 UTC+2 je oseba mwall napisala:
>
> at this point in the thread it is not clear what is happening or what is 
> the state of your system.
>
> so start over and explain what your configuration looks like now
>
> then, to diagnose weewx, do the following:
>
> - remove whatever it is that keeps restarting weewx
> - stop weewx if it is running
> - set debug=1 in your weewx configuration
> - run weewx directly, not as a daemon
> - if weewx crashes, post (1) the log prior to the crash, (2) the stack 
> trace or other output from the console in which you started it
>
> m
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [weewx-user] Help creating a service to import data from file

2019-04-23 Thread Thomas Keffer
Take a look at Filepile . It may do
what you want, or help you write your own.

-tk

On Mon, Apr 22, 2019 at 7:43 PM  wrote:

> Hi all
>
> I have devised a method to export my Air Quality Data (AQI) from my
> Arduino based weather station to Weewx (it can't be sent via the usb port
> with the rest of the data). It involves sending the data via a UDP
> broadcast packet from the station, this is then captured by a small Python
> script on my Weewx Pi and written to a txt file.
>
> The txt file data looks like this
> AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967
>
> From the Weewx wiki I have crafted the beginning of a service to import
> the data to my Wewwx database (extended with the 4 new data fields) but I'm
> not sure how to complete that task. So far I have this, which I think will
> grab the first value - how do I parse the other 3? Is it as simple as just
> adding more lines such as event.record['AQI100'] = float(value) etc?
>
> *import* syslog
>
> *import* weewx
>
> *from* weewx.wxengine *import* StdService
>
>
> *class* WDAQIService(StdService):
>
> *def** __init__*(self, engine, config_dict):
>
> super(WDAQIService, self).__init__(engine, config_dict)
>
> d = config_dict.get(*'WDAQIService'*, {})
>
> self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*)
>
> syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* %
> self.filename)
>
> self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
>
>
> *def** read_file*(self, event):
>
> *try*:
>
> *with* open(self.filename) *as* f:
>
> value = f.read()
>
> syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found value of
> %s"* % value)
>
> event.record[*'AQI25'*] = float(value)
>
> *except* Exception *as* e:
>
> syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read
> value: %s"* % e)
>
> Thanks
> Colin
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.