On Monday, February 13, 2017 at 9:28:05 PM UTC-5, susan wrote:
>
> Thanks for the feedback. I'll plead 'guilty' to not bumping the version 
> number, but I've just downloaded and expanded the file I attached above and 
> the line in the 'install.py' file that I think drives all this is:
>
>                     'retry_wait' : 5,
>                     'driver' : 'user.HP1000Driver'}},
>
>
> Am I not looking in the right place?
>


susan,

1) you should rename the file to hp1000.py

2) the 'driver' field refers to the python module in which the driver code 
resides.  so you want 'user.hp1000' (assuming that you lowercase the 
filename)

3) do not include extra stuff in install.py.  all you need is this:

# installer for 
HP1000DRIVER                                                    
# Copyright 2017 Susan 
Mackay                                                   

from setup import ExtensionInstaller

def loader():
    return HP1000Installer()

class HP1000Installer(ExtensionInstaller):
    def __init__(self):
        super(ProcessHP1000Installer, self).__init__(
            version="0.1",
            name='hp1000',
            description='Driver for the HP1000 weather stations.',
            author="Susan Mackay",
            author_email="[email protected]",
            files=[('bin/user', ['bin/user/hp1000.py'])]
            )
 
in particular, there is no need for all of the configuration options.  
first of all, the driver should default to sane values when none are 
specified.  secondly, for drivers, the ConfEditor does the actual insertion 
into the weewx config file.

4) you should automatically detect the netmask so that the user does not 
have to specify it.  default to using the string '<broadcast>', but if a 
user specifies a netmask then use the netmask they specify.

5) what is the difference between 'retry_count' and 'max_retry'?  you might 
want to use names that are more descriptive for those parameters.

6) the hardware_name property should be the hardware model name, such as 
WS1001 or XC0422.  typically this is an optional 'model' parameter in the 
driver stanza.  is the value you decode from data[0:8] a model number, or 
some kind of station name set by a user?

7) you should use snake_case_variable_names instead of 
camelCaseVariableNames

m

Reply via email to