Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Tom Keffer
On Tue, Aug 11, 2020 at 10:03 AM Graham Eddy wrote: > i forgot to ask: start_ts is outside my __init__’s scope, so should i use > self.the_time? e.g. > import weewx.drivers.simulator as simulator > ... > # VP2 optional observations > self.observations['extraTemp1'] = simulator.Observation

Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Tom Keffer
That's why I added the method trim_observations(). It allows you to tailor this behavior. For example, you could override trim_observations() and have it add your new types before calling the subclass's version. Or, v-v (not sure exactly what you're trying to accomplish). On Tue, Aug 11, 2020 at 9

Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Graham Eddy
i forgot to ask: start_ts is outside my __init__’s scope, so should i use self.the_time? e.g. import weewx.drivers.simulator as simulator ... # VP2 optional observations self.observations['extraTemp1'] = simulator.Observation( magnitude=4.0, aver

Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Graham Eddy
close to working. but in my __init__, when i alter self.observations after calling super(..), it is after the ‘observations’ filter from weewx.conf has been applied. so, after carefully disabling some of my new value types by excluding them from ‘observations’ filter (Simulator.__init__ dutifull

Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Tom Keffer
Try this version of the simulator. It should be a little easier to subclass. On Tue, Aug 11, 2020 at 7:35 AM Tom Keffer wrote: > Why not just subclass class Simulator? In the __init__ function of your > new cla

Re: [weewx-user] Simulator - enhancement req - add new value generators

2020-08-11 Thread Tom Keffer
Why not just subclass class Simulator? In the __init__ function of your new class, call the superclass's initializer, then add additional types to self.observations. You would also have to provide your own loader() function, which would largely replicate the logic in the existing loader(). But, I