-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshutter.php
More file actions
212 lines (202 loc) · 6.66 KB
/
shutter.php
File metadata and controls
212 lines (202 loc) · 6.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?
// print for debuging
// print_r($_IPS);
// Definition Buttons WebFront
define("ENO_UP", 0);
define("ENO_STOP", 1);
define("ENO_DOWN", 2);
define("ENO_25", 3);
define("ENO_50", 4);
define("ENO_75", 5);
define("ENO_L0", 6);
define("ENO_L25", 7);
define("ENO_L50", 8);
define("ENO_L75", 9);
define("ENO_L100", 10);
// Aktiv Button Glow WebFront
if($_IPS["SENDER"] == "WebFront"){
SetValue($_IPS["VARIABLE"], $_IPS["VALUE"]);
}
$jalousien=array(
//EDIT ---------!!!!!! array(OBJEKTID,FAHRZEIT NACH OBEN,FAHRZEIT NACH UNTEN,LAMELLEN AUF,LAMELLEN ZU,"NAME JALOUSIE"), !!!!!!
array(46612 /*[Eltako FSB61]*/,56,55,3.3,3.3,"Jalousie 2"),
);
// print for debuging
// print_r($jalousien);
for ( $x = 0; $x < count ( $jalousien ); $x++ )
{
// Array Definition
$ENO_ID = $jalousien[$x][0];
$ENO_UP_T = $jalousien[$x][1];
$ENO_DOWN_T = $jalousien[$x][2];
$ENO_LUP_T = $jalousien[$x][3];
$ENO_LDOWN_T = $jalousien[$x][4];
$ENO_NAME = $jalousien[$x][5];
//EDIT ---------!!!!!! Boolean !!!!!!
$ShutterOC = 37212 /*[Eltako FSB61\ShutterOC]*/;
$ShutterStop = 46916 /*[Eltako FSB61\ShutterStop]*/;
$Shutter25 = 17347 /*[Eltako FSB61\Shutter25]*/;
$Shutter50 = 15897 /*[Eltako FSB61\Shutter50]*/;
$Shutter75 = 56662 /*[Eltako FSB61\Shutter75]*/;
$ShutterMovement = 15301 /*[Eltako FSB61\ShutterMovement]*/;
$isRunning = 55615 /*[Eltako FSB61\isRunning]*/;
// if Shutter Down - Time Calculator for Position 25%, 50% and 75%
$UP25 = $ENO_UP_T - $ENO_UP_T * 75 / 100;
$UP50 = $ENO_UP_T - $ENO_UP_T * 50 / 100;
$UP75 = $ENO_UP_T - $ENO_UP_T * 25 / 100;
// if Shutter Up - Time Calculator for Position 25%, 50% and 75%
$DOWN25 = $ENO_DOWN_T - $ENO_DOWN_T * 75 / 100;
$DOWN50 = $ENO_DOWN_T - $ENO_DOWN_T * 50 / 100;
$DOWN75 = $ENO_DOWN_T - $ENO_DOWN_T * 25 / 100;
// if Shutter Down - Time Calculator for Slats Position 25%, 50% and 75%
$LUP25 = $ENO_LUP_T - $ENO_LUP_T * 75 / 100;
$LUP50 = $ENO_LUP_T - $ENO_LUP_T * 50 / 100;
$LUP75 = $ENO_LUP_T - $ENO_LUP_T * 25 / 100;
// if Shutter Up - Time Calculator for Slats Position 25%, 50% and 75%
$LDOWN25 = $ENO_LUP_T - $ENO_LUP_T * 75 / 100;
$LDOWN25 = $ENO_LUP_T - $ENO_LUP_T * 50 / 100;
$LDOWN25 = $ENO_LUP_T - $ENO_LUP_T * 25 / 100;
// TimerScript
$timerscriptid = 32702 /*[Eltako FSB61\Time Elapsed\time elapsed]*/;
$starttimeid = 37742 /*[Eltako FSB61\Start Time]*/;
switch ($_IPS['SENDER']) {
case "WebFront": {
switch($_IPS['VALUE']) {
// ShutterMove.OC
case ENO_STOP:{
ENO_ShutterStop($ENO_ID);
SetValueBoolean($ShutterStop ,true);
SetValueBoolean($Shutter25 ,false);
SetValueBoolean($Shutter50 ,false);
SetValueBoolean($Shutter75 ,false);
break;
}
case ENO_UP:{
ENO_ShutterMoveUp($ENO_ID);
SetValueBoolean($ShutterOC ,true);
SetValueBoolean($ShutterStop ,false);
SetValueBoolean($Shutter25 ,false);
SetValueBoolean($Shutter50 ,false);
SetValueBoolean($Shutter75 ,false);
SetValueBoolean($isRunning ,true);
break;
}
case ENO_DOWN: {
ENO_ShutterMoveDown($ENO_ID);
SetValueBoolean($ShutterOC ,false);
SetValueBoolean($ShutterStop ,false);
SetValueBoolean($Shutter25 ,false);
SetValueBoolean($Shutter50 ,false);
SetValueBoolean($Shutter75 ,false);
SetValueBoolean($isRunning ,true);
break;
}
// ShutterMove
case ENO_25: {
// if(GetValueBoolean($ShutterOC)) == true { // True = FULLOPEN
if(GetValueBoolean($Shutter25)) {
ENO_ShutterStop($ENO_ID);
}
elseif(GetValueBoolean($Shutter50)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN25);
// fals = letze befehlt war nach oben / true = letzter befehl nach unten
SetValueBoolean($ShutterMovement ,true);
}
elseif(GetValueBoolean($Shutter75)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN50);
SetValueBoolean($ShutterMovement ,true);
}
elseif(GetValueBoolean($ShutterOC)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN75);
SetValueBoolean($ShutterMovement ,true);
}
else {
ENO_ShutterMoveUpEx($ENO_ID, $UP25);
SetValueBoolean($ShutterMovement ,false);
}
SetValueBoolean($Shutter25 ,true);
SetValueBoolean($Shutter50 ,false);
SetValueBoolean($Shutter75 ,false);
SetValueBoolean($isRunning ,true);
break;
}
case ENO_50: {
if(GetValueBoolean($Shutter25)) {
ENO_ShutterMoveUpEx($ENO_ID, $UP25);
SetValueBoolean($ShutterMovement ,false);
}
elseif(GetValueBoolean($Shutter50)) {
ENO_ShutterStop($ENO_ID);
}
elseif(GetValueBoolean($Shutter75)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN25);
SetValueBoolean($ShutterMovement ,true);
}
elseif(GetValueBoolean($ShutterOC)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN50);
SetValueBoolean($ShutterMovement ,true);
}
else {
ENO_ShutterMoveUpEx($ENO_ID, $UP50);
SetValueBoolean($ShutterMovement ,false);
}
SetValueBoolean($Shutter25 ,false);
SetValueBoolean($Shutter50 ,true);
SetValueBoolean($Shutter75 ,false);
SetValueBoolean($isRunning ,true);
break;
}
case ENO_75: {
if(GetValueBoolean($Shutter25)) {
ENO_ShutterMoveUpEx($ENO_ID, $UP50);
SetValueBoolean($ShutterMovement ,false);
}
elseif(GetValueBoolean($Shutter50)) {
ENO_ShutterMoveUpEx($ENO_ID, $UP25);
SetValueBoolean($ShutterMovement ,false);
}
elseif(GetValueBoolean($Shutter75)) {
ENO_ShutterStop($ENO_ID);
}
elseif(GetValueBoolean($ShutterOC)) {
ENO_ShutterMoveDownEx($ENO_ID, $DOWN25);
SetValueBoolean($ShutterMovement ,true);
}
else {
ENO_ShutterMoveUpEx($ENO_ID, $UP75);
SetValueBoolean($ShutterMovement ,false);
}
SetValueBoolean($Shutter25 ,false);
SetValueBoolean($Shutter50 ,false);
SetValueBoolean($Shutter75 ,true);
SetValueBoolean($isRunning ,true);
break;
}
// ShutterSlates
// case ENO_L0: {
// ENO_ShutterMoveUpEx($ENO_ID, $test2);
// SetValueBoolean(56662 /*[Eltako FSB61\Shutter75]*/,true);
// break;
}
}
}
}
$nowtime = time();
$oldtime = GetValueInteger(37742 /*[Eltako FSB61\Start Time]*/); //Startzeit
if(GetValueBoolean($isRunning)) { // Beim Einschalten Timer setzten und Startzeit ablegen
SetValue($starttimeid, time());
}
elseif(GetValueBoolean($isRunning)) {
if(($diff = $nowtime - $oldtime) < 0) $diff =0; {
$timeprint = round($diff / 56 * 100)."% (".$diff.")";
SetValue(57245 /*[Eltako FSB61\Time Elapsed]*/, $timeprint);
}
}
elseif(GetValueBoolean($isRunning)) {
if(($diff = $nowtime - $oldtime) == 10) {
SetValueBoolean($isRunning ,false);
}
}
echo $nowtime - $oldtime . "\n";
// echo $ENO_ID . "\n";
?>