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 take your point: class Simulator could be structured to make it
easier to subclass and provide specialized simulators.

-tk


On Tue, Aug 11, 2020 at 6:43 AM Graham Eddy <graham.e...@gmail.com> wrote:

> enhancement request to be able to add new value generators to
> weewx.drivers.Simulator from user.extensions (rather than edit a private
> copy)
>
> easiest way i see is to just move self.observations to class attribute and
> let folk extend the list. this would be facilitated by an abstract class
> for Observation, Rain, Solar, BatteryStatus, BatteryVoltage, SignalStrength
> of form
>
> class AbstractObservation(object):
>   def value_at(self, time_ts):
>   raise NotImplementedError
>
> for developers to subclass their own value generators. mind you, the
> existing ones are pretty flexible - i used BatteryStatus as stimulus for
> lightning_strike_count.
> otherwise, to avoid class attribute, could add method like
> add_observation_type(obs_type, value_generator)
>
> --
> 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 weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/A9B73A87-8EC7-4B37-8458-5FDA979FC4CF%40gmail.com
> <https://groups.google.com/d/msgid/weewx-user/A9B73A87-8EC7-4B37-8458-5FDA979FC4CF%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEChXphK517y0nc39hGBLQSmGcSgAb%2B1jppcdiPDvo_7ww%40mail.gmail.com.

Reply via email to