James Pattinson schrieb am Montag, 30. September 2024 um 09:08:00 UTC+2:

That's a good idea. My Python skills aren't brilliant (I still write 
scripts like I'm in the 1990s) but I had considered writing a script 
totally outside of WeeWX to subscribe to the MQTT topics, perform this 
calculation, and emit the average. Doing with a WeeWX service would be a 
more elegant solution, so I will take a look at some examples.


Such a service would look like this:

*class *YourService(StdService):


    *def *__init__(self, engine, conf_dict):

        super(YourService,self).__init__(engine, conf_dict)

        self.wind_readings_cache = []

        self.bind(weewx.NEW_LOOP_PACKET, self.new_loop_packet)


    *def *new_loop_packet(self, event):

        wind = event.packet.get('windSpeed')

        if wind is not None:

            # do some calculations involving self.wind_readings_cache

            event.packet['windSpeedAvg'] = ...


 This is a rough sketch. There are more details to consider to complete 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/32a2ef9a-2fdb-4a16-9df6-719bc399b094n%40googlegroups.com.

Reply via email to