Closed wilcovh closed 2 years ago
Did you add your class to the list at the end? Run it from the command line and post the output
Andy
yes, did add following SpringfieldTMPacket, TFATwinPlus303049Packet, TSFT002Packet, WT0124Packet, Cotech367959Packet, ]
when when running command line result:
pi@raspberrypi:/home/weewx $ PYTHONPATH=bin python bin/user/sdr.py
Traceback (most recent call last):
File "bin/user/sdr.py", line 2534, in <module>
class PacketFactory(object):
File "bin/user/sdr.py", line 2594, in PacketFactory
Cotech367959Packet,
NameError: name 'Cotech367959Packet' is not defined
class Cotech367959(Packet) should be class Cotech367959Packet(Packet)
Device sends Temperature_C but Temperature_F is being used in the driver's, that will need to change along with how you treat the units. There are other measurement types that need to change also.
Ok thanks that sorted the problem. now I have parsed line that I can use in weewx corrected the battery link. device looks like it is sending temp in F according output before parsing. now only to make temp_C from temp_F in parsed line should I do this in sdr.py or Weewx.conf?
In sdr.py. Look through the different classes and find examples of the unit conversions you want.
managed get all sensors correct. corrected the UV, temperature and radiation in weewx.conf in the stdcalibrate section. the only thing left is the rain value that needed to be calculated as a delta. this is standard in sdr.py under default deltas rain = rain_total weewx does not receive the rain value, tried as suggested in top of sdr.py this same in weewx.conf under SDR part added [[deltas]] rain = rain_total and this did not work either. could not get it going. untill I realised while typing this mail and noticed the problem that weewx does not understand rain_total as such. weewx does understand rain = totalRain and now also recording the rain properly. All done.
@andylittle thanks for the help
so to sum up for future reference add to sdr.py
class Cotech367959Packet(Packet):
# This is for a Cotech 367959 which is the sensor array for an ACCUR8 DWS7100
# {"time" : "2021-10-08 15:29:36", "model" : "Cotech-367959", "id" : 188, "battery_ok" : 1, "temperature_F" : 70.500, "humidity" : 65, "rain_mm" : 0.300, "wind_dir_deg" : 86, "wind_avg_m_s" : 0.000, "wind_max_m_s" : 0.000, "light_lux" : 19310, "uv" : 5, "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_F')
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'] = Packet.get_float(obj, 'uv')
pkt['light'] = Packet.get_float(obj, 'light_lux')
pkt['battery'] = 0 if obj.get('battery_ok') == 'OK' 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__)
also add to KNOWN_PACKETS Cotech367959Packet,
then add to weewx.conf
[[sensor_map]]
# replace the 188 with your own sensor ID
outTemp = temperature.188.Cotech367959Packet
outHumidity = humidity.188.Cotech367959Packet
totalRain = rain_total.188.Cotech367959Packet
windDir = wind_dir.188.Cotech367959Packet
windSpeed = wind_gust.188.Cotech367959Packet
windGust = wind_speed.188.Cotech367959Packet
UV = uv.188.Cotech367959Packet
radiation = light.188.Cotech367959Packet
windBatteryStatus = battery.188.Cotech367959Packet #that is what I used to place the battery value.
[[deltas]]
rain = totalRain # derive rain from difference between successive rain_total
success
Good day Have a weather station above. would like to integrate via sdr. been trying myself to code in sdr.py but to no success so far. tried to modify the fine offset WH65B .
weewx is showing the following out out:[u'{"time" : "2021-10-08 19:36:48", "model" : "Cotech-367959", "id" : 188, "battery_ok" : 1, "temperature_F" : 57.100, "humidity" : 93, "rain_mm" : 3.900, "wind_dir_deg" : 44, "wind_avg_m_s" : 0.000, "wind_max_m_s" : 0.000, "light_lux" : 0, "uv" : 0, "mic" : "CRC"}\n', u'{"time" : "2021-10-08 19:36:48", "model" : "Cotech-367959", "id" : 188, "battery_ok" : 1, "temperature_F" : 57.100, "humidity" : 93, "rain_mm" : 3.900, "wind_dir_deg" : 44, "wind_avg_m_s" : 0.000, "wind_max_m_s" : 0.000, "light_lux" : 0, "uv" : 0, "mic" : "CRC"}\n'] but not parsed.
tried to add this:
but no result so far. who is happy to assist?