The problem with using open_manager_with_config is that you have to make
assumptions about which database binding is being used.

Off the top of my head, here are 3 alternative solutions:
1. You could cache the previous value.
2. You could fix the problem downstream by using a weewx service.
3. You could use multiple inheritance, so your driver inherits both from
weewx.drivers.AbstractDevice and from weewx.engine.StdService. Getting a
database manager is then easy:

dbmanager = self.engine.db_binder.get_manager(self.data_binding)

See the Vantage driver for an example of using multiple inheritance
(although it does not access the database).

But, really, you should relocate the sensor!

-tk



On Sun, Jul 2, 2023 at 12:50 PM [email protected] <[email protected]>
wrote:

> I have a customized Acurite driver where I've replaced the temperature
> reading with a reading from a different sensor. My sensor is placed so that
> I occasionally get temperature spikes in the late afternoon when the sun
> hits it. I've tried to shield it without complete success. I'm looking for
> a software solution where I can remove the bad values for the 10 minutes a
> day where it can jump up 5 degrees.
>
> I think I know how to do this, but I'm stuck on getting the previous
> temperature value in the driver. Is there an easy way to do this?
>
> The docs suggest  weewx.manager.open_manager_with_config with the
> appropriate SQL query is the way to go. Is it?
>
> --
> 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/9d0abdbe-8cf6-4d8b-b809-c295df20e564n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/9d0abdbe-8cf6-4d8b-b809-c295df20e564n%40googlegroups.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zECTzF8QPAJ3f66usQza%2BekWZLZ5nQUtbsQHOTLr5mBZow%40mail.gmail.com.

Reply via email to