Open mrneutron42 opened 2 months ago
rtl_433 -f 433932000 -X 'n=atlas,m=OOK_PWM,s=216,l=396,r=568,g=0,t=0,y=588' produces:
time : 2023-10-07 17:11:59 model : AmbientWeather-TX8300 id : 17 channel : 1 Battery : 2 Temperature: 16.2 C MIC : CHECKSUM
I manually added lines to sdr.py for the Ambient TX8300 sensor in 2021 when using sdr.py ver.78. Adding these lines worked and I got valid data.
class AmbientTX8300Packet(Packet): # {"time" : "2021-06-14 21:38:43", "model" : "AmbientWeather-TX8300", "id" : 116, "channel" : 1, "battery" : 2, "temperature_C" : 28.500, "mic" : "CHECKSUM"} IDENTIFIER = "AmbientWeather-TX8300" @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['battery'] = 0 if Packet.get_int(obj, 'battery') == '0' else 1 pkt['channel'] = Packet.get_int(obj, 'channel') return AmbientTX8300Packet.insert_ids(pkt) @staticmethod def insert_ids(pkt): station_id = pkt.pop('station_id', '0000') pkt = Packet.add_identifiers(pkt, station_id, AmbientTX8300Packet.__name__) return pkt
In 2023 I updated to sdr.py ver.86 and my code for the TX8300 didn't work any more. So, I tried altering to match the other sensor definition patters in sdr.py but that yielded a "not defined" error.
class AmbientTX8300Packet(Packet): # {"time" : "2021-06-14 21:38:43", "model" : "AmbientWeather-TX8300", "id" : 116, "channel" : 1, "battery" : 2, "temperature_C" : 28.500, "mic" : "CHECKSUM"} IDENTIFIER = "AmbientWeather-TX8300" @staticmethod def parse_json(obj): pkt = dict() pkt['dateTime'] = Packet.parse_time(obj.get('time')) pkt['usUnits'] = weewx.METRIC pkt['station_id'] = obj.get('id') pkt['channel'] = Packet.get_int(obj, 'channel') pkt['battery'] = 0 if Packet.get_int(obj, 'battery') == '0' else 1 pkt['temperature'] = Packet.get_float(obj, 'temperature_C') pkt = Packet.add_identifiers(pkt, station_id, AmbientTX8300Packet.__name__) return pkt
ERROR READOUT in /var/log/syslog: Jul 10 21:29:25 rpi3b weewx[8581] INFO user.sdr: shutdown complete Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: Caught unrecoverable exception: Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** name 'station_id' is not defined Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** Traceback (most recent call last): Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/weewxd", line 157, in main Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** engine.run() Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 208, in run Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** for packet in self.console.genLoopPackets(): Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/user/sdr.py", line 3290, in genLoopPackets Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** for packet in PacketFactory.create(lines): Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/user/sdr.py", line 3145, in create Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** pkt = PacketFactory.parse_json(lines) Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/user/sdr.py", line 3161, in parse_json Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** return parser.parse_json(obj) Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** File "/home/weewx/bin/user/sdr.py", line 1127, in parse_json Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** pkt = Packet.add_identifiers(pkt, station_id, AmbientTX8300Packet.__name__) Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** NameError: name 'station_id' is not defined Jul 10 21:29:25 rpi3b weewx[8581] CRITICAL __main__: **** Exiting.
So, I tried a tweak and this does not produce errors. Is this the right way to structure the code for ver.86?
class AmbientTX8300Packet(Packet): # {"time" : "2021-06-14 21:38:43", "model" : "AmbientWeather-TX8300", "id" : 116, "channel" : 1, "battery" : 2, "temperature_C" : 28.500, "mic" : "CHECKSUM"} IDENTIFIER = "AmbientWeather-TX8300" @staticmethod def parse_json(obj): pkt = dict() pkt['dateTime'] = Packet.parse_time(obj.get('time')) pkt['usUnits'] = weewx.METRIC 'station_id' = obj.get('id') pkt['temperature'] = Packet.get_float(obj, 'temperature_C') pkt['battery'] = 0 if Packet.get_int(obj, 'battery') == '0' else 1 pkt['channel'] = Packet.get_int(obj, 'channel') pkt = Packet.add_identifiers(pkt, station_id, AmbientTX8300Packet.__name__) return pkt
Please help. Eric
rtl_433 -f 433932000 -X 'n=atlas,m=OOK_PWM,s=216,l=396,r=568,g=0,t=0,y=588' produces:
time : 2023-10-07 17:11:59 model : AmbientWeather-TX8300 id : 17 channel : 1 Battery : 2 Temperature: 16.2 C MIC : CHECKSUM
I manually added lines to sdr.py for the Ambient TX8300 sensor in 2021 when using sdr.py ver.78. Adding these lines worked and I got valid data.
In 2023 I updated to sdr.py ver.86 and my code for the TX8300 didn't work any more. So, I tried altering to match the other sensor definition patters in sdr.py but that yielded a "not defined" error.
So, I tried a tweak and this does not produce errors. Is this the right way to structure the code for ver.86?
Please help. Eric