2023 Jun 11, 02:25 AM
Dan,
Still hacking away on my weewx weather station plug in prototype.
I've been scanning the code to understand how the enable/disable program works. The HTTP method is useful and SF for my shell script implementation. However, as I'm implementing the plugin I can't see a variable or list that handles program enables. I see that urls.py and webpages.py is the way the the HTTP method accesses the programData.json file to handle enable/disable.
Also I see that gv.pd is the load of program data into sip.py for use executing programs.
Here is my higher level reasoning, I have programs setup to handle my lawn sections, and programs for my veggy garden drip and another program for shrub drips. I use a monthly data json file to enable watering for the three program types. I use lawn as the system enable/disable and programs are always enabled since lawn has the largest window in months (system off in the cold/rainy months). Once system enabled for lawn, I want to enable/disable veggy garden and shrubs programs based on the growing/hot dry months of the year (May,Jun,July,Aug...)
Any thoughts on the best way for a plugin to modify the programData.json?
Should I use: u"/ep" variable to "fake" a GET request via the plugin?
or
just use:
gv.pd[pid]["enabled"] = int(["1/0"])
jsave(gv.pd, "programData")
in the plugin?
I have messed around a bit and programData seems to be a dict, which I have not handled yet in python. Seems that a for loop can find the index of an item in the dict and then I can change then enabled entry in that item.
Thanks,
Bryan
Still hacking away on my weewx weather station plug in prototype.
I've been scanning the code to understand how the enable/disable program works. The HTTP method is useful and SF for my shell script implementation. However, as I'm implementing the plugin I can't see a variable or list that handles program enables. I see that urls.py and webpages.py is the way the the HTTP method accesses the programData.json file to handle enable/disable.
Also I see that gv.pd is the load of program data into sip.py for use executing programs.
Here is my higher level reasoning, I have programs setup to handle my lawn sections, and programs for my veggy garden drip and another program for shrub drips. I use a monthly data json file to enable watering for the three program types. I use lawn as the system enable/disable and programs are always enabled since lawn has the largest window in months (system off in the cold/rainy months). Once system enabled for lawn, I want to enable/disable veggy garden and shrubs programs based on the growing/hot dry months of the year (May,Jun,July,Aug...)
Any thoughts on the best way for a plugin to modify the programData.json?
Should I use: u"/ep" variable to "fake" a GET request via the plugin?
or
just use:
gv.pd[pid]["enabled"] = int(["1/0"])
jsave(gv.pd, "programData")
in the plugin?
I have messed around a bit and programData seems to be a dict, which I have not handled yet in python. Seems that a for loop can find the index of an item in the dict and then I can change then enabled entry in that item.
Thanks,
Bryan