hello tom,
hopefully a simple fix that can make it into 4.3.0...
problem:
weewx 4.2.0 simulator crashes when i specify the list of observations to include
weewx.conf extract:
(note: ‘observations = ‘ line is one line. the line break is an artifact of
copy&paste)
[GeSimulator]
# This section is for the weewx weather station simulator
# The time (in seconds) between LOOP packets.
loop_interval = 2.5
# The simulator mode can be either 'simulator' or 'generator'.
# Real-time simulator. Sleep between each LOOP packet.
mode = simulator
# Generator. Emit LOOP packets as fast as possible (useful for testing).
#mode = generator
# The start time. Format is YYYY-mm-ddTHH:MM. If not specified, the default
# is to use the present time.
#start = 2011-01-01T00:00
# list of variables for simulator to generate.
# note: if this is specified, only these will be produced
# remove PM2.5 and AQI variables
observations =
inTemp,barometer,pressure,windSpeed,windDir,windGust,windGustDir,outHumidity,inHumidity,radiation,UV,rain,txBatteryStatus,windBatteryStatus,rainBatteryStatus,outTempBatteryStatus,inTempBatteryStatus,consBatteryVoltage,heatingVoltage,supplyVoltage,referenceVoltage,rxCheckPercent,altOutTemp,altInTemp,altPressure,altWindSpeed,altWindDir,altWindGust,altWindGustDir,altOutHumidity,altInHumidity,altRain,luminosity,solarEnergy,soilMoist1,soilMoist2,riverLevel,extraTemp1,wh40_batt,wh41_ch1_batt,wh41_ch2_batt,wh51_ch1_batt,wh51_ch2_batt,wh57_batt,ws80_batt
# The driver to use:
driver = user.gesimulator
log extract:
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL weewx.engine: **** File
"/opt/weewx-4.2.0-test/bin/weewx/drivers/simulator.py", line 139, in __init__
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL weewx.engine: ****
self.trim_observations(stn_dict)
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL weewx.engine: **** File
"/opt/weewx-4.2.0-test/bin/weewx/drivers/simulator.py", line 144, in
trim_observations
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL weewx.engine: ****
desired = [x.strip() for x in stn_dict['observations'].split(',')]
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL weewx.engine: ****
AttributeError: 'list' object has no attribute 'split'
Dec 26 14:01:36 dizzy weewx-test[332] CRITICAL __main__: Unable to load driver:
'list' object has no attribute 'split'
rationale:
clearly the ‘observations =‘ line has been parsed as a list not as a string so
split() fails
suggested fix:
weewx.drivers.simulator replace line 144 from
desired = [x.strip() for x in stn_dict['observations'].split(',')]
to
desired = stn_dict['observations']
if isinstance(desired, str):
# convert comma-separated string to list
desired = [x.strip() for x in desired.split(',')]
cheers
--
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/419112CF-BA4B-4B03-B7E3-E07B95F04DEA%40gmail.com.