Skip to content

Commit

Permalink
Merge pull request #77 from cdesouza71/monthly_adjust_per_station
Browse files Browse the repository at this point in the history
Monthly adjust per station
  • Loading branch information
Dan-in-CA authored Feb 9, 2024
2 parents eb8daaa + 28d0636 commit 7bdd9c6
Show file tree
Hide file tree
Showing 6 changed files with 396 additions and 23 deletions.
52 changes: 29 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ These programs are distributed in the hope that they will be useful, but WITHOUT
******************
backup_settings
---------
This plugin allows remote access (download and upload) of all the
This plugin allows remote access (download and upload) of all the
settings data necessary for SIP configuration. This facilitates complete rebuild or
replacement of the system without losing any SIP settings or log data.

Expand All @@ -23,21 +23,21 @@ plugins through the "buzzer_beep" signal. Buzzer should be connected to GPIO pin

california_monthly
---------
Provides automatic monthly adjustment of irrigation times based on historical weather data.
Provides automatic monthly adjustment of irrigation times based on historical weather data.
Requires SIP version 4.1.7 or later.

cli_control
----------
Sends command line commands to control remote stations e.g. RF devices.
Replaces rf_control.
----------
Sends command line commands to control remote stations e.g. RF devices.
Replaces rf_control.

combine_stations
----------
Allows multiple stations to be run at the same time (concurrently) when SIP is in sequential mode.

email_adj
----------
Sends status email to google email account. **NOTE: This plugin runs under Python2x only**.
Sends status email to google email account. **NOTE: This plugin runs under Python2x only**.
may use obsolete code - see **sip_email** plugin for updated version.

flow
Expand All @@ -48,7 +48,7 @@ Requires Python 3.

keypad
----------
A plugin for using an 4X4 scanning keypad to execute simple functions without the use of an external peripheral.
A plugin for using an 4X4 scanning keypad to execute simple functions without the use of an external peripheral.
This plugin interfaces with buzzer and ssd1306 plugins through signals.

lcd_adj
Expand All @@ -57,41 +57,47 @@ Uses I2C for LCD 16x2 char data display

monthly_adj
----------
Adjust irrigation time each month.
Adjust irrigation time each month.
Requires SIP version 4.1.7 or later.

monthly_adj_per_station
----------
Adjusts irrigation time per station per month. Allows a more fine grained control than
montly_adjust and the water level setting on the home page.
Requires SIP version 5.1.30 or later.

mqtt
----------
This is the base mqtt plugin.
It provides a shared MQTT client object for other plugins.
This is the base mqtt plugin.
It provides a shared MQTT client object for other plugins.
Requires paho mqtt.

mqtt_get_values
----------
Requires base mqtt plugin.
Can be used to read SIP's gv.* settings.
Requires base mqtt plugin.
Can be used to read SIP's gv.* settings.
See gv_reference.txt in the SIP folder for a list of settings.

mqtt_hass
----------
Home Assistant integration using MQTT autodiscovery.
Requires SIP version 4.1.25 or later, and base mqtt plugin
Run "python3 -m pip install python-slugify --upgrade" before installing this plugin.
Run "python3 -m pip install python-slugify --upgrade" before installing this plugin.

mqtt_set_values
----------
Requires base mqtt plugin.
Can be used to change SIP's gv.* settings.
Requires base mqtt plugin.
Can be used to change SIP's gv.* settings.
See gv_reference.txt in the SIP folder for a list of settings.

mqtt_schedule
--------------
Relies on MQTT, subscribes to a control topic and schedules
Relies on MQTT, subscribes to a control topic and schedules
run once programs as command by MQTT.

mqtt_slave
--------------
Relies on MQTT, subscribes to a control topic and allows
Relies on MQTT, subscribes to a control topic and allows
one SIP system to control other SIPs using MQTT.

mqtt_zones
Expand Down Expand Up @@ -121,22 +127,22 @@ Checks water pressure when master station is switched on

proto
---------
A bare bones plugin for use as a starting point for plugin authoring.
A bare bones plugin for use as a starting point for plugin authoring.
(Installed by default)

pulse_cct
----------
Pulses a selected circuit with a 2.5 Hz signal for 30 sec
Pulses a selected circuit with a 2.5 Hz signal for 30 sec
to discover the location of a valve

pump_control
------------
Controls a pump relay via an Arduino over i2C.
Controls a pump relay via an Arduino over i2C.
Checks pressure in pipe ensuring proper operation.

relay_16
----------
A relaly_board update for use on 40 pin GPIO headers.
A relaly_board update for use on 40 pin GPIO headers.
Supports up to 16 relays. Requires SIP 3.2.43 or later.

relay_board
Expand Down Expand Up @@ -171,12 +177,12 @@ Plugin for SSD1306 128x64 pixel display connected to I2C interface.

system_update
----------
Allows updating SIP software from integrated UI
Allows updating SIP software from integrated UI
(Installed by default)

telegram_bot
-------------
A simple telegram.org bot to interface with a SIP installation.
A simple telegram.org bot to interface with a SIP installation.
Run "pip install python-telegram-bot --upgrade" before installing this plugin.

waveshare_relay_board
Expand Down
19 changes: 19 additions & 0 deletions monthly_adjust_per_station/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Monthly Adjust per Station Plugin

Alter the amount of water the station delivers by adjusting the
watering time. This plugin allows a more fine grained level of control
than the water level setting on the home page.

The plugin will only have an effect on schedules started by programs
triggered automatically and will ignore schedules started with RUN
NOW.

Adjustment levels can be entered per station per month to indicate
the % adjustment to be applied to the watering time.

If no value is entered for the station/month the value set in "Default
Adjustment" is used. If the "Default Adjustment" is not set then the
plugin will take no action for the station/month.

Limitations:
- The plugin does not currently respect the option "Ignore Plugin adjustments".
31 changes: 31 additions & 0 deletions monthly_adjust_per_station/monthly_adjust_per_station-docs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<!-- Auto genwerated using markdown2 README.md --extras tables > monthly_adjust_per_station-docs.html -->
<html>
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset="utf-8">
<title>Monthly Adjust per Station Docs</TITLE>
</head>
<body lang="en-us" bgcolor="#ffffff" dir="LTR" style="border: none; padding: 0in">
<h1>Monthly Adjust per Station Plugin</h1>

<p>Alter the amount of water the station delivers by adjusting the
watering time. This plugin allows a more fine grained level of control
than the water level setting on the home page.</p>

<p>The plugin will only have an effect on schedules started by programs
triggered automatically and will ignore schedules started with RUN
NOW.</p>

<p>Adjustment levels can be entered per station per month to indicate
the % adjustment to be applied to the watering time.</p>

<p>If no value is entered for the station/month the value set in "Default
Adjustment" is used. If the "Default Adjustment" is not set then the
plugin will take no action for the station/month.</p>

<p>Limitations:
- The plugin does not currently respect the option "Ignore Plugin adjustments".</p>
</body>
</html>
108 changes: 108 additions & 0 deletions monthly_adjust_per_station/monthly_adjust_per_station.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
$def with(settings)

$var title: $_('Monthly Adjust per Station')
$var page: monthly_adjust_per_station
<script>
// Initialize behaviors
jQuery(document).ready(function(){

jQuery("#cSubmit").click(function() {
jQuery("#pluginForm").submit();
});
jQuery("button#cCancel").click(function(){
window.location="/";
});

jQuery("button#docButton").click(function(){
window.open("static/docs/plugins/monthly_adjust_per_station-docs.html", "_blank");
});

function pretty() {
jQuery("table#st_mon tr").each(function(rowIndex) {
$$(this).find("td").each(function(cellIndex) {
console.log("Row " + rowIndex + ", cell " + cellIndex + ": " + $$(this).find("input[type=number]").val());
});
}); }
// pretty();
});
</script>

<style>
td, input[type="checkbox"] {
text-align: center;
vertical-align: middle;
accent-color: green;
}

td, input[type="number"] {
white-space: nowrap;
}

table, th, td {
border: 1px solid lightgray;
border-collapse: collapse;
padding: 5px;
}

input[type='number']{
width: 2.77em;
}
</style>

<div id="plugin">
<div class="title">Monthly Adjust per Station
<button class="execute" id="docButton" type="button" >$_('Help')</button>
</div>

<form id="pluginForm" action="/monthly_adjust_per_station-save" method="get">
</br>
<p>
Default adjustment:
<input type="number" min="0" id="default" name="default"
value="${settings[u"default"] if u"default" in settings and settings[u"default"] != u"" else u""}"
onkeypress="if (isNaN(String.fromCharCode(event.keyCode))) return false;"> %
</p>
</br>

<table id="st_mon" class="optionList">
<tr>
<th class="columnName">
</th>
<th class="columnName">
<div>$_(u'Enable')</div>
</th>
$for heading in ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']:
<th class="columnName">
<div>$heading</div>
</th>

</tr>
$#{settings}
$for bid in range(0,gv.sd['nbrd']):
$for s in range(0,8):
$ sid = (bid * 8) + s;
$ s_sid = str(sid);
<tr>
<td class="stationNumber">${gv.snames[sid]}
</td>
<td>
<input type="checkbox" id="enable_${sid}" name="enable_${sid}"
${"checked" if "enable_" + s_sid in settings else ""}>
</td>
$for mon in range(1,13):
$ s_mon = str(mon)
<td
bgcolor="${settings[u"c_st_mon_" + s_sid + u"_" + s_mon] if u"c_st_mon_" + s_sid + u"_" + s_mon in settings else u""}">
<input type="number" min="0" id="st_mon_${sid}_${mon}" name="st_mon_${sid}_${mon}"
value="${settings[u"st_mon_" + s_sid + u"_" + s_mon] if u"st_mon_" + s_sid + u"_" + s_mon in settings else u""}"
onkeypress="if (isNaN(String.fromCharCode(event.keyCode))) return false;"> %
</td>
</tr>
</table>
</form>
</br>
<div class="controls">
<button id="cSubmit" class="submit"><b>$_('Submit')</b></button>
<button id="cCancel" class="cancel danger">$_('Cancel')</button>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
A bare bones plugin designed to be used as a starting point for writing plugins.

##### List all plugin files below preceded by a blank line [file_name.ext path] relative to SIP directory #####

monthly_adjust_per_station.py plugins
monthly_adjust_per_station.html templates
monthly_adjust_per_station-docs.html static/docs/plugins
monthly_adjust_per_station.json data (generated)
monthly_adjust_per_station.manifest plugins/manifests
Loading

0 comments on commit 7bdd9c6

Please sign in to comment.