we recommend NOT to use the intereptor driver for a GW1000/WH2650 console but to use the meanwhile existing GW1000 API driver instead - otherwise you tend to run into multiple issues (and unnecessarily use the console's "Customized"server option which exists only once) due to the many extra sensors being released.

The GW1000 API driver covers all existing FineOffset/Ecowitt (clone) sensors and is very stable.
Gary did an excellent job here.
https://github.com/gjr80/weewx-gw1000

On 11.04.2021 15:36, Johann Destombes wrote:
Yes I'm agree. This is the driver part of my weewx.conf:
/
/
/###############################
[Interceptor]
    driver = user.interceptor
    device_type = ecowitt-client
    port = 8000

    [[sensor_map_extensions]]
        lightning_strike_count = lightning_num
        lightning_distance = lightning
 ############################### /

I followed this link: https://github.com/matthewwall/weewx-interceptor/issues/69 <https://github.com/matthewwall/weewx-interceptor/issues/69> to modifie interceptor.py.
So this is the ecowitt-client part of my interceptor.py:

Row 2306 to 2459.
/...
class EcowittClient(Consumer):
    """Use the ecowitt protocol (not WU protocol) to capture data"""

    def __init__(self, **stn_dict):
        super(EcowittClient, self).__init__(
            EcowittClient.Parser(), handler=EcowittClient.Handler, **stn_dict)

    class Handler(Consumer.Handler):

        def get_response(self):
            return '{"errcode":"0","errmsg":"ok","UTC_offset":"-18000"}'

    class Parser(Consumer.Parser):

        # map labels to observation names
        LABEL_MAP = {
            'baromabsin': 'pressure',
            'humidity': 'humidity_out',
            'humidityin': 'humidity_in',
            'tempf': 'temperature_out',
            'tempinf': 'temperature_in',
            'temp1f': 'temperature_1',
            'temp2f': 'temperature_2',
            'temp3f': 'temperature_3',
            'temp4f': 'temperature_4',
            'temp5f': 'temperature_5',
            'temp6f': 'temperature_6',
            'temp7f': 'temperature_7',
            'temp8f': 'temperature_8',
            'humidity1': 'humidity_1',
            'humidity2': 'humidity_2',
            'humidity3': 'humidity_3',
            'humidity4': 'humidity_4',
            'humidity5': 'humidity_5',
            'humidity6': 'humidity_6',
            'humidity7': 'humidity_7',
            'humidity8': 'humidity_8',
            'batt1': 'battery_1',
            'batt2': 'battery_2',
            'batt3': 'battery_3',
            'batt4': 'battery_4',
            'batt5': 'battery_5',
            'batt6': 'battery_6',
            'batt7': 'battery_7',
            'batt8': 'battery_8',
            'soilmoisture1': 'soil_moisture_1',
            'soilmoisture2': 'soil_moisture_2',
            'soilmoisture3': 'soil_moisture_3',
            'soilmoisture4': 'soil_moisture_4',
            'soilmoisture5': 'soil_moisture_5',
            'soilmoisture6': 'soil_moisture_6',
            'soilmoisture7': 'soil_moisture_7',
            'soilmoisture8': 'soil_moisture_8',
            'soilbatt1': 'soil_battery_1',
            'soilbatt2': 'soil_battery_2',
            'soilbatt3': 'soil_battery_3',
            'soilbatt4': 'soil_battery_4',
            'soilbatt5': 'soil_battery_5',
            'soilbatt6': 'soil_battery_6',
            'soilbatt7': 'soil_battery_7',
            'soilbatt8': 'soil_battery_8',
            'windspeedmph': 'wind_speed',
            'windgustmph': 'wind_gust',
            'winddir': 'wind_dir',
            'solarradiation': 'solar_radiation',
            'uv': 'uv',
            'totalrainin': 'rain_total',
            'rainratein': 'rain_rate',
            'wh25batt': 'wh25_battery',
            'wh26batt': 'wh26_battery',
            'wh40batt': 'wh40_battery',
            'wh65batt': 'wh65_battery',
             'pm25_ch1': 'pm2_5',
            'pm25batt1': 'pm25_battery',
            'lightning': 'lightning',
            'lightning_time': 'lightning_time',
            'lightning_num': 'lightning_num',
            'wh57batt': 'wh57_battery',
            'leak_ch1': 'leak_1',
            'leak_ch2': 'leak_2',
            'leak_ch3': 'leak_3',
            'leak_ch4': 'leak_4',
            'leakbatt1': 'leak_battery_1',
            'leakbatt2': 'leak_battery_2',
            'leakbatt3': 'leak_battery_3',
            'leakbatt4': 'leak_battery_4',
        }

        IGNORED_LABELS = [
            'PASSKEY', 'dateutc', 'stationtype', 'model', 'freq', 'baromrelin',
            'maxdailygust', 'eventrainin', 'hourlyrainin', 'dailyrainin',
            'weeklyrainin', 'monthlyrainin', 'yearlyrainin',
            'pm25_avg_24h_ch1', 'winddir_avg10m', 'windspdmph_avg10m',
        ]

        def __init__(self):
            self._last_rain = None
            self._rain_mapping_confirmed = False

        def parse(self, s):
            pkt = dict()
            try:
                data = _cgi_to_dict(s)
                pkt['dateTime'] = self.decode_datetime(
                    data.pop('dateutc', int(time.time() + 0.5)))
                pkt['usUnits'] = weewx.US

                # some devices (e.g., HP2551_V1.5.7) emit something that looks                 # a lot like ecowitt protocol, but not quite. one thing that                 # they get wrong is the rain - that have no totalrainin.  so                 # for those devices, substitute a different cumulative rain
                # measurement.  do this only once, and do not be fooled by
                # partial packets.
                if not self._rain_mapping_confirmed:
                    if 'totalrainin' not in data and 'yearlyrainin' in data:
                        self.LABEL_MAP.pop('totalrainin')
                        self.LABEL_MAP['yearlyrainin'] = 'rain_total'
                        self._rain_mapping_confirmed = True
                        loginf("using 'yearlyrainin' for rain_total")
                    elif 'totalrainin' in data:
                        self._rain_mapping_confirmed = True
                        loginf("using 'totalrainin' for rain_total")

                # get all of the other parameters
                for n in data:
                    if n in self.LABEL_MAP:
#pkt[self.LABEL_MAP[n]] = self.decode_float(data[n])
                        # Oliver, 18.06.20 further processing requires a num so set 0 to prevent float-conversion error                         pkt[self.LABEL_MAP[n]] = self.decode_float(data[n]) if data[n] != '' else 0
                    elif n in self.IGNORED_LABELS:
                        val = data[n]
                        if n == 'PASSKEY':
                            val = 'X' * len(data[n])
                        logdbg("ignored parameter %s=%s" % (n, val))
                    else:
                        loginf("unrecognized parameter %s=%s" % (n, data[n]))

                # get the rain this period from total
                if 'rain_total' in pkt:
                    newtot = pkt['rain_total']
                    pkt['rain'] = self._delta_rain(newtot, self._last_rain)
                    self._last_rain = newtot

            except ValueError as e:
                logerr("parse failed for %s: %s" % (s, e))
            return pkt

        @staticmethod
        def decode_float(x):
            # these stations send a value of -9999 to indicate no value, so
            # convert that to a proper None.
            x = Consumer.Parser.decode_float(x)
            return None if x == -9999 else x
.../


Thanks

Le dimanche 11 avril 2021 à 02:38:45 UTC+2, [email protected] a écrit :

    post your gw1000 config especially map. suspect you are
    accumulating an already-accumulated count

    On 11 Apr 2021, at 7:12 am, Johann Destombes <[email protected]>
    wrote:

    The GW1000 show 5 lightnings, this number is ok on the WS View
    apps and onecowitt.net <http://ecowitt.net/>but it's now more
    than 1000 on weewx database....

--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e6761a59-bb0f-40c1-b2a5-9d22898fa869n%40googlegroups.com <https://groups.google.com/d/msgid/weewx-user/e6761a59-bb0f-40c1-b2a5-9d22898fa869n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e34eb9c3-9159-9257-71ea-d5f73a58b768%40gmail.com.

Reply via email to