Re: [weewx-user] Please add to sdr.py

2020-10-20 Thread raadi...@gmail.com
Hello! Well works like charm!
Oct 20 21:16:09 andy-HP-Compaq-dc7900-Convertible-Minitower weewx[17755] 
DEBUG user.sdr: lines=[u'{"time" : "2020-10-20 18:16:05", "model" : 
"WS2032", "id" : 11768, "temperature_C" : 0.500, "humidity" : 20, 
"wind_dir_deg" : 337.500, "wind_avg_km_h" : 0.000, "wind_max_km_h" : 0.000, 
"maybe_flags" : 0, "maybe_rain" : 256, "mic" : "CRC"}\n']
Oct 20 21:16:09 andy-HP-Compaq-dc7900-Convertible-Minitower weewx[17755] 
DEBUG user.sdr: packet={'dateTime': 1603217765, u'windDir': 337.5, 
u'windSpeed': 0.0, u'windGust': 0.0, u'rainRate': 256.0, 'usUnits': 16}
My weewx.conf added
[SDR]
# This section is for the software-defined radio driver.

# The driver to use
driver = user.sdr
# cmd = rtl_433 -g 19.7 -p -20 -f 43392 -M utc -F json
cmd = rtl_433 -d 1 -g 49.6 -p 50 -f 43392 -M utc -F json
path = /usr/local/bin
ld_library_path = /usr/share/weewx/lib:/home/andy/rtl-sdr/build/src
log_unknown_sensors = True
log_unmapped_sensors = True
[[sensor_map]]
outTemp = temperature.1:None.TFATwinPlusPacket
outHumidity = humidity.1:None.TFATwinPlusPacket
outBatteryStatus = battery.1:None.TFATwinPlusPacket
# humidity.1:none.TFATwinPlus303049Packet
# temperature.1:None.TFATwinPlus303049Packet
  
inTemp = temperature.1:5.HidekiTS04Packet

# inBatteryStatus = battery.1:None.SolightTE44Packet
# inHumidity = humidity.181.ProloguePacket
# inBatteryStatus = battery.181.ProloguePacket
# extraTemp1 = temperature.1:None.SolightTE44Packet
windDir = wind_dir.11768.WS2032Packet
windGust = wind_gust.11768.WS2032Packet
rainRate = total_rain.11768.WS2032Packet
windSpeed = wind_speed.11768.WS2032Packet


# inHumidity = humidity.1:5.HidekiTS04Packet
inBatteryStatus = battery.1:5.HidekiTS04Packet


By the way earlier I asked adding TFA - twinplus - on my weewx 4.11
i had to modify sdr.py like this for TFA - twinplus sensor
class TFATwinPlusPacket(Packet):
# 2019-09-25 17:15:12 :   TFA-Twin-Plus-30.3049
# Channel: 1
# Battery: OK
# Temperature: 8.40 C
# Humidity: 91 %

# {"time" : "2019-09-25 17:15:12", "model" : "TFA-Twin-Plus-30.3049", 
"id" : 13, "channel" : 1, "battery" : "OK", "temperature_C" : 8.400, 
"humidity" : 91, "mic" : "CHECK  SUM"} 

IDENTIFIER = "TFA-TwinPlus"
PARSEINFO = {
'Rolling Code': ['rolling_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_text(ts, payload, lines):
pkt = dict()
pkt['dateTime'] = ts
pkt['usUnits'] = weewx.METRIC
pkt.update(Packet.parse_lines(lines, TFATwinPlusPacket.PARSEINFO))
return Hideki.insert_ids(pkt, TFATwinPlusPacket.__name__)

Original was
class TFATwinPlus303049Packet(Packet):
# 2019-09-25 17:15:12 :   TFA-Twin-Plus-30.3049
# Channel: 1
# Battery: OK
# Temperature: 8.40 C
# Humidity: 91 %

# {"time" : "2019-09-25 17:15:12", "model" : "TFA-Twin-Plus-30.3049", 
"id" : 13, "channel" : 1, "battery" : "OK", "temperature_C" : 8.400, 
"humidity" : 91, "mic" : "CHECK  SUM"} 

IDENTIFIER = "TFA-Twin-Plus-30.3049"
PARSEINFO = {
'Rolling Code': ['rolling_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_text(ts, payload, lines):
pkt = dict()
pkt['dateTime'] = ts
pkt['usUnits'] = weewx.METRIC
pkt.update(Packet.parse_lines(lines, 
TFATwinPlus303049Packet.PARSEINFO))
return Hideki.insert_ids(pkt, TFATwinPlus303049Packet.__name__)

вторник, 20 октября 2020 г. в 17:24:21 UTC+3, Andy: 

> Try this. What are "maybe_rain" and "maybe_flags"?
>
> Andy
>
> On Monday, October 19, 2020 at 4:14:43 PM UTC-7 tke...@gmail.com wrote:
>
>> A PR ("Pull Request") to the SDR github site 
>>  is the most efficient way to 
>> do this.
>>
>> Unfortunately, it looks like you'd have to get in line. There are quite a 
>> few PRs backed up.
>>
>> On Mon, Oct 19, 2020 at 4:10 PM raadi...@gmail.com  
>> wrote:
>>
>>> Hello! Recently discovered new weather station signal with json output
>>> weewx[14512] DEBUG user.sdr: punt unrecognized line '{"time" : 
>>> "2020-10-19 22:41:24", "model" : "WS2032", "id" : 11768, "temperature_C" : 
>>> 3.800, "humidity" : 48, "wind_dir_deg" : 315.000, "wind_avg_km_h" : 7

Re: [weewx-user] Please add to sdr.py

2020-10-20 Thread Andy
Try this. What are "maybe_rain" and "maybe_flags"?

Andy

On Monday, October 19, 2020 at 4:14:43 PM UTC-7 tke...@gmail.com wrote:

> A PR ("Pull Request") to the SDR github site 
>  is the most efficient way to 
> do this.
>
> Unfortunately, it looks like you'd have to get in line. There are quite a 
> few PRs backed up.
>
> On Mon, Oct 19, 2020 at 4:10 PM raadi...@gmail.com  
> wrote:
>
>> Hello! Recently discovered new weather station signal with json output
>> weewx[14512] DEBUG user.sdr: punt unrecognized line '{"time" : 
>> "2020-10-19 22:41:24", "model" : "WS2032", "id" : 11768, "temperature_C" : 
>> 3.800, "humidity" : 48, "wind_dir_deg" : 315.000, "wind_avg_km_h" : 7.740, 
>> "wind_max_km_h" : 15.480, "maybe_flags" : 0, "maybe_rain" : 256, "mic" : 
>> "CRC"}#012'. Can anybody add to sdr.py support of WS2032. Thanks!
>>
>> -- 
>> 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/7b75c103-f6b3-4634-b3ba-970083d80ecdn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f84dad25-8d58-4e6d-afac-507a455e7b9fn%40googlegroups.com.
#!/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
try:
# Python 3
import queue
except ImportError:
# Python 2:
import Queue as queue
import fnmatch
import os
import re
import subprocess
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

try:
# New-style weewx logging
import weeutil.logger
import logging
log = logging.getLogger(__name__)

def logdbg(msg):
log.debug(msg)

def loginf(msg):
log.info(msg)

def logerr(msg):
log.error(msg)

except ImportError:
# Old-st

Re: [weewx-user] Please add to sdr.py

2020-10-19 Thread Tom Keffer
A PR ("Pull Request") to the SDR github site
 is the most efficient way to do
this.

Unfortunately, it looks like you'd have to get in line. There are quite a
few PRs backed up.

On Mon, Oct 19, 2020 at 4:10 PM raadi...@gmail.com 
wrote:

> Hello! Recently discovered new weather station signal with json output
> weewx[14512] DEBUG user.sdr: punt unrecognized line '{"time" : "2020-10-19
> 22:41:24", "model" : "WS2032", "id" : 11768, "temperature_C" : 3.800,
> "humidity" : 48, "wind_dir_deg" : 315.000, "wind_avg_km_h" : 7.740,
> "wind_max_km_h" : 15.480, "maybe_flags" : 0, "maybe_rain" : 256, "mic" :
> "CRC"}#012'. Can anybody add to sdr.py support of WS2032. Thanks!
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/7b75c103-f6b3-4634-b3ba-970083d80ecdn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBHfFUQx-uDzp%3DYueuEC%3D3P1%3Dy7-g9y8Ckgq0t62KUkWw%40mail.gmail.com.