sdr packets timezone differ from rtl_433 packets timezone

57 views
Skip to first unread message

vince

unread,
Mar 3, 2024, 3:10:52 PM3/3/24
to weewx-user
I'm fiddling on the side with the SDR driver trying to help another user set up weewx with the sdr driver but have run into some oddities here on my system.

Short description is the packets as decoded by the sdr driver have a dateTime that is many hours behind reality. 

The sdr driver is generating packets with a dateTime that is behind localtime reality by the exact number of hours as my GMT offset here (8 hours)

Yet the system clock on the os looks correct, syslog logs correctly, etc. in every other way.   Here are the details....

~/weewx-data/bin/user$ date
Sun Mar  3 11:40:44 AM PST 2024

~/weewx-data/bin/user$ date -u
Sun Mar  3 07:40:46 PM UTC 2024

~/weewx-data/bin/user$ timedatectl status
               Local time: Sun 2024-03-03 11:41:20 PST
           Universal time: Sun 2024-03-03 19:41:20 UTC
                 RTC time: Sun 2024-03-03 19:41:20
                Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: yes
              NTP service: n/a
          RTC in local TZ: no


From the syslogs...
2024-03-03T11:25:39.336424-08:00 nuc weewxd[9124]: DEBUG user.sdr: packet={'extraTemp1': 19.9, 'extraHumid1': 44.0, 'batteryStatus1': 1, 'dateTime': 1709465136, 'usUnits': 17}

Then decoding the dateTime....
~/weewx-data/bin/user$ date -d @1709465136
Sun Mar  3 03:25:36 AM PST 2024


==> note the decoded dateTime is off by 8 hours.....

But when using rtl_433 directly....
{"time" : "2024-03-03 11:39:21", "model" : "AmbientWeather-WH31B", "id" : 202, "channel" : 5, "battery_ok" : 1, "temperature_C" : 4.600, "humidity" : 87, "data" : "785c000000", "mic" : "CRC"}

Note the rtl_433 time is correct.

So there's a bug or misconfiguration somewhere but I'm not sure where:
  • system clock looks correct
  • rtl_433 decodes the dateTime correctly
  • but weewx sdr is off by 8 hours
  • and the result also seems to be that weewx doesn't save anything to the archive table at all.  It doesn't even seem to try from what I can see with debug=1.  Could that be due to the dateTime SDR is generating being 8 hours slow ?
weewx.conf snippet is as follows:

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

    # The driver to use
    driver = user.sdr
    cmd = rtl_433

    log_unknown_sensors  = True
    log_unmapped_sensors = True

    log_duplicate_readings = False # patched sdr.py to quiet logs down 
    log_packets            = True # patched sdr.py to quiet logs down

    [[sensor_map]]
        extraTemp1     = temperature.145.AmbientWH31BPacket
        extraHumid1    = humidity.145.AmbientWH31BPacket
        batteryStatus1 = battery.145.AmbientWH31BPacket

        extraTemp2     = temperature.153.AmbientWH31BPacket
        extraHumid2    = humidity.153.AmbientWH31BPacket
        batteryStatus2 = battery.153.AmbientWH31BPacket

        extraTemp3     = temperature.196.AmbientWH31BPacket
        extraHumid3    = humidity.196.AmbientWH31BPacket
        batteryStatus3 = battery.196.AmbientWH31BPacket

        extraTemp4     = temperature.55.AmbientWH31BPacket
        extraHumid4    = humidity.55.AmbientWH31BPacket
        batteryStatus4 = battery.55.AmbientWH31BPacket

        extraTemp5     = temperature.202.AmbientWH31BPacket
        extraHumid5    = humidity.202.AmbientWH31BPacket
        batteryStatus5 = battery.202.AmbientWH31BPacket

        outTemp              = temperature.35.AmbientWH31BPacket
        outHumidity          = humidity.35.AmbientWH31BPacket
        outTempBatteryStatus = battery.35.AmbientWH31BPacket

        soilMoist1 = soil_moisture_percent.001260.FOWH51Packet

I did patch sdr.py to add a couple new sensor types it didn't know about and also to be able to more discretely control logging.  The upstream version is a bit verbose when debug=1 (I'd be happy to PR those).   I didn't do anything to alter how sdr.py actually does its thing in decoding packets it hears via rtl_433.

Sensors are all ecowitt and I did verify in the ecowitt gateway app that its timezone is set correctly but given I'm sniffing RF via SDR, I'm guessing it doesn't really matter what the ecowitt iphone app is set to do (?)

~/.config/rtl_433/rtl_433.conf has nothing time-related in it
frequency 915M
output json


Suggestions or pointers to where anybody's run into this before appreciated....


Stefanos Kalaitzis

unread,
Mar 3, 2024, 3:43:52 PM3/3/24
to weewx...@googlegroups.com
I think in the command you can use utc option .. something like this 

cmd = /usr/local/bin/rtl_433 -M utc -F json -f 868.2M -R 172

--
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/08103768-5d95-4066-8274-c1fac496073dn%40googlegroups.com.

vince

unread,
Mar 3, 2024, 4:15:57 PM3/3/24
to weewx-user
Perfect.  Wow I definitely read the rtl_433 usage backwards.  Thanks !!!

Stefanos Kalaitzis

unread,
Mar 3, 2024, 4:19:17 PM3/3/24
to weewx...@googlegroups.com
You helped me so many times here.... So i am happy that i gave you a little hand ☺️ 👌

--
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.
Reply all
Reply to author
Forward
0 new messages