SIP
Plugin Education - Printable Version

+- SIP (https://nosack.com/sipforum)
+-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1)
+--- Forum: Writing plugins (https://nosack.com/sipforum/forumdisplay.php?fid=8)
+--- Thread: Plugin Education (/showthread.php?tid=137)



Plugin Education - 99alex - 2018 Aug 29

Hi,

I'm getting my SIP controller set up, and I'd like to write a plugin for some custom weather behaviors.  I've looked through the plugins out there already that perform this type of function, but I'm up against a python knowledge limitation that I could use some help with.

Specifically, the behavior where a plugin appears to change the value of of water scaling through a statement such as this:





gv.sd['wl_monthly_adj’] = (some calculated value)


or



gv.sd['wl_weather’] = (some calculated value)



I don't understand, and I can't find any information on, how adding 'wl_monthly_adj' and a value to the gv.sd dict ends up changing the water scaling that seems to be controlled by gv.sd['wl'].  I assume it has something to do with the options = [ block at the end of gv.py and overloading based on the underscore, but I don't know.



Thanks in advance!


RE: Plugin Education - dan - 2018 Aug 30

The percentage of watering time is adjusted in helpers.py in the plugin_adjustment(): function, (Line 278).

The plugin just needs to add a unique element to the gv.sd dictionary with a key starting with 'wl_'

The value of that element will be added to the percent of watering time adjustment.