On Monday, June 8, 2020 at 6:04:16 PM UTC-4, Timothy Witham wrote:
>
> Hello,
>
> Just replaced my wview with weewx yesterday and like the results so far,
> thanks!
>
> But now I need to run a command after the archive is updated. In wview
> this was easy: just stick any command lines in post-generate.sh and they
> were executed. I fail to find an equivalent feature to "shell out" of the
> python and run external commands from weewx. It appears I would need to
> invent a new shellreport.py which would run the commands configured in the
> config file. Is this the correct approach? Or is there an easier way I am
> missing?
>
one approach is to create a service and bind it to archive events. each
time an archive happens, your service is invoke. then all you have to do
in the service is call out to your perl script. it would look something
like this:
from weewx.engine import StdService
class UpdateRRD(StdService):
def __init__(self, engine, config_dict):
super(UpdateRRD, self).__init__(engine, config_dict)
self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
def new_archive_record(self, event):
subprocess.call(["fancy-perl-program.pl"])
not sure how you get data to your perl script, but all of the fields are
available in event.record
see "Customizing the weewx service engine" in the customization guide for
more examples:
http://weewx.com/docs/customizing.htm#service_engine
another approach would be to use python bindings to rrd to do the updates
directly. i used to do that before i found influx and grafana...
m
--
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/940b5551-1980-4b1f-8194-4f869ce882b3o%40googlegroups.com.