SIP
Monthly Adjust per Station - 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: Monthly Adjust per Station (/showthread.php?tid=323)

Pages: 1 2


RE: Monthly Adjust per Station - cdesouza - 2024 Feb 13

Thank you for your help, thank you for the enhancements/bug fixes and thank you for merging my code. I hope that the plugin will prove useful to more people than just me.

A couple of ideas for the future:
  • a version scheme for the plugins
  • a standard style guide for the plugins
  • a readonly version of the variable gv.rs that contains the original schedule information before it was changed by any plugins may be useful if several plugins try to change the schedule.

But for now, back to my moisture sensor plugins.


RE: Monthly Adjust per Station - cdesouza - 2024 Feb 16

(2024 Feb 09, 07:13 PM)dan Wrote: The problem was a typo in README.md.

The plugin was listed as "monthly_adj_per_station".
Changed to " monthly_adjust_per_station". Installation works now.

How could I test this locally?


RE: Monthly Adjust per Station - dan - 2024 Feb 18

(2024 Feb 16, 12:35 PM)cdesouza Wrote:
(2024 Feb 09, 07:13 PM)dan Wrote: The problem was a typo in README.md.

The plugin was listed as "monthly_adj_per_station".
Changed to " monthly_adjust_per_station". Installation works now.

How could I test this locally?

I think you would need to modify the plugin_manager.py plugin file to point to your fork of the plugins repo on gitHub starting with get_readme() (line 69) and the URLs in install_plugins() (See lines 154 and 166).


RE: Monthly Adjust per Station - cdesouza - 2024 Apr 12

I have run into the following issues when the adjustment is 0%

in order to adjust the watering time I manipulate the settings in gv.rs so in the following example station 1's watering time is reduced from 60 seconds to 0 seconds and the start and end times are now the same:

Code:
before [[1712903940, 1712904000, 60, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
after  [[1712903940, 1712903940, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]

This however leads to the program being "stuck" in scheduling status (see screenshot), but according to the logs the program timer seems to be active (see code) :

   

Code:
::ffff:127.0.0.1:55828 - - [12/Apr/2024 06:39:07] "HTTP/1.1 GET /api/log" - 200 OK
::ffff:127.0.0.1:40388 - - [12/Apr/2024 06:40:07] "HTTP/1.1 GET /api/log" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:43] "HTTP/1.1 GET /" - 200 OK
::ffff:127.0.0.1:46308 - - [12/Apr/2024 06:40:43] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:43] "HTTP/1.1 GET /api/log" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:44] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:45] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:46] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:47] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:48] "HTTP/1.1 GET /api/status" - 200 OK
::ffff:127.0.0.1:46292 - - [12/Apr/2024 06:40:49] "HTTP/1.1 GET /api/status" - 200 OK

Seems to be an issue in sip.py line140/141?


RE: Monthly Adjust per Station - dan - 2024 Apr 12

I tried adding a test for duration to the if statement at line 141:
Code:
if (gv.rs[sid][2] # if this station has a duration
    and gv.now >= gv.rs[sid][0]
    and gv.now < gv.rs[sid][1]
   ):
but that didn't fix the problem.
It is more of a display problem in gv.ps[sid][1].


Edit:
When gv.rs is changed gv.ps should have a similar update.


RE: Monthly Adjust per Station - cdesouza - 2024 Apr 15

So I need something like?

Code:
gv.rs[station_index][1] = gv.rs[station_index][0] + duration
gv.rs[station_index][2] = duration

if duration == 0:
    gv.ps[station_index] = [0, 0]
else:
    gv.ps[station_index][1] = duration



RE: Monthly Adjust per Station - dan - 2024 Apr 16

(2024 Apr 15, 03:13 PM)cdesouza Wrote: So I need something like?

Code:
gv.rs[station_index][1] = gv.rs[station_index][0] + duration
gv.rs[station_index][2] = duration

if duration == 0:
    gv.ps[station_index] = [0, 0]
else:
    gv.ps[station_index][1] = duration
Yes.


RE: Monthly Adjust per Station - cdesouza - 2024 Apr 18

Fix pushed, new version is available.