Hi, 
I'm using weewx on a RaspberryPi2 with an Origon WMR928. I'm adding sensor 
to my WMR928 in a different way as 'adding sensors' is descripted in 
documention. I have developed a circuit with an ATMega128 and a 868Mhz 
RFM12 module some years ago (before apeareance of RPi on the market). This 
circiut connects the WMR928 to the RaspberryPi. The RFM12 connects 
supplementary sensors, the Firmware of the ATMega128 translates the 
RFM12-sensor-protocol to an Oregon compatible protocol. That means starting 
0xffff are the same as the original, third byte is my new ptype and 
checksum will be calculated as WMR928 does.
Now I have extended wmr9x8.py for a second windspeed sensor like this:
    DEFAULT_MAP = {
        'barometer': 'barometer',
        'pressure': 'pressure',
        'windSpeed': 'wind_speed',
...
        'wind2Speed': 'wind2_speed',
        'wind2Gust': 'wind2_gust',
        'wind2Vbat': 'wind2_vbat',
        'wind2Temp': 'wind2_temp',
        'wind2BatteryStatus': 'battery_status_wind2',
        'wind2Charging': 'charging_wind2',
        'wind2HeaterOn': 'heateron_wind2'}

and I have added follwing code:
@wmr9x8_registerpackettype(typecode=0x10, size=13)
    def _wmr9x8_lisa_packet(self, packet):
        """Decode a lisa wind packet. Wind speed will be in kph"""
        null, status, vbat100th, vbat10th, vbat1, gust10th, gust1, gust10, 
avg10th, avg1, avg10, chillstatus, chill1, chill10, ltmp10th, ltmp1, 
ltmp10, ltmp100etc

        battery = (status & 0x04) >> 2
        charging = (status & 0x08) >> 3
        heater_on = (chillstatus & 0x04) >> 2
        
        # The console returns wind speeds in m/s. Our metric system requires
        # kph, so the result needs to be multiplied by 3.6
        _record = {
            'battery_status_wind2': battery,
            'charging_wind2': charging,
            'heateron_wind2': heater_on,
            'wind2_speed': ((avg10th / 10.0) + avg1 + (avg10 * 10)) * 3.6,
            'wind2_vbat': ((vbat100th / 100.0) + (vbat10th / 10.0) + vbat1),
            'dateTime': int(time.time() + 0.5),
            'usUnits': weewx.METRIC
        }
        # Sometimes the station emits a wind gust that is less than the
        # average wind. Ignore it if this is the case.
        windGustSpeed = ((gust10th / 10.0) + gust1 + (gust10 * 10)) * 3.6
        if windGustSpeed >= _record['wind2_speed']:
            _record['wind2_gust'] = windGustSpeed

        # chill has no data;
        tempoverunder = temp100etc & 0x04
        temp_no_data = chillstatus & 0x08
        if not tempoverunder and not temp_no_data:
            temp = (ltmp10th / 10.0) + ltmp1 + (ltmp10 * 10) + ((ltmp100etc 
& 0x03) * 100)
            if ltmp100etc & 0x08:
                temp = -temp
            _record['wind2_temp'] = temp
        else:
            _record['wind2_temp'] = None
        
        return _record

I have extended and reconfigured the database as descriped in doc website 
(which is ok). But the new table columns are empty.

So I have added some more code to wmr9x8.py:
# WMR-9x8/968 packets are framed by 0xFF characters
            if buf[0] == 0xFF and buf[1] == 0xFF and buf[2] in 
wmr9x8_packet_type_size_map:
                # Look up packet type, the expected size of this packet type
                ptype = buf[2]
                *logdbg("Received packet type (%s)." % ptype)*

I never see my new packet type in log file. Why not? Should be there if 
buf[0] and buf[1] are 0xFF...

Kind regards 
Klaus

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to