Driver for Tenx 1130:0829?

459 views
Skip to first unread message

Sven Täveby

unread,
Nov 10, 2020, 2:50:23 PM11/10/20
to weewx-user
Hi.
I've struggled for some time with a weewx installation with a byows station. Kind of odd hw.
So now I bought a "standard" weather station to keep it simple.
However, the lsusb show Bus 001 Device 007: ID 1130:0829 Tenx Technology, Inc.
I tried the te923 driver but no luck.
Googled but no luck..
Any advice on how to go forward?
I tried editing the te923 driver with the new device id, but got stuck on memory size.

Cheers
/Sven T
Stockholm, Sweden

lsusb -v
Bus 001 Device 007: ID 1130:0829 Tenx Technology, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x1130 Tenx Technology, Inc.
  idProduct          0x0829
  bcdDevice            1.00
  iManufacturer           1 TENX
  iProduct                2 TMU313X USB R/W64
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      39
          Report Descriptor: (length is 39)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x40 ] 64
            Item(Global): Report Count, data= [ 0x08 ] 8
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfie                                                                                                                               ld
            Item(Global): Report Count, data= [ 0x08 ] 8
            Item(Global): Report Size, data= [ 0x40 ] 64
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                            (null)
            Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                            (null)
            Item(Main  ): Input, data= [ 0x00 ] 0
                            Data Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfie                                                                                                                               ld
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

**************************'''
syslog
Nov 10 20:48:34 mirrorpi weewx[3213] INFO weewx.engine: Loading station type TE923 (weewx.drivers.te923)
Nov 10 20:48:34 mirrorpi weewx[3213] INFO weewx.drivers.te923: driver version is 0.41.1
Nov 10 20:48:34 mirrorpi weewx[3213] INFO weewx.drivers.te923: polling interval is 10
Nov 10 20:48:34 mirrorpi weewx[3213] INFO weewx.drivers.te923: sensor map is {'extraBatteryStatus1': 'bat_2', 'outTemp': 't_1', 'outHumidity': 'h_1', 'extraHumid4': 'h_5', 'uvBatteryStatus': 'bat_uv', 'extraHumid2': 'h_3', 'extraHumid3': 'h_4', 'rainLinkStatus': 'link_rain', 'extraHumid1': 'h_2', 'rainBatteryStatus': 'bat_rain', 'extraTemp2': 't_3', 'extraTemp4': 't_5', 'uvLinkStatus': 'link_uv', 'windLinkStatus': 'link_wind', 'outLinkStatus': 'link_1', 'extraBatteryStatus2': 'bat_3', 'extraBatteryStatus3': 'bat_4', 'windBatteryStatus': 'bat_wind', 'outTempBatteryStatus': 'bat_1', 'extraBatteryStatus4': 'bat_5', 'extraTemp3': 't_4', 'extraLinkStatus1': 'link_2', 'extraLinkStatus2': 'link_3', 'extraLinkStatus3': 'link_4', 'extraLinkStatus4': 'link_5', 'inTemp': 't_in', 'inHumidity': 'h_in', 'extraTemp1': 't_2'}
Nov 10 20:48:34 mirrorpi weewx[3213] INFO weewx.drivers.te923: Found device on USB bus= device=
Nov 10 20:48:34 mirrorpi weewx[3213] DEBUG weewx.drivers.te923: read: address 0x0000fc
Nov 10 20:48:34 mirrorpi weewx[3213] ERROR weewx.engine: Import of driver failed: Invalid endpoint address 0x81 (<type 'exceptions.ValueError'>)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 109, in setupStation
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 460, in loader
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      return TE923Driver(**config_dict[DRIVER_NAME])
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1141, in __init__
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      self.station.open()
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1561, in open
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      self.read_memory_size()
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1756, in read_memory_size
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      buf = self._read(0xfc)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1726, in _read
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      buf = self._raw_read(addr)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1603, in _raw_read
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      self.ENDPOINT_IN, self.READ_LENGTH, self.TIMEOUT)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/legacy.py", line 188, in interruptRead
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      return self.dev.read(endpoint, size, timeout)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/core.py", line 975, in read
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      intf, ep = self._ctx.setup_request(self, endpoint)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      return f(self, *args, **kwargs)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/core.py", line 215, in setup_request
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      intf, ep = self.get_interface_and_endpoint(device, endpoint_address)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      return f(self, *args, **kwargs)
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/usb/core.py", line 231, in get_interface_and_endpoint
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****      raise ValueError('Invalid endpoint address ' + hex(endpoint_address))
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL weewx.engine:     ****  ValueError: Invalid endpoint address 0x81
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL __main__: Unable to load driver: Invalid endpoint address 0x81
Nov 10 20:48:34 mirrorpi weewx[3213] CRITICAL __main__:     ****  Exiting...

Stein Arne Storslett

unread,
Aug 26, 2022, 8:45:11 AM8/26/22
to weewx-user
Editing the ENDPOINT_IN to `0x83` in `/usr/share/weewx/weewx/drivers/te923.py` gets past this, but I only get a timeout.

`Aug 26 14:39:36 hostname wee_device[37965] ERROR weewx.drivers.te923: Failed attempt 10 of 10 to read data: [Errno 110] Operation timed out`

Stein Arne Storslett

unread,
Aug 26, 2022, 9:10:25 AM8/26/22
to weewx-user
There is probably a better way, and I'm not there yet, but here are the changes:

    $ diff /usr/share/weewx/weewx/drivers/te923.py{,-20220826}
    1503c1503
    <     ENDPOINT_IN = 0x81
    ---
    >     ENDPOINT_IN = 0x83  # 0x81
    1513c1513,1514
    <     def __init__(self, vendor_id=0x1130, product_id=0x6801,
    ---
    >     #def __init__(self, vendor_id=0x1130, product_id=0x6801,
    >     def __init__(self, vendor_id=0x1130, product_id=0x0829,


Still only get a timeout.

    Aug 26 15:04:43 hostname systemd[1]: Starting LSB: weewx weather system...
    Aug 26 15:04:43 hostname weewx[40158]:  * Starting weewx weather system weewx
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Initializing weewx version 4.8.0
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Using Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Platform Linux-5.15.0-46-generic-x86_64-with-glibc2.35
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Locale is 'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=nb_NO.UTF-8;LC_TIME=nb_NO.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=nb_NO.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=nb_NO.UTF-8;LC_NAME=nb_NO.UTF-8;LC_ADDRESS=nb_NO.UTF-8;LC_TELEPHONE=nb_NO.UTF-8;LC_MEASUREMENT=nb_NO.UTF-8;LC_IDENTIFICATION=nb_NO.UTF-8'
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Using configuration file /etc/weewx/weewx.conf
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: Debug is 0
    Aug 26 15:04:43 hostname weewx[40169] INFO __main__: PID file is /var/run/weewx.pid
    Aug 26 15:04:43 hostname weewx[40172] INFO weewx.engine: Loading station type TE923 (weewx.drivers.te923)
    Aug 26 15:04:43 hostname weewx[40172] INFO weewx.drivers.te923: driver version is 0.41.1
    Aug 26 15:04:43 hostname weewx[40172] INFO weewx.drivers.te923: polling interval is 60
    Aug 26 15:04:43 hostname weewx[40172] INFO weewx.drivers.te923: sensor map is {'windLinkStatus': 'link_wind', 'windBatteryStatus': 'bat_wind', 'rainLinkStatus': 'link_rain', 'rainBatteryStatus': 'bat_rain', 'uvLinkStatus': 'link_uv', 'uvBatteryStatus': 'bat_uv', 'inTemp': 't_in', 'inHumidity': 'h_in', 'outTemp': 't_1', 'outHumidity': 'h_1', 'outTempBatteryStatus': 'bat_1', 'outLinkStatus': 'link_1', 'extraTemp1': 't_2', 'extraHumid1': 'h_2', 'extraBatteryStatus1': 'bat_2', 'extraLinkStatus1': 'link_2', 'extraTemp2': 't_3', 'extraHumid2': 'h_3', 'extraBatteryStatus2': 'bat_3', 'extraLinkStatus2': 'link_3', 'extraTemp3': 't_4', 'extraHumid3': 'h_4', 'extraBatteryStatus3': 'bat_4', 'extraLinkStatus3': 'link_4', 'extraTemp4': 't_5', 'extraHumid4': 'h_5', 'extraBatteryStatus4': 'bat_5', 'extraLinkStatus4': 'link_5'}
    Aug 26 15:04:43 hostname weewx[40158]:    ...done.
    Aug 26 15:04:43 hostname systemd[1]: Started LSB: weewx weather system.
    Aug 26 15:04:43 hostname weewx[40172] INFO weewx.drivers.te923: Found device on USB bus= device=
    Aug 26 15:04:44 hostname weewx[40172] ERROR weewx.drivers.te923: Failed attempt 1 of 5 to read data: [Errno 110] Operation timed out
    Aug 26 15:04:48 hostname weewx[40172] ERROR weewx.drivers.te923: Failed attempt 2 of 5 to read data: [Errno 110] Operation timed out
    Aug 26 15:04:53 hostname weewx[40172] ERROR weewx.drivers.te923: Failed attempt 3 of 5 to read data: [Errno 110] Operation timed out
    Aug 26 15:04:57 hostname weewx[40172] ERROR weewx.drivers.te923: Failed attempt 4 of 5 to read data: [Errno 110] Operation timed out
    Aug 26 15:05:01 hostname weewx[40172] ERROR weewx.drivers.te923: Failed attempt 5 of 5 to read data: [Errno 110] Operation timed out
    Aug 26 15:05:04 hostname weewx[40172] ERROR weewx.engine: Import of driver failed: Read failed after 5 tries (<class 'weewx.RetriesExceeded'>)
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 119, in setupStation
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 460, in loader
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      return TE923Driver(**config_dict[DRIVER_NAME])
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1141, in __init__
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      self.station.open()
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1562, in open
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      self.read_memory_size()
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1757, in read_memory_size
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      buf = self._read(0xfc)
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1737, in _read
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****      raise weewx.RetriesExceeded("Read failed after %d tries" %
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL weewx.engine:     ****  weewx.RetriesExceeded: Read failed after 5 tries
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL __main__: Unable to load driver: Read failed after 5 tries
    Aug 26 15:05:04 hostname weewx[40172] CRITICAL __main__:     ****  Exiting...

Sven Täveby

unread,
Aug 29, 2022, 4:55:14 AM8/29/22
to weewx-user
Great to see others interested. 
I will try to do something in the next weeks (heavy workload at the office right now).

/Sven

Stein Arne Storslett

unread,
Aug 29, 2022, 5:29:47 AM8/29/22
to weewx-user
So to be clear, what I did was connect via USB to the weather station console.
Outside unit reports to console, I wanted to read from the console.
It also bears to mention that the unit is "off site", i.e. at the cabin.

In my efforts I have seen some who have used RTL SDR units to get data directly from the outside unit - I have not tried that. Lack of an SDR unit .. and skills...

What I did have though was an old Windows based laptop lying around.
So I set that up to start the supplied WeatherHome software automatically on boot, which will populate the WeatherHome.mdb database file - MS Access I presume.
In addition I setup WSL - Windows Subsystem for Linux - and installed the "mdbtools" package.
Inside WSL, the "mdb-export" tool inside "mdbtools" was able to export data from "/mnt/c/ProgramData/WeatherHome/WeatherHome.mdb" and I could send that data back to my home server.

No, this is not a driver, but at least I'm getting data for now...

So the next thing is getting a proper mapping for "wee_import". Separate thread I guess.

Hans-Åke Lund

unread,
Sep 18, 2022, 11:12:38 AM9/18/22
to weewx-user
Any progress on the driver for the this Cotech weather station from Clas Ohlson (36-7959)?
I have started to try to understand its USB protocol by sniffing with Wireshark on WeatherHome running in VirtualBox.
/Hans-Åke

Hans-Åke Lund

unread,
Oct 23, 2022, 1:23:53 PM10/23/22
to weewx-user
I have now connected WeeWx to the Cotech 36-7959 Weathjer Station by using a RTL-SDR stick.

I downloaded sdr.py from https://github.com/matthewwall/weewx-sdr and added a decoder for Cotech.
<pre>
...
class Cotech367959Packet(Packet):
    # Cotech Weather Station, 36-7959 from Clas Ohlson. Created 2022-10-23
    # {"time" : "2022-10-23 13:44:53", "model" : "Cotech-367959", "id" : 31, "battery_ok" : 1, "temperature_C" : 11.500,"humidity": 99, "rain_mm" : 12.500, "wind_dir_deg" : 221, "wind_avg_m_s" : 1.300, "wind_max_m_s" : 1.700, "light_lux" : 69627, "uv" : 251, "mic" : "CRC"}

    IDENTIFIER = "Cotech-367959"

    @staticmethod
    def parse_json(obj):
        pkt = dict()
        pkt['dateTime'] = Packet.parse_time(obj.get('time'))
        pkt['usUnits'] = weewx.METRICWX
        pkt['station_id'] = obj.get('id')
        pkt['temperature'] = Packet.get_float(obj, 'temperature_C')
        pkt['humidity'] = Packet.get_float(obj, 'humidity')
        pkt['wind_dir'] = Packet.get_float(obj, 'wind_dir_deg')
        pkt['wind_speed'] = Packet.get_float(obj, 'wind_avg_m_s')
        pkt['wind_gust'] = Packet.get_float(obj, 'wind_max_m_s')
        pkt['rain_total'] = Packet.get_float(obj, 'rain_mm')
        pkt['uv_index'] = Packet.get_float(obj, 'uv')
        pkt['light'] = Packet.get_float(obj, 'light_lux')
        pkt['battery'] = 0 if Packet.get_float(obj, 'battery_ok') == 1 else 1
        return Cotech367959Packet.insert_ids(pkt)

    @staticmethod
    def insert_ids(pkt):
        station_id = pkt.pop('station_id', '0000')
        return Packet.add_identifiers(pkt, station_id, Cotech367959Packet.__name__)
...
</pre>
Configuration for Cotech added in weewx.conf
<pre>
...
##############################################################################

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

    # The driver to use
    driver = user.sdr
    cmd = rtl_433 -R 153 -C si -M utc -F json
    [[sensor_map]]
        rain_total = rain_total.31.Cotech367959Packet
        windGust = wind_gust.31.Cotech367959Packet
        windSpeed = wind_speed.31.Cotech367959Packet
        windDir = wind_dir.31.Cotech367959Packet
        outHumidity = humidity.31.Cotech367959Packet
        outTemp = temperature.31.Cotech367959Packet
        outBatteryStatus = battery.31.Cotech367959Packet

##############################################################################
...
</pre>
This seems to work well, although I do not get any barometer value as this is in the indoor unit.
Reply all
Reply to author
Forward
0 new messages