Skip to content

Commit

Permalink
v3.5.76: Add minimum relay on duration for PID controllers (to comple…
Browse files Browse the repository at this point in the history
…ment maximum on duration)
  • Loading branch information
kizniche committed Sep 22, 2015
1 parent 3793c8b commit 0ea208d
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 97 deletions.
7 changes: 5 additions & 2 deletions 3.5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ This is an experimental branch of mycodo. It is undergoing constant changes and

#### Daemon

<a href="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo.py_.png"><img src="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo.py_-300x124.png"></a>
<a href="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo.py_.png" target="_blank"><img src="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo.py_-300x124.png"></a>

#### Client

<a href="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo-client.py_.png"><img src="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo-client.py_-300x219.png"></a>
<a href="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo-client.py_.png" target="_blank"><img src="http://kylegabriel.com/projects/wp-content/uploads/sites/3/2015/09/mycodo-client.py_-300x219.png"></a>

## Changelog

Major changes for each versioned release

#### 3.5.76
+ Add minimum relay on duration for PID controllers (to complement maximum on duration)

#### 3.5.75
+ Ability to execute command or notify by email if relay or sensor conditional is true

Expand Down
152 changes: 82 additions & 70 deletions 3.5/includes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@


unset($sensor_t_id);
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D FROM TSensor');
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmin_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmin_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D FROM TSensor');
$i = 0;
while ($row = $results->fetchArray()) {
$sensor_t_id[$i] = $row[0];
Expand All @@ -98,24 +98,26 @@
$sensor_t_temp_relays_up[$i] = $row[17];
$sensor_t_temp_relays_down[$i] = $row[18];
$pid_t_temp_relay_high[$i] = $row[19];
$pid_t_temp_outmax_high[$i] = $row[20];
$pid_t_temp_relay_low[$i] = $row[21];
$pid_t_temp_outmax_low[$i] = $row[22];
$pid_t_temp_or[$i] = $row[23];
$pid_t_temp_set[$i] = $row[24];
$pid_t_temp_set_dir[$i] = $row[25];
$pid_t_temp_period[$i] = $row[26];
$pid_t_temp_p[$i] = $row[27];
$pid_t_temp_i[$i] = $row[28];
$pid_t_temp_d[$i] = $row[29];
$pid_t_temp_outmin_high[$i] = $row[20];
$pid_t_temp_outmax_high[$i] = $row[21];
$pid_t_temp_relay_low[$i] = $row[22];
$pid_t_temp_outmin_low[$i] = $row[23];
$pid_t_temp_outmax_low[$i] = $row[24];
$pid_t_temp_or[$i] = $row[25];
$pid_t_temp_set[$i] = $row[26];
$pid_t_temp_set_dir[$i] = $row[27];
$pid_t_temp_period[$i] = $row[28];
$pid_t_temp_p[$i] = $row[29];
$pid_t_temp_i[$i] = $row[30];
$pid_t_temp_d[$i] = $row[31];
$i++;
}
if (!isset($sensor_t_id)) $sensor_t_id = [];
if (!isset($sensor_t_graph)) $sensor_t_graph = [];


unset($sensor_ht_id);
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, YAxis_Hum_Min, YAxis_Hum_Max, YAxis_Hum_Tics, YAxis_Hum_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D, Hum_Relays_Up, Hum_Relays_Down, Hum_Relay_High, Hum_Outmax_High, Hum_Relay_Low, Hum_Outmax_Low, Hum_OR, Hum_Set, Hum_Set_Direction, Hum_Period, Hum_P, Hum_I, Hum_D FROM HTSensor');
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, YAxis_Hum_Min, YAxis_Hum_Max, YAxis_Hum_Tics, YAxis_Hum_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmin_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmin_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D, Hum_Relays_Up, Hum_Relays_Down, Hum_Relay_High, Hum_Outmin_High, Hum_Outmax_High, Hum_Relay_Low, Hum_Outmin_Low, Hum_Outmax_Low, Hum_OR, Hum_Set, Hum_Set_Direction, Hum_Period, Hum_P, Hum_I, Hum_D FROM HTSensor');
$i = 0;
while ($row = $results->fetchArray()) {
$sensor_ht_id[$i] = $row[0];
Expand All @@ -142,37 +144,41 @@
$sensor_ht_temp_relays_up[$i] = $row[21];
$sensor_ht_temp_relays_down[$i] = $row[22];
$pid_ht_temp_relay_high[$i] = $row[23];
$pid_ht_temp_outmax_high[$i] = $row[24];
$pid_ht_temp_relay_low[$i] = $row[25];
$pid_ht_temp_outmax_low[$i] = $row[26];
$pid_ht_temp_or[$i] = $row[27];
$pid_ht_temp_set[$i] = $row[28];
$pid_ht_temp_set_dir[$i] = $row[29];
$pid_ht_temp_period[$i] = $row[30];
$pid_ht_temp_p[$i] = $row[31];
$pid_ht_temp_i[$i] = $row[32];
$pid_ht_temp_d[$i] = $row[33];
$sensor_ht_hum_relays_up[$i] = $row[34];
$sensor_ht_hum_relays_down[$i] = $row[35];
$pid_ht_hum_relay_high[$i] = $row[36];
$pid_ht_hum_outmax_high[$i] = $row[37];
$pid_ht_hum_relay_low[$i] = $row[38];
$pid_ht_hum_outmax_low[$i] = $row[39];
$pid_ht_hum_or[$i] = $row[40];
$pid_ht_hum_set[$i] = $row[41];
$pid_ht_hum_set_dir[$i] = $row[42];
$pid_ht_hum_period[$i] = $row[43];
$pid_ht_hum_p[$i] = $row[44];
$pid_ht_hum_i[$i] = $row[45];
$pid_ht_hum_d[$i] = $row[46];
$pid_ht_temp_outmin_high[$i] = $row[24];
$pid_ht_temp_outmax_high[$i] = $row[25];
$pid_ht_temp_relay_low[$i] = $row[26];
$pid_ht_temp_outmin_low[$i] = $row[27];
$pid_ht_temp_outmax_low[$i] = $row[28];
$pid_ht_temp_or[$i] = $row[29];
$pid_ht_temp_set[$i] = $row[30];
$pid_ht_temp_set_dir[$i] = $row[31];
$pid_ht_temp_period[$i] = $row[32];
$pid_ht_temp_p[$i] = $row[33];
$pid_ht_temp_i[$i] = $row[34];
$pid_ht_temp_d[$i] = $row[35];
$sensor_ht_hum_relays_up[$i] = $row[36];
$sensor_ht_hum_relays_down[$i] = $row[37];
$pid_ht_hum_relay_high[$i] = $row[38];
$pid_ht_hum_outmin_high[$i] = $row[39];
$pid_ht_hum_outmax_high[$i] = $row[40];
$pid_ht_hum_relay_low[$i] = $row[41];
$pid_ht_hum_outmin_low[$i] = $row[42];
$pid_ht_hum_outmax_low[$i] = $row[43];
$pid_ht_hum_or[$i] = $row[44];
$pid_ht_hum_set[$i] = $row[45];
$pid_ht_hum_set_dir[$i] = $row[46];
$pid_ht_hum_period[$i] = $row[47];
$pid_ht_hum_p[$i] = $row[48];
$pid_ht_hum_i[$i] = $row[49];
$pid_ht_hum_d[$i] = $row[50];
$i++;
}
if (!isset($sensor_ht_id)) $sensor_ht_id = [];
if (!isset($sensor_ht_graph)) $sensor_ht_graph = [];


unset($sensor_co2_id);
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_CO2_Min, YAxis_CO2_Max, YAxis_CO2_Tics, YAxis_CO2_MTics, CO2_Relays_Up, CO2_Relays_Down, CO2_Relay_High, CO2_Outmax_High, CO2_Relay_Low, CO2_Outmax_Low, CO2_OR, CO2_Set, CO2_Set_Direction, CO2_Period, CO2_P, CO2_I, CO2_D FROM CO2Sensor');
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_CO2_Min, YAxis_CO2_Max, YAxis_CO2_Tics, YAxis_CO2_MTics, CO2_Relays_Up, CO2_Relays_Down, CO2_Relay_High, CO2_Outmin_High, CO2_Outmax_High, CO2_Relay_Low, CO2_Outmin_Low, CO2_Outmax_Low, CO2_OR, CO2_Set, CO2_Set_Direction, CO2_Period, CO2_P, CO2_I, CO2_D FROM CO2Sensor');
$i = 0;
while ($row = $results->fetchArray()) {
$sensor_co2_id[$i] = $row[0];
Expand All @@ -195,23 +201,25 @@
$sensor_co2_relays_up[$i] = $row[17];
$sensor_co2_relays_down[$i] = $row[18];
$pid_co2_relay_high[$i] = $row[19];
$pid_co2_outmax_high[$i] = $row[20];
$pid_co2_relay_low[$i] = $row[21];
$pid_co2_outmax_low[$i] = $row[22];
$pid_co2_or[$i] = $row[23];
$pid_co2_set[$i] = $row[24];
$pid_co2_set_dir[$i] = $row[25];
$pid_co2_period[$i] = $row[26];
$pid_co2_p[$i] = $row[27];
$pid_co2_i[$i] = $row[28];
$pid_co2_d[$i] = $row[29];
$pid_co2_outmin_high[$i] = $row[20];
$pid_co2_outmax_high[$i] = $row[21];
$pid_co2_relay_low[$i] = $row[22];
$pid_co2_outmin_low[$i] = $row[23];
$pid_co2_outmax_low[$i] = $row[24];
$pid_co2_or[$i] = $row[25];
$pid_co2_set[$i] = $row[26];
$pid_co2_set_dir[$i] = $row[27];
$pid_co2_period[$i] = $row[28];
$pid_co2_p[$i] = $row[29];
$pid_co2_i[$i] = $row[30];
$pid_co2_d[$i] = $row[31];
$i++;
}
if (!isset($sensor_co2_id)) $sensor_co2_id = [];
if (!isset($sensor_co2_graph)) $sensor_co2_graph = [];

unset($sensor_press_id);
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, YAxis_Press_Min, YAxis_Press_Max, YAxis_Press_Tics, YAxis_Press_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D, Press_Relays_Up, Press_Relays_Down, Press_Relay_High, Press_Outmax_High, Press_Relay_Low, Press_Outmax_Low, Press_OR, Press_Set, Press_Set_Direction, Press_Period, Press_P, Press_I, Press_D FROM PressSensor');
$results = $db->query('SELECT Id, Name, Pin, Device, Period, Pre_Measure_Relay, Pre_Measure_Dur, Activated, Graph, YAxis_Relay_Min, YAxis_Relay_Max, YAxis_Relay_Tics, YAxis_Relay_MTics, YAxis_Temp_Min, YAxis_Temp_Max, YAxis_Temp_Tics, YAxis_Temp_MTics, YAxis_Press_Min, YAxis_Press_Max, YAxis_Press_Tics, YAxis_Press_MTics, Temp_Relays_Up, Temp_Relays_Down, Temp_Relay_High, Temp_Outmin_High, Temp_Outmax_High, Temp_Relay_Low, Temp_Outmin_Low, Temp_Outmax_Low, Temp_OR, Temp_Set, Temp_Set_Direction, Temp_Period, Temp_P, Temp_I, Temp_D, Press_Relays_Up, Press_Relays_Down, Press_Relay_High, Press_Outmin_High, Press_Outmax_High, Press_Relay_Low, Press_Outmin_Low, Press_Outmax_Low, Press_OR, Press_Set, Press_Set_Direction, Press_Period, Press_P, Press_I, Press_D FROM PressSensor');
$i = 0;
while ($row = $results->fetchArray()) {
$sensor_press_id[$i] = $row[0];
Expand All @@ -238,29 +246,33 @@
$sensor_press_temp_relays_up[$i] = $row[21];
$sensor_press_temp_relays_down[$i] = $row[22];
$pid_press_temp_relay_high[$i] = $row[23];
$pid_press_temp_outmax_high[$i] = $row[24];
$pid_press_temp_relay_low[$i] = $row[25];
$pid_press_temp_outmax_low[$i] = $row[26];
$pid_press_temp_or[$i] = $row[27];
$pid_press_temp_set[$i] = $row[28];
$pid_press_temp_set_dir[$i] = $row[29];
$pid_press_temp_period[$i] = $row[30];
$pid_press_temp_p[$i] = $row[31];
$pid_press_temp_i[$i] = $row[32];
$pid_press_temp_d[$i] = $row[33];
$sensor_press_press_relays_up[$i] = $row[34];
$sensor_press_press_relays_down[$i] = $row[35];
$pid_press_press_relay_high[$i] = $row[36];
$pid_press_press_outmax_high[$i] = $row[37];
$pid_press_press_relay_low[$i] = $row[38];
$pid_press_press_outmax_low[$i] = $row[39];
$pid_press_press_or[$i] = $row[40];
$pid_press_press_set[$i] = $row[41];
$pid_press_press_set_dir[$i] = $row[42];
$pid_press_press_period[$i] = $row[43];
$pid_press_press_p[$i] = $row[44];
$pid_press_press_i[$i] = $row[45];
$pid_press_press_d[$i] = $row[46];
$pid_press_temp_outmin_high[$i] = $row[24];
$pid_press_temp_outmax_high[$i] = $row[25];
$pid_press_temp_relay_low[$i] = $row[26];
$pid_press_temp_outmin_low[$i] = $row[27];
$pid_press_temp_outmax_low[$i] = $row[28];
$pid_press_temp_or[$i] = $row[29];
$pid_press_temp_set[$i] = $row[30];
$pid_press_temp_set_dir[$i] = $row[31];
$pid_press_temp_period[$i] = $row[32];
$pid_press_temp_p[$i] = $row[33];
$pid_press_temp_i[$i] = $row[34];
$pid_press_temp_d[$i] = $row[35];
$sensor_press_press_relays_up[$i] = $row[36];
$sensor_press_press_relays_down[$i] = $row[37];
$pid_press_press_relay_high[$i] = $row[38];
$pid_press_press_outmin_high[$i] = $row[39];
$pid_press_press_outmax_high[$i] = $row[40];
$pid_press_press_relay_low[$i] = $row[41];
$pid_press_press_outmin_low[$i] = $row[42];
$pid_press_press_outmax_low[$i] = $row[43];
$pid_press_press_or[$i] = $row[44];
$pid_press_press_set[$i] = $row[45];
$pid_press_press_set_dir[$i] = $row[46];
$pid_press_press_period[$i] = $row[47];
$pid_press_press_p[$i] = $row[48];
$pid_press_press_i[$i] = $row[49];
$pid_press_press_d[$i] = $row[50];
$i++;
}
if (!isset($sensor_press_id)) $sensor_press_id = [];
Expand Down
2 changes: 1 addition & 1 deletion 3.5/includes/mycodo.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Contact at kylegabriel.com
*/

$version = "3.5.75";
$version = "3.5.76";

######### Start Edit Configure #########

Expand Down

0 comments on commit 0ea208d

Please sign in to comment.