Driver SDR

738 views
Skip to first unread message

Marco Tibaldi

unread,
Sep 8, 2016, 3:20:58 PM9/8/16
to weewx-user

Good evening everyone, I'm ' trying to use the SDR driver of Matt Wall changed today. the weewx web page updates to display the correct date and time , but do not get any value in the conditions .

this is an exctract of the log:

Sep 8 21:07:00 SDR weewx[1034]: cheetahgenerator: Generated 14 files for report StandardReport in 2.80 seconds Sep 8 21:07:04 SDR weewx[1034]: genimages: Generated 24 images for StandardReport in 3.85 seconds Sep 8 21:07:04 SDR weewx[1034]: reportengine: copied 0 files to /var/www/weewx Sep 8 21:09:06 SDR weewx[1034]: manager: unable to add record 2016-09-08 23:05:00 CEST (1473368700) to database 'weewx.sdb': UNIQUE constraint failed: archive.dateTime Sep 8 21:09:06 SDR weewx[1034]: manager: unable to add record 2016-09-08 23:05:00 CEST (1473368700) to database 'weewx.sdb': UNIQUE constraint failed: archive.dateTime Sep 8 21:09:07 SDR weewx[1034]: manager: unable to add record 2016-09-08 23:05:00 CEST (1473368700) to database 'weewx.sdb': UNIQUE constraint failed: archive.dateTime Sep 8 21:09:08 SDR weewx[1034]: cheetahgenerator: Generated 14 files for report StandardReport in 2.56 seconds Sep 8 21:09:12 SDR weewx[1034]: genimages: Generated 24 images for StandardReport in 3.88 seconds Sep 8 21:09:12 SDR weewx[1034]: reportengine: copied 0 files to /var/www/weewx

Any idea?




mwall

unread,
Sep 8, 2016, 4:54:02 PM9/8/16
to weewx-user
On Thursday, September 8, 2016 at 3:20:58 PM UTC-4, Marco Tibaldi wrote:

Good evening everyone, I'm ' trying to use the SDR driver of Matt Wall changed today. the weewx web page updates to display the correct date and time , but do not get any value in the conditions .

you need to define a sensor map in the [SDR] stanza in weewx.conf (you should also do another pull). for example, if you want to capture data from a fine offset instrument cluster, do something like this:

[SDR]
    driver = user.sdr
    [[sensor_map]]
        wind_gust.0026.FOWH1080Packet = windGust
        battery.0026.FOWH1080Packet = outBatteryStatus
        total_rain.0026.FOWH1080Packet = rain
        wind_speed.0026.FOWH1080Packet = windSpeed
        wind_dir.0026.FOWH1080Packet = windDir
        humidity.0026.FOWH1080Packet = outHumidity
        temperature.0026.FOWH1080Packet = outTemp

if you have some acurite sensors, do something like this:

[SDR]
    driver = user.sdr
    [[sensor_map]]
        wind_dir.0BFA.Acurite5n1Packet = windDir
        wind_speed.0BFA.Acurite5n1Packet = windSpeed
        temperature.0BFA.Acurite5n1Packet = outTemp
        humidity.0BFA.Acurite5n1Packet = outHumidity
        temperature.24A4.AcuriteTowerPacket = inTemp
        humidity.24A4.AcuriteTowerPacket = inHumidity

the left-hand side is a tuple with observation_name.sensor_id.packet_type

you can use * as wildcard for any part of the tuple.

details and examples in the readme.txt

to see what your sdr is reporting, first run the driver directly like this:

PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/sdr.py

or set debug=1 in weewx.conf and look at all of the raw output from all the sensors that your sdr can detect.

m

Marco Tibaldi

unread,
Sep 8, 2016, 5:22:35 PM9/8/16
to weewx-user
thanks for the reply, i'm testing on la-cross ws2350,
have you a trace for this meteo station sensor?
thanks a lot Matt !

M. 

mwall

unread,
Sep 8, 2016, 5:47:57 PM9/8/16
to weewx-user
On Thursday, September 8, 2016 at 5:22:35 PM UTC-4, Marco Tibaldi wrote:
thanks for the reply, i'm testing on la-cross ws2350,
have you a trace for this meteo station sensor?

this is the output i have for lacrosse ws23xx:

    # 2016-09-08 00:43:52 :LaCrosse WS :9 :202                                 
    # Temperature: 21.0 C                                                      
    # 2016-09-08 00:43:53 :LaCrosse WS :9 :202                                 
    # Humidity: 92                                                             
    # 2016-09-08 00:43:53 :LaCrosse WS :9 :202                                 
    # Wind speed: 0.0 m/s                                                      
    # Direction: 67.500                                                        

if you get something else, please post it.  in particular, i would be interested to see what values you get after the 'LaCrosse WS' string - the :9 and :202 in the example above.

m

Marco Tibaldi

unread,
Sep 8, 2016, 5:56:42 PM9/8/16
to weewx-user
i show the log.
 
you mean this?


Sep  8 23:38:35 SDR weewx[1034]: sdr: MainThread: lines=[]
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: lines=['2016-09-08 23:38:41 :\tLaCrosse WS \t:\t9 \t:\t34\n', '\tTemperature:\t 25.3 C\n']
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: ts=1473377921 payload=LaCrosse WS #011:#0119 #011:#01134
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: pkt={'temperature.9:34.LaCrossePacket': 25.3, 'usUnits': 17, 'dateTime': 1473377921}
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: packet={'temperature.9:34.LaCrossePacket': 25.3, 'usUnits': 17, 'dateTime': 1473377921}
Sep  8 23:38:41 SDR weewx[1034]: reportengine: Running reports for latest time in the database.
Sep  8 23:38:41 SDR weewx[1034]: reportengine: Running report StandardReport
Sep  8 23:38:41 SDR weewx[1034]: reportengine: Found configuration file /etc/weewx/skins/Standard/skin.conf for report StandardReport
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: lines=['\tHumidity:\t 52\n']
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: ts=None payload=None
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: unhandled message format: ts=None payload=None
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: lines=['2016-09-08 23:38:42 :\tLaCrosse WS \t:\t9 \t:\t34\n', '\tWind speed:\t 0.0 m/s\n', '\tDirection:\t 247.500\n']
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: ts=1473377922 payload=LaCrosse WS #011:#0119 #011:#01134
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: pkt={'wind_speed.9:34.LaCrossePacket': 0.0, 'wind_dir.9:34.LaCrossePacket': 247.5, 'usUnits': 17, 'dateTime': 1473377922}
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: packet={'wind_speed.9:34.LaCrossePacket': 0.0, 'wind_dir.9:34.LaCrossePacket': 247.5, 'usUnits': 17, 'dateTime': 1473377922}
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: lines=['\tTemperature:\t 25.3 C\n']
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: ts=None payload=None
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: unhandled message format: ts=None payload=None
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: lines=['2016-09-08 23:38:42 :\tLaCrosse WS \t:\t9 \t:\t34\n', '\tHumidity:\t 52\n']
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: ts=1473377922 payload=LaCrosse WS #011:#0119 #011:#01134
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: pkt={'humidity.9:34.LaCrossePacket': 52, 'usUnits': 17, 'dateTime': 1473377922}
Sep  8 23:38:42 SDR weewx[1034]: sdr: MainThread: packet={'humidity.9:34.LaCrossePacket': 52, 'usUnits': 17, 'dateTime': 1473377922}
Sep  8 23:38:49 SDR weewx[1034]: cheetahgenerator: Generated 14 files for report StandardReport in 7.09 seconds
Sep  8 23:38:52 SDR weewx[1034]: sdr: MainThread: lines=['\tWind speed:\t 0.0 m/s\n', '\tDirection:\t 247.500\n']
Sep  8 23:38:52 SDR weewx[1034]: sdr: MainThread: ts=None payload=None
Sep  8 23:38:52 SDR weewx[1034]: sdr: MainThread: unhandled message format: ts=None payload=None
Sep  8 23:38:53 SDR weewx[1034]: genimages: Generated 24 images for StandardReport in 3.92 seconds
Sep  8 23:38:53 SDR weewx[1034]: reportengine: copied 9 files to /var/www/weewx
Sep  8 23:38:53 SDR weewx[1034]: reportengine: Running report FTP 

mwall

unread,
Sep 8, 2016, 6:15:28 PM9/8/16
to weewx-user
On Thursday, September 8, 2016 at 5:56:42 PM UTC-4, Marco Tibaldi wrote:
Sep  8 23:38:35 SDR weewx[1034]: sdr: MainThread: lines=[]
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: lines=['2016-09-08 23:38:41 :\tLaCrosse WS \t:\t9 \t:\t34\n', '\tTemperature:\t 25.3 C\n']
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: ts=1473377921 payload=LaCrosse WS #011:#0119 #011:#01134
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: pkt={'temperature.9:34.LaCrossePacket': 25.3, 'usUnits': 17, 'dateTime': 1473377921}
Sep  8 23:38:41 SDR weewx[1034]: sdr: MainThread: packet={'temperature.9:34.LaCrossePacket': 25.3, 'usUnits': 17, 'dateTime': 1473377921}

your sensor cluster is emitting :9 and :34

what kind of hardware are you running on?  the driver is getting some of the rtl_433 output, but some of the output is getting split up.  rtl_433 spits out lines of data without a standard format.  so the driver has to guess to figure out where output from one sensor ends and output from another begins.  this is complicated by the fact that it is done asynchronously - there is one thread that runs the rtl_433 binary and captures its output, while the weewx main thread waits on a queue for the output lines.

this is how to debug things.  at the lowest level you run rtl_433 directly:

sudo rtl_433

that will spit out data from sensors as the sdr hardware receives them.

next up is to run the driver directly:

PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/sdr.py

that will spit out the data with all recognized data tagged with identifiers ready for mapping to database fields.  it also flags any sensor output that is not recognized by the driver.

finally, you can run weewxd directly:

sudo weewxd weewx.conf

that will spit out the data mapped to the database fields in weewx.

m

Marco Tibaldi

unread,
Sep 8, 2016, 6:41:23 PM9/8/16
to weewx-user
it's works!
only the time is ahead by 2 hours exactly ..... ?!?
i have made this mods on weewx.conf for lacrosse sensor:


[SDR]
    # This section is for the software-defined radio driver.
    
    # The driver to use
    driver = user.sdr
    cmd = /usr/local/bin/rtl_433
    
    [[sensor_map]]
        wind_gust.9:34.LaCrossePacket = windGust
        Rainfall.9:34.LaCrossePacket = rain
        wind_speed.9:34.LaCrossePacket = windSpeed
        wind_dir.9:34.LaCrossePacket = windDir
        humidity.9:34.LaCrossePacket = outHumidity
        temperature.9:34.LaCrossePacket = outTemp

and this is the result in web page !!  yeah!

Current Conditions
Outside Temperature25,2°C
Wind Chill25,2°C
Heat Index25,2°C
Dewpoint14,9°C
Humidity53%
Barometer N/A
Barometer Trend (3 hours) N/A
Wind0,0 m/s from N/A (N/A)
Rain Rate0,0 mm/hr
Inside Temperature N/A

any idea for the time?
the raspberry time is correct.
 

mwall

unread,
Sep 8, 2016, 6:53:46 PM9/8/16
to weewx-user
On Thursday, September 8, 2016 at 6:41:23 PM UTC-4, Marco Tibaldi wrote:
it's works!
only the time is ahead by 2 hours exactly ..... ?!?

check the times in the output when you run rtl_433 directly

check the timezone setting on the pi

the driver gets the timestamps from rtl_433

Marco Tibaldi

unread,
Sep 9, 2016, 8:00:11 AM9/9/16
to weewx-user
Matt, just to understand:
with your driver is sufficient to map the output of the sensors and make them coincide with the database tables?
and,
with this method it is possible to map unknown sensors ?

mwall

unread,
Sep 9, 2016, 10:02:22 AM9/9/16
to weewx-user


On Friday, September 9, 2016 at 8:00:11 AM UTC-4, Marco Tibaldi wrote:
Matt, just to understand:
with your driver is sufficient to map the output of the sensors and make them coincide with the database tables?
and,
with this method it is possible to map unknown sensors ?


the [[sensor_map]] associates the observations with database fields.  so i think that is a 'yes' to your first question.

the answer to the second is more complicated.

any driver has the following steps:

1) obtain data from the hardware
2) parse/decode the data
3) do unit conversions
4) do transformations, e.g., rain_total to rain_incremental; aggregations
5) map data from hardware naming to database fields

the uploaders in weewx provide additional steps

6) do transformations, e.g., cumulative power to incremental power; aggregations
7) map data from database fields to destination fields

in some cases, steps 1-5 degenerate to one or two steps, depending on the hardware.

in the case of the SDR driver, every step is involved, and it is complicated by the fact that the SDR receiver gets data from not just a single device.  as a result, it must also filter.  this is done implicitly in step 5.

in normal operation, the SDR driver will silently ignore data from sensors that you do not care about.  use the log_unknown_sensors option to make it log the output from sensors for which the SDR driver has no parser.  use the log_unmapped_sensors to make it log the output from sensors that you have not requested in the sensor_map.

m

Marco Tibaldi

unread,
Sep 9, 2016, 4:13:40 PM9/9/16
to weewx-user
clear thanks Matt .

Now I have a another question (sorry )

where you define the listening frequency of SDR dongle ?
I'm trying d test the Fine  Offset Wh 1080 at 860 mhz but I do not see any packet, while if launched from the command prompt: rtl_433 -f 860 ...
everything works correctly
M.

mwall

unread,
Sep 9, 2016, 4:23:41 PM9/9/16
to weewx-user


On Friday, September 9, 2016 at 4:13:40 PM UTC-4, Marco Tibaldi wrote:
where you define the listening frequency of SDR dongle ?

try setting the command:

[SDR]
    cmd = 'rtl_433 -f 860'

Marco Tibaldi

unread,
Sep 9, 2016, 5:01:02 PM9/9/16
to weewx-user
i think it's the right way  but theri is a syntax error:

unable to load driver file or folder not existant
    
this is the code:

[SDR]
    # This section is for the software-defined radio driver.
    
    # The driver to use
    driver = user.sdr
    cmd = /usr/local/bin/rtl_433 -f 868300000   <-----   unable to load driver file or folder not existant
    
    [[sensor_map]]
        wind_gust.0026.FOWH1080Packet = windGust
        battery.0026.FOWH1080Packet = outBatteryStatus
        total_rain.0026.FOWH1080Packet = rain
        wind_speed.0026.FOWH1080Packet = windSpeed
        wind_dir.0026.FOWH1080Packet = windDir
        humidity.0026.FOWH1080Packet = outHumidity
        temperature.0026.FOWH1080Packet = outTemp

Marco Tibaldi

unread,
Sep 9, 2016, 5:07:25 PM9/9/16
to weewx-user
I have tried also:
cmd = '/usr/local/bin/rtl_433 -f 868300000'
with ''

Il giorno venerdì 9 settembre 2016 23:01:02 UTC+2, Marco Tibaldi ha scritto:
i think it's the right way  but there is a syntax error:

Marco Tibaldi

unread,
Sep 9, 2016, 5:10:15 PM9/9/16
to weewx-user


Il giorno venerdì 9 settembre 2016 22:23:41 UTC+2, mwall ha scritto:

Marco Tibaldi

unread,
Sep 10, 2016, 8:15:26 AM9/10/16
to weewx-user
I tried with :
cmd = / usr / local / bin / rtl_433 -f 868.300000
with:
cmd = ' / usr / local / bin / rtl_433 -f 868300000 '
with:
cmd = " / usr / local / bin / rtl_433 -f 868300000 "

I even changed the sdr.py file
self._cmd = stn_dict.get ( ' cmd ' , ' rtl_433 -f 868300000 ' )

but it does not work .
I can not make run the cmd with the arguments correctly , that are used to tune the dongle at 868 mhz .

I also created a .sh file that contains the syntax correct rtl_433 to run , I made it executable , and I tried to  run from weewx.conf, nothing!


no one has an idea to run the command
cmd = / usr / local / bin / rtl_433 -f 868.300000
from inside weewx.conf with the correct arguments ?






Il giorno giovedì 8 settembre 2016 22:54:02 UTC+2, mwall ha scritto:

stefano orsi

unread,
Sep 11, 2016, 12:12:22 PM9/11/16
to weewx-user
Hi Matte,
i also tried a the 0.3 version of sdr driver.


i create a classThermoSensorPacket(Packet) similar to another pf you example
class ThermoSensorPacket(Packet):
    #2016-09-09 11:59:10 :   Thermo Sensor THR228N
    #        House Code:      111
    #        Channel:         2
    #        Battery:         OK
    #        Temperature:     24.70 C

    IDENTIFIER = "Thermo Sensor THR228N"
    PARSEINFO = {
         'StationID': ['station_id', None, None],
        'House Code': ['house_code', None, lambda x : int(x) ],
        'Channel': ['channel', None, lambda x : int(x) ],
        'Battery': ['battery', None, lambda x : 0 if x == 'OK' else 1],
        'Temperature':
            ['temperature', re.compile('([\d.]+) C'), lambda x : float(x)]
          # 'Humidity': ['humidity', re.compile('([\d.]+) %'), lambda x : float(x)]
        }
    @staticmethod
    def parse(ts, payload, lines):
        pkt = dict()
        pkt['dateTime'] = ts
        pkt['usUnits'] = weewx.METRIC
        pkt.update(Packet.parse_lines(lines, ThermoSensorPacket.PARSEINFO))
        channel = pkt.pop('channel', 0)
        code = pkt.pop('house_code', 0)
        sensor_id = "%s:%s" % (channel, code)
        pkt = Packet.add_identifiers(pkt, sensor_id, ThermoSensorPacket.__name__)
        return pkt


I also declare it in:
class SDRDriver(weewx.drivers.AbstractDevice):

[cut]
 Packet.KNOWN_PACKETS = [
            FOWH1080Packet,
            AcuriteTowerPacket,
    ThermoSensorPacket,
[cut]

and in debug options:
[cut]
 Packet.KNOWN_PACKETS = [FOWH1080Packet,
                            AcuriteTowerPacket,
   ThermoSensorPacket,
[cut]


I put this line in weewx.conf
# The diver to use

    driver = user.sdr
    cmd = /usr/local/bin/rtl_433
[[sensor_map]]...
    temperature.2:111.ThermoSensorPacket = outTemp

because i read this linees in weewx.log


Sep 11 17:50:41 raspberrypi3 weewx[10623]: sdr: MainThread: lines=['2016-09-11 17:50:41 :\tThermo Sensor THR228N\n', '\tHouse Code:\t 111\n', '\tChannel:\t 2\n', '\tBattery:\t OK\n', '\tTemperature:\t 27.60 C\n']
Sep 11 17:50:41 raspberrypi3 weewx[10623]: sdr: MainThread: ts=1473616241 payload=Thermo Sensor THR228N
Sep 11 17:50:41 raspberrypi3 weewx[10623]: sdr: MainThread: pkt={'temperature.2:111.ThermoSensorPacket': 27.6, 'battery.2:111.ThermoSensorPacket': 0, 'usUnits': 16, 'dateTime': 1473616241}
Sep 11 17:50:41 raspberrypi3 weewx[10623]: sdr: MainThread: packet={'outTemp': 27.6, 'usUnits': 16, 'dateTime': 1473616241}
Sep 11 17:50:41 raspberrypi3 weewx[10623]: reportengine: Running reports for latest time in the database.


After the first running in which in any case i don't see any variation in weewx html page and in which i can see the packet of rtl_433 reading, I receive this log message:

Sep 11 17:55:17 raspberrypi3 weewx[10623]: engine: Finished loading service weewx.engine.StdReport
Sep 11 17:55:17 raspberrypi3 weewx[10623]: engine: Starting up weewx version 3.5.0
Sep 11 17:55:17 raspberrypi3 weewx[10623]: engine: Station does not support reading the time
Sep 11 17:55:17 raspberrypi3 weewx[10623]: engine: Starting main packet loop.
Sep 11 17:55:17 raspberrypi3 weewx[10623]: sdr: MainThread: startup process '/usr/local/bin/rtl_433'
Sep 11 17:55:27 raspberrypi3 weewx[10623]: sdr: MainThread: lines=[]
Sep 11 17:55:27 raspberrypi3 weewx[10623]: sdr: MainThread: err: []
Sep 11 17:55:27 raspberrypi3 weewx[10623]: engine: Main loop exiting. Shutting engine down.
Sep 11 17:55:27 raspberrypi3 weewx[10623]: sdr: MainThread: shutdown process
Sep 11 17:55:27 raspberrypi3 weewx[10623]: engine: Caught WeeWxIOError: rtl_433 process is not running
Sep 11 17:55:27 raspberrypi3 weewx[10623]:     ****  Waiting 60 seconds then retrying...

and so on.

Any ideas? Regards, Stefano.




mwall

unread,
Sep 11, 2016, 9:30:42 PM9/11/16
to weewx-user


On Thursday, September 8, 2016 at 6:41:23 PM UTC-4, Marco Tibaldi wrote:
it's works!
only the time is ahead by 2 hours exactly ..... ?!?

marco,

are you in a timezone 2 hours from UTC?  there was a bug in the sdr driver - it was interpreting utc times as local time. you must use the -U option to rtl_433 to put the time in utc instead of local time.

this has been fixed at commit 0dc0e08

but if you specify your own cmd, be sure to specify the -U option too.

i also fixed the cmd invocation so that any other options will be respected now.  this should fix the frequency problem too.

m

m

mwall

unread,
Sep 11, 2016, 9:33:03 PM9/11/16
to weewx-user
On Sunday, September 11, 2016 at 12:12:22 PM UTC-4, stefano orsi wrote:
Hi Matte,
i also tried a the 0.3 version of sdr driver.


i create a classThermoSensorPacket(Packet) similar to another pf you example

thank you stefano.  this has been incorporated into version 0.4 of the driver

what command do you use to run rtl_433 directly?  do you need to set the PATH or LD_LIBRARY_PATH before you start rtl_433 when you run it directly?

m

stefano orsi

unread,
Sep 12, 2016, 5:24:57 AM9/12/16
to weewx-user

Hi Matt,
thank for your fast replay.
i don't use any further command to call rtl_433

I only add the class ThermoSensorPacket in sdr.py code
The only declaration i made, was on weewx.conf with the lines:

# The diver to use
    driver = user.sdr
    cmd = /usr/local/bin/rtl_433

Regards, Stefano.

mwall

unread,
Sep 12, 2016, 11:45:10 AM9/12/16
to weewx-user
to any sdr users,

version 0.6 of the driver uses a new format for sensor_map that is not compatible with any previous sensor_map

please see the readme.txt for examples, or see the comments at the beginning of sdr.py for details

apologies for the disruption and lack of backward compatibility, but this is bleeding edge 0.x software, after all, and i'm still learning/creating the patterns.

m
Message has been deleted

Marco Tibaldi

unread,
Sep 12, 2016, 2:02:20 PM9/12/16
to weewx-user

hello Matt and thank you for the work you're doing , I think that the work is finished the result will be spectacular .
I'm testing the new 0.6 driver , I remapped the sensor packages with new specifications :


[SDR]
    # This section is for the software-defined radio driver.
    # The driver to use
    driver = user.sdr
    cmd = '/usr/local/bin/rtl_433 -q -U'
    [[sensor_map]]
        windGust = wind_gust.9:34.LaCrossePacket
        rain = Rainfall.9:34.LaCrossePacket
        windSpeed = wind_speed.9:34.LaCrossePacket
        windDir = wind_dir.9:34.LaCrossePacket
        outHumidity = humidity.9:34.LaCrossePacket
        outTemp = temperature.9:34.LaCrossePacket

I set in the cmd -q -U for the time problem.

But I think there is a problem , the system performs the first reading , after which it stops.
the log:

Sep 12 19:41:01 SDR weewx[574]: sdr: MainThread: lines=[]
Sep 12 19:41:08 SDR weewx[574]: sdr: MainThread: lines=['2016-09-12 17:41:07 :\tLaCrosse WS \t:\t9 \t:\t34\n', '\tTemperature:\t 29.3 $
Sep 12 19:41:08 SDR weewx[574]: sdr: MainThread: ts=1473702067 payload=LaCrosse WS #011:#0119 #011:#01134
Sep 12 19:41:08 SDR weewx[574]: sdr: MainThread: pkt={'temperature.9:34.LaCrossePacket': 29.3, 'usUnits': 17, 'dateTime': 1473702067}
Sep 12 19:41:08 SDR weewx[574]: sdr: MainThread: packet={'outTemp': 29.3, 'usUnits': 17, 'dateTime': 1473702067}
Sep 12 19:41:08 SDR weewx[574]: manager: added record 2016-09-12 19:40:00 CEST (1473702000) to database 'weewx.sdb'
Sep 12 19:41:08 SDR weewx[574]: manager: added record 2016-09-12 19:40:00 CEST (1473702000) to daily summary in 'weewx.sdb'
Sep 12 19:41:09 SDR weewx[574]: reportengine: Running reports for latest time in the database.
Sep 12 19:41:09 SDR weewx[574]: sdr: MainThread: startup process '/usr/local/bin/rtl_433 -q -U'
Sep 12 19:41:09 SDR weewx[574]: reportengine: Running report StandardReport
Sep 12 19:41:09 SDR weewx[574]: reportengine: Found configuration file /etc/weewx/skins/Standard/skin.conf for report StandardReport
Sep 12 19:41:09 SDR weewx[574]: sdr: MainThread: err: ['Found Rafael Micro R820T tuner\n', 'Exact sample rate is: 250000.000414 Hz\n',$
Sep 12 19:41:09 SDR weewx[574]: engine: Main loop exiting. Shutting engine down.

Sep 12 19:41:09 SDR weewx[574]: engine: Shutting down StdReport thread
Sep 12 19:41:16 SDR weewx[574]: cheetahgenerator: Generated 14 files for report StandardReport in 6.67 seconds
Sep 12 19:41:18 SDR weewx[574]: genimages: Generated 12 images for StandardReport in 1.37 seconds
Sep 12 19:41:18 SDR weewx[574]: reportengine: copied 9 files to /var/www/weewx
Sep 12 19:41:18 SDR weewx[574]: reportengine: Running report FTP
Sep 12 19:41:18 SDR weewx[574]: reportengine: Found configuration file /etc/weewx/skins/Ftp/skin.conf for report FTP
Sep 12 19:41:18 SDR weewx[574]: reportengine: FTP upload not requested. Skipped.
Sep 12 19:41:18 SDR weewx[574]: reportengine: Running report RSYNC
Sep 12 19:41:18 SDR weewx[574]: reportengine: Found configuration file /etc/weewx/skins/Rsync/skin.conf for report RSYNC
Sep 12 19:41:18 SDR weewx[574]: reportengine: rsync upload not requested. Skipped.
Sep 12 19:41:18 SDR weewx[574]: engine: StdReport thread has been terminated

After a few minutes the process tries to start again but I get a series of errors :

the log:

Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.restx.StdWunderground
Sep 12 19:44:38 SDR weewx[574]: restx: Wunderground: Posting not enabled.
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.restx.StdWunderground
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.restx.StdPWSweather
Sep 12 19:44:38 SDR weewx[574]: restx: PWSweather: Posting not enabled.
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.restx.StdPWSweather
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.restx.StdCWOP
Sep 12 19:44:38 SDR weewx[574]: restx: CWOP: Posting not enabled.
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.restx.StdCWOP
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.restx.StdWOW
Sep 12 19:44:38 SDR weewx[574]: restx: WOW: Posting not enabled.
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.restx.StdWOW
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.restx.StdAWEKAS
Sep 12 19:44:38 SDR weewx[574]: restx: AWEKAS: Posting not enabled.
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.restx.StdAWEKAS
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.engine.StdPrint
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.engine.StdPrint
Sep 12 19:44:38 SDR weewx[574]: engine: Loading service weewx.engine.StdReport
Sep 12 19:44:38 SDR weewx[574]: engine: Finished loading service weewx.engine.StdReport
Sep 12 19:44:38 SDR weewx[574]: engine: Starting up weewx version 3.5.0
Sep 12 19:44:38 SDR weewx[574]: engine: Station does not support reading the time
Sep 12 19:44:38 SDR weewx[574]: engine: Starting main packet loop.
Sep 12 19:44:38 SDR weewx[574]: sdr: MainThread: startup process '/usr/local/bin/rtl_433 -q -U'
Sep 12 19:44:48 SDR weewx[574]: sdr: MainThread: lines=[]
Sep 12 19:44:48 SDR weewx[574]: sdr: MainThread: err: []
Sep 12 19:44:48 SDR weewx[574]: engine: Main loop exiting. Shutting engine down.
Sep 12 19:44:48 SDR weewx[574]: sdr: MainThread: shutdown process
Sep 12 19:44:48 SDR weewx[574]: engine: Caught WeeWxIOError: rtl_433 process is not running

Sep 12 19:44:48 SDR weewx[574]:     ****  Waiting 60 seconds then retrying...

thank you again.

Marco.

mwall

unread,
Sep 12, 2016, 4:50:55 PM9/12/16
to weewx-user


On Monday, September 12, 2016 at 2:02:20 PM UTC-4, Marco Tibaldi wrote:

hello Matt and thank you for the work you're doing , I think that the work is finished the result will be spectacular .
I'm testing the new 0.6 driver , I remapped the sensor packages with new specifications :


[SDR]
    # This section is for the software-defined radio driver.
    # The driver to use
    driver = user.sdr
    cmd = '/usr/local/bin/rtl_433 -q -U'
    [[sensor_map]]
        windGust = wind_gust.9:34.LaCrossePacket
        rain = Rainfall.9:34.LaCrossePacket
        windSpeed = wind_speed.9:34.LaCrossePacket
        windDir = wind_dir.9:34.LaCrossePacket
        outHumidity = humidity.9:34.LaCrossePacket
        outTemp = temperature.9:34.LaCrossePacket

I set in the cmd -q -U for the time problem.

But I think there is a problem , the system performs the first reading , after which it stops.

marco,

please try v0.7 (commit 3b3d41d)

it has improved subprocess monitoring.

if the driver fails, then diagnose one step at a time.

first step is to run rtl_433 directly:

sudo rtl_433 -q -U

if you are in a noisy environment, you can use the -R option to listen only for specific sensors.

if that works, and you see output from your sensors, then run the driver directly:

cd /home/weewx
sudo PYTHONPATH=bin python bin/user/sdr.py

you can use the --debug option for more information.

if that works, then run weewxd directly:

cd /home/weewx
sudo bin/weewxd weewx.conf


once that works, you should be able to run weewx as a daemon (manually or at system startup).

m

Marco Tibaldi

unread,
Sep 12, 2016, 5:45:24 PM9/12/16
to weewx-user
I try.
i'm only sure that rtl_433 works fine.
if you want, and if you can, for troubleshooting, tomorrow (now here is 11.40 PM), I can get you to connect directly to my raspberry pi with weewx and rtl_433 sdr installed on with a lacrosse ws2310.

Marco Tibaldi

unread,
Sep 13, 2016, 2:16:33 PM9/13/16
to weewx-user
I just can not understand it , tonight works ... ( at least for now ) .

I have not changed anything since last night , and today magically goes .

Last night after the first reading weewx crashed , and the rtl_433 remained hanging,  from prompt i run rtl_433 and i see :

Using device 0 : Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device # 0 .

even after stopping weewx  , it required a reboot .

the only thing for now is the capture of  the wind direction,  the packet that is displayed in the log is:


\tLaCrosse WS \t:\t9 \t:\t34\n', '\tWind speed:\t 0.0 m/s\n', '\tDirection:\t 202.500\n


But in web page remain to zero:

Outside Temperature 29,9°C 
Wind Chill 29,9°C 
Heat Index 30,1°C 
Dewpoint 16,3°C 
Humidity 44% 
Barometer N/A 
Barometer Trend (3 hours) N/A 
Wind 0,0 m/s from N/A (N/A) 
Rain Rate 0,0 mm/hr 

I can not explain   
Informatics = Informagics
I keep it monitored !!!  

Marco.

Il giorno lunedì 12 settembre 2016 22:50:55 UTC+2, mwall ha scritto:

Marco Tibaldi

unread,
Sep 13, 2016, 6:24:13 PM9/13/16
to weewx-user

Hello Matt ,
I made a change to the driver 0.7 so that it also recognizes the sensor oregon scientific THGR122N
I tried it and I saw that it also works in mixed mode , with two different sensors simultaneously .
because the sensors of my lacrosse Ws are external I needed to also monitor internal rooms .

my weewx.conf sensor section:

SDR]
    # This section is for the software-defined radio driver.

    # The driver to use
    driver = user.sdr
    cmd = '/usr/local/bin/rtl_433 -q -U'
     [[sensor_map]]
       windGust = wind_gust.9:34.LaCrossePacket
       rain = Rainfall.9:34.LaCrossePacket
       windSpeed = wind_speed.9:34.LaCrossePacket
       windDir = wind_dir.9:34.LaCrossePacket
       outHumidity = humidity.9:34.LaCrossePacket
       outTemp = temperature.9:34.LaCrossePacket
       inHumidity = humidity.3:212.OSTHGR122NPacket
       inTemp = temperature.3:212.OSTHGR122NPacket
       log_unknown_sensors = True
       log_unmapped_sensors = True

extract of weewx log:
Sep 14 00:00:55 SDR weewx[590]: sdr: MainThread: ts=1473804055 payload=OS :#011THGR122N
Sep 14 00:00:55 SDR weewx[590]: sdr: MainThread: pkt={'temperature.3:212.OSTHGR122NPacket': 27.5, 'humidity.3:212.OSTHGR122NPacket': 33.0, 'battery.3:212.OSTHGR122NPacket': 0, 'usUnits': 16, 'dateTime': 1473804055}
Sep 14 00:00:55 SDR weewx[590]: sdr: MainThread: packet={'inHumidity': 33.0, 'inTemp': 27.5, 'usUnits': 16, 'dateTime': 1473804055}
Sep 14 00:00:55 SDR weewx[590]: manager: added record 2016-09-14 00:00:00 CEST (1473804000) to database 'weewx.sdb'
Sep 14 00:00:55 SDR weewx[590]: manager: added record 2016-09-14 00:00:00 CEST (1473804000) to daily summary in 'weewx.sdb'
Sep 14 00:00:56 SDR weewx[590]: reportengine: Running reports for latest time in the database.

it's works.

M.



Il giorno lunedì 12 settembre 2016 22:50:55 UTC+2, mwall ha scritto:
weewx-sdr.zip

stefano orsi

unread,
Sep 14, 2016, 3:09:38 AM9/14/16
to weewx-user
The v0.7 working fo me too ! :-)
Ok mattew, beautiful job.

Now the rtl_433 process will be stopped any time the weewx service is stopped.
No more defunct or free process under the ps waux command

I will write the class and relative parsing, about another radio sensor i have.
So i can implement, if you desire in a new version of your sdr driver.

Thank you so much for you patience.
Regards, Stefano.


Richard Scruggs

unread,
Sep 25, 2016, 9:39:45 PM9/25/16
to weewx-user
I'm playing around with this - having a great time, but only know a little of what I'm doing.

I'm trying to test. 
rtl_433 -R 39 -f 433919000 runs great

However,  if I run:
  sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/sdr.py

I get: 

out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []

I'm assuming it means I have something configured wrong.  Any ideas?

Thanks


mwall

unread,
Sep 25, 2016, 10:59:05 PM9/25/16
to weewx-user
On Sunday, September 25, 2016 at 9:39:45 PM UTC-4, Richard Scruggs wrote:
I'm assuming it means I have something configured wrong.  Any ideas?

hi richard,

by default, the cmd is simply 'rtl_433'

when you invoke the driver directly, it does not use the weewx configuration file or other weewx plumbing.  so you need to tell it the command you want it to use, something like this:

sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/sdr.py --cmd='rtl_433 -R 39 -f 433919000'

if that works, then you can put the cmd in the weewx config file like this:

[SDR]
    driver = user.sdr
    cmd = rtl_433 -R 39 -f 433919000

at that point you will also need to specify the sensor_map to associate sensor output with fields in the weewx database schema.

these inexpensive sdr are pretty fun, eh?

m

mwall

unread,
Sep 25, 2016, 11:11:00 PM9/25/16
to weewx-user
On Tuesday, September 13, 2016 at 6:24:13 PM UTC-4, Marco Tibaldi wrote:

Hello Matt ,
I made a change to the driver 0.7 so that it also recognizes the sensor oregon scientific THGR122N
I tried it and I saw that it also works in mixed mode , with two different sensors simultaneously .
because the sensors of my lacrosse Ws are external I needed to also monitor internal rooms .


marco,

thank you for this!  it has been added to the sdr driver v0.8

m

Richard Scruggs

unread,
Sep 26, 2016, 8:05:35 PM9/26/16
to weewx-user
That worked! Thank you so much!  I got this:

pi@weatherstationpizero:~ $ sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/sdr.py --cmd='rtl_433 -R 39 -f 433919000'
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: ['2016-09-26 18:59:04 Acurite 5n1 sensor 0x0566 Ch A, Msg 38, Wind 5 kmph / 3.1 mph, 18.6 C 65.5 F 38 % RH\n']
parsed: {'wind_speed.0566.Acurite5n1Packet': 5.0, 'temperature.0566.Acurite5n1Packet': 18.6, 'temperature_F.0566.Acurite5n1Packet': 65.5, 'dateTime': 1474916344, 'wind_speed_mph.0566.Acurite5n1Packet': 3.1, 'humidity.0566.Acurite5n1Packet': 38.0, 'usUnits': 16}
out: ['2016-09-26 18:59:04 Acurite 5n1 sensor 0x0566 Ch A, Msg 38, Wind 5 kmph / 3.1 mph, 18.6 C 65.5 F 38 % RH\n']
parsed: {'wind_speed.0566.Acurite5n1Packet': 5.0, 'temperature.0566.Acurite5n1Packet': 18.6, 'temperature_F.0566.Acurite5n1Packet': 65.5, 'dateTime': 1474916344, 'wind_speed_mph.0566.Acurite5n1Packet': 3.1, 'humidity.0566.Acurite5n1Packet': 38.0, 'usUnits': 16}
out: ['2016-09-26 18:59:04 Acurite 5n1 sensor 0x0566 Ch A, Msg 38, Wind 5 kmph / 3.1 mph, 18.6 C 65.5 F 38 % RH\n']
parsed: {'wind_speed.0566.Acurite5n1Packet': 5.0, 'temperature.0566.Acurite5n1Packet': 18.6, 'temperature_F.0566.Acurite5n1Packet': 65.5, 'dateTime': 1474916344, 'wind_speed_mph.0566.Acurite5n1Packet': 3.1, 'humidity.0566.Acurite5n1Packet': 38.0, 'usUnits': 16}
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []
out: []
unparsed: []

Should I be concerned about the five out:/unparsed: bits I get after every cycle?  Is that the mapping business of which you speak?

Thanks again.

mwall

unread,
Sep 27, 2016, 8:24:48 AM9/27/16
to weewx-user
On Monday, September 26, 2016 at 8:05:35 PM UTC-4, Richard Scruggs wrote:
Should I be concerned about the five out:/unparsed: bits I get after every cycle?  Is that the mapping business of which you speak?


the empty 'out:' arrays are due to empty lines received from the rtl_433 command.  i'm not sure why you get those - when you run rtl_433 directly, do you get empty lines?

its nothing to worry about - the factory and parser simply skip empty lines.

you can use the --debug option to get more information about the packet detection and parsing.

the sensor_map specifies which observation.identifier.packet_type tuples are associated with the weewx database fields, and it is necessary when you run the driver within weewxd.

if you do not specify a sensor_map, then no data will get into the weewx database.

m

Richard Scruggs

unread,
Sep 27, 2016, 12:36:29 PM9/27/16
to weewx-user
Thank you so much for all of this.  Your bit is working perfectly.  Now it's just a matter of my meager Linux skills hooking everything up to get the web page to fire right ;).

Marco Tibaldi

unread,
Sep 27, 2016, 2:53:14 PM9/27/16
to weewx-user
you're welcome
Reply all
Reply to author
Forward
0 new messages