weewx fails to boot because of station name?

50 views
Skip to first unread message

Chris Richmond

unread,
Jun 18, 2019, 10:15:32 AM6/18/19
to weewx-user
I bought a VantageVue, and I thought I had this working once, but trying to get weewx going again,
and it's failing to boot.  It's set up almost exactly like the VP2 I've had running a couple of years.  The relevant
config is below, as are the errors.  It turns out that the station_type name has to match the DRIVER_NAME in the
associated driver.py.  With the try/except in engine.py commented out I can see this:

    return VantageService(engine, config_dict)
  File "/home/weewx/bin/weewx/drivers/vantage.py", line 1828, in __init__
    Vantage.__init__(self, **config_dict[DRIVER_NAME])
  File "/usr/lib/python2.7/dist-packages/configobj.py", line 554, in __getitem__
    val = dict.__getitem__(self, key)
KeyError: 'Vantage'

There's no config section called Vantage, so configobj fails the look-up.  Once I changed
the station_type to Vantage, I get past this and fail for not being sudo'd, which is fine at
the moment since it isn't related.  I guess after all this messing around, I didn't put 2 + 2 together
that the station_type value was something more that a config section name.  The basic log
message wasn't particularly helpful either, and the stack dumps take some getting used to.

Chris

Without the try/except commented, this is all that shows up in the syslog:
Jun 18 05:58:45 pi2c weewx[3509]: engine: Initializing weewx version 3.9.1
Jun 18 05:58:45 pi2c weewx[3509]: engine: Using Python 2.7.13 (default, Sep 26 2018, 18:42:22) #012[GCC 6.3.0 20170516]
Jun 18 05:58:45 pi2c weewx[3509]: engine: Platform Linux-4.19.42+-armv6l-with-debian-9.9
Jun 18 05:58:45 pi2c weewx[3509]: engine: Locale is 'C'
Jun 18 05:58:45 pi2c weewx[3509]: engine: pid file is /home/weewx/vue.pid
Jun 18 05:58:45 pi2c weewx[3513]: engine: Using configuration file /home/weewx/weewx.conf
Jun 18 05:58:46 pi2c weewx[3513]: engine: Debug is 1
Jun 18 05:58:46 pi2c weewx[3513]: engine: Initializing engine
Jun 18 05:58:46 pi2c weewx[3513]: engine: Loading station type VantageVue (weewx.drivers.vantage)
Jun 18 05:58:46 pi2c weewx[3513]: import of driver failed: 'Vantage' (<type 'exceptions.KeyError'>)
Jun 18 05:58:46 pi2c weewx[3513]: engine: Unable to load driver: 'Vantage'
Jun 18 05:58:46 pi2c weewx[3513]:     ****  Exiting...


pi2c_/home/weewx> more weewx.conf
debug = 1
WEEWX_ROOT = /home/weewx

# Whether to log successful operations
log_success = True

# Whether to log unsuccessful operations
log_failure = True
socket_timeout = 20
version = 3.9.1

[Station]
    location = Oregon 97007
    latitude = 45.46
    longitude = -122.88
    altitude = 335, foot
    station_type = VantageVue
    rain_year_start = 8
    week_start = 6
[VantageVue]
    type = serial
    port = /dev/serial0
    baudrate = 19200
    iss_id = 2
    timeout = 4
    wait_before_retry = 1.2
    max_tries = 4
    model_type = 2
    driver = weewx.drivers.vantage


mwall

unread,
Jun 18, 2019, 3:15:54 PM6/18/19
to weewx-user
On Tuesday, June 18, 2019 at 10:15:32 AM UTC-4, Chris Richmond wrote:
I bought a VantageVue, and I thought I had this working once, but trying to get weewx going again,
and it's failing to boot.  It's set up almost exactly like the VP2 I've had running a couple of years.  The relevant
config is below, as are the errors.  It turns out that the station_type name has to match the DRIVER_NAME in the
associated driver.py.

that depends on the driver.


VantageVue, VantagePro, etc are all served by the Vantage driver; you should use Vantage as the station_type 

there must be a stanza in the configuration file whose name matches whatever you specify for station_type.  the driver field in that stanza indicates where to find the driver.  most drivers use the station_type as a key for many configuration options.

although editing the configuration directly will work just fine, you can avoid these issues and ensure that all of the per-driver options are set properly by using the wee_config tool (see the weewx user guide for details).  it works with any driver that implements the right methods.

for many types of hardware, the wee_device utility will let you talk directly with the hardware to change its settings.

m

Chris Richmond

unread,
Jun 18, 2019, 10:25:24 PM6/18/19
to weewx-user
Thanks.  I'm suspecting the time it did work was when I reinstalled and used the generated config.
Since this case is about finding config data, the block that failed could be getting the config section
by getting the value from station_type = <value> in Station, then doing the lookup.  That would disconnect
the DRIVEE_NAME from the config section name (for better or worse).  If there are more than a couple of
other places where driver name is used like that, the discussion is over.  :^)

Chris

Reply all
Reply to author
Forward
0 new messages