grenton-ts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/analog-din/fv02_01/analog-in.ts +271 -0
  4. package/dist/clu/calendar/v1/calendar.ts +308 -0
  5. package/dist/clu/clu-zwave-2/fv515_03/clu-zwave-2.ts +1302 -0
  6. package/dist/clu/event-scheduler/v1/event-scheduler.ts +537 -0
  7. package/dist/clu/multi-fan-ac-thermostat/v1/multi-fan-ac-thermostat.ts +1163 -0
  8. package/dist/clu/pid-controller/v1/pid-controller.ts +536 -0
  9. package/dist/clu/presence-sensor/v1/presence-sensor.ts +313 -0
  10. package/dist/clu/presence-sensor/v2/presence-sensor.ts +470 -0
  11. package/dist/clu/push/v1/push.ts +261 -0
  12. package/dist/clu/scheduler/v1/scheduler.ts +304 -0
  13. package/dist/clu/statistics/v1/statistics.ts +413 -0
  14. package/dist/clu/statistics-pulse/v1/statistics-pulse.ts +218 -0
  15. package/dist/clu/sunrise-sunset-calendar/v1/sunrise-sunset-calendar.ts +389 -0
  16. package/dist/clu/sunrise-sunset-calendar/v2/sunrise-sunset-calendar.ts +659 -0
  17. package/dist/clu/sunrise-sunset-calendar/v3/sunrise-sunset-calendar.ts +659 -0
  18. package/dist/clu/thermostat/v1/thermostat.ts +768 -0
  19. package/dist/clu/thermostat/v2/thermostat.ts +861 -0
  20. package/dist/clu/timer/v1/timer.ts +369 -0
  21. package/dist/core/execution-builder.ts +55 -0
  22. package/dist/core/remote-gate.ts +17 -0
  23. package/dist/digital-in-din/fv02_01/din.ts +310 -0
  24. package/dist/examples/light_turned_on_by_calendar/Clu_OnInit.ts +26 -0
  25. package/dist/examples/light_turned_on_by_presence_sensor/Clu_OnInit.ts +35 -0
  26. package/dist/examples/light_turned_on_by_switch/Clu_OnInit.ts +16 -0
  27. package/dist/gate/cool-master/v1/cool-master.ts +782 -0
  28. package/dist/gate/cool-master-net/v1/cool-master-net.ts +334 -0
  29. package/dist/gate/denon-marantz-avr/v1/denon-marantz-avr.ts +724 -0
  30. package/dist/gate/heos/v1/heos.ts +1224 -0
  31. package/dist/gate/http/fv1000_03/clu-gate-http.ts +405 -0
  32. package/dist/gate/http/fv1000_03_hv1/clu-gate-http.ts +352 -0
  33. package/dist/gate/http/fv1100_03/clu-gate-http.ts +589 -0
  34. package/dist/gate/http/fv1110_03/clu-gate-http.ts +589 -0
  35. package/dist/gate/http/fv1300_03/clu-gate-http.ts +589 -0
  36. package/dist/gate/http/fv1400_03/clu-gate-http.ts +677 -0
  37. package/dist/gate/http-listener/v1/http-listener.ts +299 -0
  38. package/dist/gate/http-listener/v2/http-listener.ts +325 -0
  39. package/dist/gate/http-request/v1/http-request.ts +645 -0
  40. package/dist/gate/http-request/v2/http-request.ts +709 -0
  41. package/dist/gate/input/v1/input.ts +171 -0
  42. package/dist/gate/jablotron/v1/jablotron.ts +100 -0
  43. package/dist/gate/jablotron-device/v1/jablotron-device.ts +171 -0
  44. package/dist/gate/jablotron-output/v1/jablotron-output.ts +240 -0
  45. package/dist/gate/jablotron-section/v1/jablotron-section.ts +260 -0
  46. package/dist/gate/modbus/v1/modbus.ts +609 -0
  47. package/dist/gate/modbus/v2/modbus.ts +690 -0
  48. package/dist/gate/modbus-client/v1/modbus-client.ts +827 -0
  49. package/dist/gate/modbus-rtu/v1/modbus-rtu.ts +911 -0
  50. package/dist/gate/modbus-server/v1/modbus-server.ts +405 -0
  51. package/dist/gate/modbus-slave-config-rtu/v1/modbus-slave-config-rtu.ts +160 -0
  52. package/dist/gate/modbus-slave-rtu/v1/modbus-slave-rtu.ts +371 -0
  53. package/dist/gate/modbus-value/v1/modbus-value.ts +856 -0
  54. package/dist/gate/music-cast/v1/music-cast.ts +1298 -0
  55. package/dist/gate/output/v1/output.ts +240 -0
  56. package/dist/gate/satel/v1/satel.ts +359 -0
  57. package/dist/gate/satel-input/v1/satel-input.ts +171 -0
  58. package/dist/gate/satel-output/v1/satel-output.ts +240 -0
  59. package/dist/gate/satel-zone/v1/satel-zone.ts +235 -0
  60. package/dist/gate/sonos/v1/sonos.ts +934 -0
  61. package/dist/gate/timer/v2/timer.ts +253 -0
  62. package/dist/gate/zone/v1/zone.ts +235 -0
  63. package/dist/io-module-din-8/fv02_02/din.ts +354 -0
  64. package/dist/io-module-din-8/fv02_02/dout.ts +360 -0
  65. package/dist/one-wire/fv01_10/onew-sensor.ts +269 -0
  66. package/dist/one-wire/fv01_28/onew-sensor.ts +269 -0
  67. package/dist/one-wire/fv02_28/onew-sensor.ts +350 -0
  68. package/dist/one-wire/fv03_28/onew-sensor.ts +435 -0
  69. package/dist/relay-din-2/fv02_02/dout.ts +544 -0
  70. package/dist/relay-din-4/fv01_02/dout.ts +340 -0
  71. package/dist/relay-din-4/fv02_02/dout.ts +368 -0
  72. package/dist/roller-shutter-din-3/fv03_02/roller-shutter.ts +1078 -0
  73. package/dist/smart-panel-fm-4/fv03_03/panel-button.ts +550 -0
  74. package/dist/smart-panel-fm-4/fv03_03/panel-sens-light.ts +238 -0
  75. package/dist/smart-panel-fm-4/fv03_03/panel-sens-temp.ts +239 -0
  76. package/dist/smart-panel-fm-4/fv03_03/panel.ts +700 -0
  77. package/dist/smart-panel-fm-4/fv04_03/panel-button.ts +567 -0
  78. package/dist/smart-panel-fm-4/fv04_03/panel-page.ts +516 -0
  79. package/dist/smart-panel-fm-4/fv04_03/panel-sens-light.ts +238 -0
  80. package/dist/smart-panel-fm-4/fv04_03/panel-sens-temp.ts +239 -0
  81. package/dist/smart-panel-fm-4/fv04_03/panel.ts +1026 -0
  82. package/dist/smart-panel-fm-4/fv05_03/panel-button.ts +567 -0
  83. package/dist/smart-panel-fm-4/fv05_03/panel-page.ts +620 -0
  84. package/dist/smart-panel-fm-4/fv05_03/panel-sens-light.ts +238 -0
  85. package/dist/smart-panel-fm-4/fv05_03/panel-sens-temp.ts +266 -0
  86. package/dist/smart-panel-fm-4/fv05_03/panel.ts +1109 -0
  87. package/dist/smart-panel-fm-4/fv06_03/panel-button.ts +567 -0
  88. package/dist/smart-panel-fm-4/fv06_03/panel-page.ts +877 -0
  89. package/dist/smart-panel-fm-4/fv06_03/panel-sens-light.ts +238 -0
  90. package/dist/smart-panel-fm-4/fv06_03/panel-sens-temp.ts +297 -0
  91. package/dist/smart-panel-fm-4/fv06_03/panel.ts +1138 -0
  92. package/dist/smart-panel-fm-4/fv07_03/panel-button.ts +567 -0
  93. package/dist/smart-panel-fm-4/fv07_03/panel-page.ts +864 -0
  94. package/dist/smart-panel-fm-4/fv07_03/panel-sens-light.ts +238 -0
  95. package/dist/smart-panel-fm-4/fv07_03/panel-sens-temp.ts +297 -0
  96. package/dist/smart-panel-fm-4/fv07_03/panel.ts +1135 -0
  97. package/dist/touch-panel-fm-4/fv01_02/panel-button.ts +418 -0
  98. package/dist/touch-panel-fm-4/fv01_02/panel-sens-light.ts +238 -0
  99. package/dist/touch-panel-fm-4/fv01_02/panel-sens-temp.ts +257 -0
  100. package/dist/touch-panel-fm-4/fv01_02/panel.ts +75 -0
  101. package/dist/touch-panel-fm-4/fv01_02/power-supply-voltage.ts +322 -0
  102. package/dist/touch-panel-fm-8/fv01_02/panel-button.ts +418 -0
  103. package/dist/touch-panel-fm-8/fv01_02/panel-sens-light.ts +238 -0
  104. package/dist/touch-panel-fm-8/fv01_02/panel-sens-temp.ts +270 -0
  105. package/dist/touch-panel-fm-8/fv01_02/panel.ts +75 -0
  106. package/dist/touch-panel-fm-8/fv01_02/power-supply-voltage.ts +322 -0
  107. package/package.json +16 -0
@@ -0,0 +1,470 @@
1
+ // Created from: packages/grenton-api/interfaces/object_presence_sensor_v2.xml, object name="PresenceSensor" version="2"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
4
+ import { RemoteGate } from "../../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnStart = 0,
8
+ OnStop = 1,
9
+ OnSwitchOn = 2,
10
+ OnSwitchOff = 3
11
+ }
12
+
13
+ enum PropertyType {
14
+ Timeout = 0,
15
+ State = 1,
16
+ PresenceDetected = 2,
17
+ TimeFromLastPresence = 3,
18
+ DetectionDelay = 4,
19
+ Locked = 5,
20
+ Mode = 6
21
+ }
22
+
23
+ enum MethodType {
24
+ Start = 0,
25
+ Stop = 1,
26
+ DetectPresence = 2,
27
+ UndetectPresence = 3,
28
+ SwitchLocked = 4
29
+ }
30
+
31
+ enum StateType {
32
+ Off = 0,
33
+ On = 1
34
+ }
35
+
36
+ enum LockedType {
37
+ Off = 0,
38
+ On = 1
39
+ }
40
+
41
+ enum ModeType {
42
+ ImpulseInput = 0,
43
+ StateInput = 1
44
+ }
45
+
46
+ declare class PresenceSensorRaw {
47
+ add_event(event: EventType, callback: () => void): void;
48
+ get(property: PropertyType): any;
49
+ set(property: PropertyType, value: any): void;
50
+ execute(method: MethodType, ...args: any[]): any;
51
+ }
52
+
53
+ interface IPresenceSensor {
54
+ /**
55
+ * Zdarzenie wywoływane przy uruchomieniu czujnika
56
+ * @param callback
57
+ */
58
+ addOnStart: (callback: () => void) => void
59
+ /**
60
+ * Zdarzenie wywoływane przy dezaktywacji czujnika
61
+ * @param callback
62
+ */
63
+ addOnStop: (callback: () => void) => void
64
+ /**
65
+ * Zdarzenie wywoływane podczas wykrycia obecności (zmiana wartości parametru PresenceDetected z 0 na 1)
66
+ * @param callback
67
+ */
68
+ addOnSwitchOn: (callback: () => void) => void
69
+ /**
70
+ * Zdarzenie wywoływane na timeout licznika (zmiana parametru PresenceDetected z 1 na 0)
71
+ * @param callback
72
+ */
73
+ addOnSwitchOff: (callback: () => void) => void
74
+ /** Uruchamia czujnik obecności */
75
+ start: () => void
76
+ /** Zatrzymuje czujnik obecności */
77
+ stop: () => void
78
+ /** Metoda wywoływana podczas wykrycia obecności. Ustawia wartość cechy PresenceDetected na 1 oraz resetuje licznik TimeFromLastPresence czujnika obecności */
79
+ detectPresence: () => void
80
+ /** Używana w trybie stanowym (Mode = 1). Kończy podtrzymywanie parametru PresenceDetected (po upływie Timeout'u). */
81
+ undetectPresence: () => void
82
+ /** Zmienia wartość parametru Locked na przeciwny. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff */
83
+ switchLocked: () => void
84
+ /**
85
+ * Ustawia wartość parametru Locked. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff - SetLocked(On) jeśli Locked = 1 - resetuje TimeFromLastPresence - SetLocked(Off) jeśli Locked = 0 - brak reakcji
86
+ * @param {LockedType} locked
87
+ */
88
+ setLocked: (locked: LockedType) => void
89
+ /** Czas (w sekundach) od ostatniej aktywności, po którym wartość cechy PresenceDetected zostaje ustawione na 0 */
90
+ timeout: number
91
+ /** Ustawia Aktualny stan czujnika obecności, 1 - włączony, 0 - wyłączony */
92
+ state: StateType
93
+ /** Wartość mówiąca o wykryciu ruchu przez czujnik */
94
+ readonly presenceDetected: boolean
95
+ /** Czas od ostatniego wykrycia ruchu (z czujnika lub włączenia swiatła z przycisku). Resetowany po wywołaniu: - DetectPresence() - bez względu na Locked, DetectionDelay - SwitchLocked() przy zmianie Locked na 1 - SetLocked(On) W trybie stanowym po wywołaniu DetectPresence(), TimeFromLastPresence = 0, aż do wywołania UndetectPresence() */
96
+ readonly timeFromLastPresence: number
97
+ /** Czas ignorowania DetectPresence po zmianie Locked On->Off */
98
+ detectionDelay: number
99
+ /** Stan zablokowania obecności. 0 - reagowanie na DetectPresence. 1 - podtrzymanie PresenceDetected jako 1. */
100
+ readonly locked: LockedType
101
+ /** Tryb działania obiektu w zależności od typu używanego czujnika ruchu: 0 - impulsowy, 1 - stanowy. */
102
+ mode: ModeType
103
+ }
104
+
105
+ class PresenceSensor implements IPresenceSensor {
106
+ private onStartCallbacks: Array<() => void> = [];
107
+ private onStopCallbacks: Array<() => void> = [];
108
+ private onSwitchOnCallbacks: Array<() => void> = [];
109
+ private onSwitchOffCallbacks: Array<() => void> = [];
110
+
111
+ constructor(private raw: PresenceSensorRaw) {
112
+ this.raw.add_event(EventType.OnStart, () => {
113
+ this.onStartCallbacks.forEach(callback => {
114
+ callback();
115
+ });
116
+ });
117
+
118
+ this.raw.add_event(EventType.OnStop, () => {
119
+ this.onStopCallbacks.forEach(callback => {
120
+ callback();
121
+ });
122
+ });
123
+
124
+ this.raw.add_event(EventType.OnSwitchOn, () => {
125
+ this.onSwitchOnCallbacks.forEach(callback => {
126
+ callback();
127
+ });
128
+ });
129
+
130
+ this.raw.add_event(EventType.OnSwitchOff, () => {
131
+ this.onSwitchOffCallbacks.forEach(callback => {
132
+ callback();
133
+ });
134
+ });
135
+ }
136
+
137
+ /**
138
+ * Zdarzenie wywoływane przy uruchomieniu czujnika
139
+ * @param callback
140
+ */
141
+ addOnStart(callback: () => void): void {
142
+ this.onStartCallbacks.push(callback);
143
+ }
144
+ /**
145
+ * Zdarzenie wywoływane przy dezaktywacji czujnika
146
+ * @param callback
147
+ */
148
+ addOnStop(callback: () => void): void {
149
+ this.onStopCallbacks.push(callback);
150
+ }
151
+ /**
152
+ * Zdarzenie wywoływane podczas wykrycia obecności (zmiana wartości parametru PresenceDetected z 0 na 1)
153
+ * @param callback
154
+ */
155
+ addOnSwitchOn(callback: () => void): void {
156
+ this.onSwitchOnCallbacks.push(callback);
157
+ }
158
+ /**
159
+ * Zdarzenie wywoływane na timeout licznika (zmiana parametru PresenceDetected z 1 na 0)
160
+ * @param callback
161
+ */
162
+ addOnSwitchOff(callback: () => void): void {
163
+ this.onSwitchOffCallbacks.push(callback);
164
+ }
165
+ /** Uruchamia czujnik obecności */
166
+ start(): void {
167
+ this.raw.execute(MethodType.Start);
168
+ }
169
+ /** Zatrzymuje czujnik obecności */
170
+ stop(): void {
171
+ this.raw.execute(MethodType.Stop);
172
+ }
173
+ /** Metoda wywoływana podczas wykrycia obecności. Ustawia wartość cechy PresenceDetected na 1 oraz resetuje licznik TimeFromLastPresence czujnika obecności */
174
+ detectPresence(): void {
175
+ this.raw.execute(MethodType.DetectPresence);
176
+ }
177
+ /** Używana w trybie stanowym (Mode = 1). Kończy podtrzymywanie parametru PresenceDetected (po upływie Timeout'u). */
178
+ undetectPresence(): void {
179
+ this.raw.execute(MethodType.UndetectPresence);
180
+ }
181
+ /** Zmienia wartość parametru Locked na przeciwny. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff */
182
+ switchLocked(): void {
183
+ this.raw.execute(MethodType.SwitchLocked);
184
+ }
185
+ /**
186
+ * Ustawia wartość parametru Locked. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff - SetLocked(On) jeśli Locked = 1 - resetuje TimeFromLastPresence - SetLocked(Off) jeśli Locked = 0 - brak reakcji
187
+ * @param {LockedType} locked
188
+ */
189
+ setLocked(locked: LockedType): void {
190
+ this.raw.set(PropertyType.Locked, locked);
191
+ }
192
+ /**
193
+ * Czas (w sekundach) od ostatniej aktywności, po którym wartość cechy PresenceDetected zostaje ustawione na 0
194
+ * @returns {number}
195
+ */
196
+ get timeout(): number {
197
+ return this.raw.get(PropertyType.Timeout);
198
+ }
199
+ set timeout(value: number) {
200
+ this.raw.set(PropertyType.Timeout, value);
201
+ }
202
+ /**
203
+ * Ustawia Aktualny stan czujnika obecności, 1 - włączony, 0 - wyłączony
204
+ * @returns {StateType}
205
+ */
206
+ get state(): StateType {
207
+ return this.raw.get(PropertyType.State);
208
+ }
209
+ set state(value: StateType) {
210
+ this.raw.set(PropertyType.State, value);
211
+ }
212
+ /**
213
+ * Wartość mówiąca o wykryciu ruchu przez czujnik
214
+ * @returns {boolean}
215
+ */
216
+ get presenceDetected(): boolean {
217
+ return this.raw.get(PropertyType.PresenceDetected) === 1;
218
+ }
219
+ /**
220
+ * Czas od ostatniego wykrycia ruchu (z czujnika lub włączenia swiatła z przycisku). Resetowany po wywołaniu: - DetectPresence() - bez względu na Locked, DetectionDelay - SwitchLocked() przy zmianie Locked na 1 - SetLocked(On) W trybie stanowym po wywołaniu DetectPresence(), TimeFromLastPresence = 0, aż do wywołania UndetectPresence()
221
+ * @returns {number}
222
+ */
223
+ get timeFromLastPresence(): number {
224
+ return this.raw.get(PropertyType.TimeFromLastPresence);
225
+ }
226
+ /**
227
+ * Czas ignorowania DetectPresence po zmianie Locked On->Off
228
+ * @returns {number}
229
+ */
230
+ get detectionDelay(): number {
231
+ return this.raw.get(PropertyType.DetectionDelay);
232
+ }
233
+ set detectionDelay(value: number) {
234
+ this.raw.set(PropertyType.DetectionDelay, value);
235
+ }
236
+ /**
237
+ * Stan zablokowania obecności. 0 - reagowanie na DetectPresence. 1 - podtrzymanie PresenceDetected jako 1.
238
+ * @returns {LockedType}
239
+ */
240
+ get locked(): LockedType {
241
+ return this.raw.get(PropertyType.Locked);
242
+ }
243
+ /**
244
+ * Tryb działania obiektu w zależności od typu używanego czujnika ruchu: 0 - impulsowy, 1 - stanowy.
245
+ * @returns {ModeType}
246
+ */
247
+ get mode(): ModeType {
248
+ return this.raw.get(PropertyType.Mode);
249
+ }
250
+ set mode(value: ModeType) {
251
+ this.raw.set(PropertyType.Mode, value);
252
+ }
253
+ }
254
+
255
+ class PresenceSensorRemote implements IPresenceSensor {
256
+ constructor(private objectName: string, private gate: RemoteGate) {
257
+
258
+ }
259
+
260
+ /**
261
+ * Zdarzenie wywoływane przy uruchomieniu czujnika
262
+ * @param callback
263
+ */
264
+ addOnStart(_callback: () => void): void {
265
+ // Remote events are not supported
266
+ }
267
+ /**
268
+ * Zdarzenie wywoływane przy dezaktywacji czujnika
269
+ * @param callback
270
+ */
271
+ addOnStop(_callback: () => void): void {
272
+ // Remote events are not supported
273
+ }
274
+ /**
275
+ * Zdarzenie wywoływane podczas wykrycia obecności (zmiana wartości parametru PresenceDetected z 0 na 1)
276
+ * @param callback
277
+ */
278
+ addOnSwitchOn(_callback: () => void): void {
279
+ // Remote events are not supported
280
+ }
281
+ /**
282
+ * Zdarzenie wywoływane na timeout licznika (zmiana parametru PresenceDetected z 1 na 0)
283
+ * @param callback
284
+ */
285
+ addOnSwitchOff(_callback: () => void): void {
286
+ // Remote events are not supported
287
+ }
288
+
289
+ /** Uruchamia czujnik obecności */
290
+ start(): void {
291
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
292
+ .execute()
293
+ .addParameter(MethodType.Start)
294
+ .build();
295
+ this.gate.runScript(cmd!);
296
+ }
297
+
298
+ /** Zatrzymuje czujnik obecności */
299
+ stop(): void {
300
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
301
+ .execute()
302
+ .addParameter(MethodType.Stop)
303
+ .build();
304
+ this.gate.runScript(cmd!);
305
+ }
306
+
307
+ /** Metoda wywoływana podczas wykrycia obecności. Ustawia wartość cechy PresenceDetected na 1 oraz resetuje licznik TimeFromLastPresence czujnika obecności */
308
+ detectPresence(): void {
309
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
310
+ .execute()
311
+ .addParameter(MethodType.DetectPresence)
312
+ .build();
313
+ this.gate.runScript(cmd!);
314
+ }
315
+
316
+ /** Używana w trybie stanowym (Mode = 1). Kończy podtrzymywanie parametru PresenceDetected (po upływie Timeout'u). */
317
+ undetectPresence(): void {
318
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
319
+ .execute()
320
+ .addParameter(MethodType.UndetectPresence)
321
+ .build();
322
+ this.gate.runScript(cmd!);
323
+ }
324
+
325
+ /** Zmienia wartość parametru Locked na przeciwny. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff */
326
+ switchLocked(): void {
327
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
328
+ .execute()
329
+ .addParameter(MethodType.SwitchLocked)
330
+ .build();
331
+ this.gate.runScript(cmd!);
332
+ }
333
+
334
+ /**
335
+ * Ustawia wartość parametru Locked. Przypadki: - zmiana Locked z 0 na 1 - ustawienie na 1 i zablokowanie PresenceDetected, wywołanie zdarzenia OnSwitchOn (jeśli wcześniej PresenceDetected = 0), reset TimeFromLastPresence - zmiana Locked z 1 na 0 - ustawienie na 0 i odblokowanie Presence Detected, wywołanie zdarzenia OnSwitchOff - SetLocked(On) jeśli Locked = 1 - resetuje TimeFromLastPresence - SetLocked(Off) jeśli Locked = 0 - brak reakcji
336
+ * @param {LockedType} locked
337
+ */
338
+ setLocked(locked: LockedType): void {
339
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
340
+ .set()
341
+ .addParameter(PropertyType.Locked)
342
+ .addParameter(locked)
343
+ .build();
344
+ this.gate.runScript(cmd!);
345
+ }
346
+
347
+ /**
348
+ * Czas (w sekundach) od ostatniej aktywności, po którym wartość cechy PresenceDetected zostaje ustawione na 0
349
+ * @returns {number}
350
+ */
351
+ get timeout(): number {
352
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
353
+ .get()
354
+ .addParameter(PropertyType.Timeout)
355
+ .build();
356
+ return this.gate.runScript(cmd!);
357
+ }
358
+
359
+ set timeout(value: number) {
360
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
361
+ .set()
362
+ .addParameter(PropertyType.Timeout)
363
+ .addParameter(value)
364
+ .build();
365
+ this.gate.runScript(cmd!);
366
+ }
367
+
368
+ /**
369
+ * Ustawia Aktualny stan czujnika obecności, 1 - włączony, 0 - wyłączony
370
+ * @returns {StateType}
371
+ */
372
+ get state(): StateType {
373
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
374
+ .get()
375
+ .addParameter(PropertyType.State)
376
+ .build();
377
+ return this.gate.runScript(cmd!);
378
+ }
379
+
380
+ set state(value: StateType) {
381
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
382
+ .set()
383
+ .addParameter(PropertyType.State)
384
+ .addParameter(value)
385
+ .build();
386
+ this.gate.runScript(cmd!);
387
+ }
388
+
389
+ /**
390
+ * Wartość mówiąca o wykryciu ruchu przez czujnik
391
+ * @returns {boolean}
392
+ */
393
+ get presenceDetected(): boolean {
394
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
395
+ .get()
396
+ .addParameter(PropertyType.PresenceDetected)
397
+ .build();
398
+ return this.gate.runScript(cmd!) === 1;
399
+ }
400
+
401
+ /**
402
+ * Czas od ostatniego wykrycia ruchu (z czujnika lub włączenia swiatła z przycisku). Resetowany po wywołaniu: - DetectPresence() - bez względu na Locked, DetectionDelay - SwitchLocked() przy zmianie Locked na 1 - SetLocked(On) W trybie stanowym po wywołaniu DetectPresence(), TimeFromLastPresence = 0, aż do wywołania UndetectPresence()
403
+ * @returns {number}
404
+ */
405
+ get timeFromLastPresence(): number {
406
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
407
+ .get()
408
+ .addParameter(PropertyType.TimeFromLastPresence)
409
+ .build();
410
+ return this.gate.runScript(cmd!);
411
+ }
412
+
413
+ /**
414
+ * Czas ignorowania DetectPresence po zmianie Locked On->Off
415
+ * @returns {number}
416
+ */
417
+ get detectionDelay(): number {
418
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
419
+ .get()
420
+ .addParameter(PropertyType.DetectionDelay)
421
+ .build();
422
+ return this.gate.runScript(cmd!);
423
+ }
424
+
425
+ set detectionDelay(value: number) {
426
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
427
+ .set()
428
+ .addParameter(PropertyType.DetectionDelay)
429
+ .addParameter(value)
430
+ .build();
431
+ this.gate.runScript(cmd!);
432
+ }
433
+
434
+ /**
435
+ * Stan zablokowania obecności. 0 - reagowanie na DetectPresence. 1 - podtrzymanie PresenceDetected jako 1.
436
+ * @returns {LockedType}
437
+ */
438
+ get locked(): LockedType {
439
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
440
+ .get()
441
+ .addParameter(PropertyType.Locked)
442
+ .build();
443
+ return this.gate.runScript(cmd!);
444
+ }
445
+
446
+ /**
447
+ * Tryb działania obiektu w zależności od typu używanego czujnika ruchu: 0 - impulsowy, 1 - stanowy.
448
+ * @returns {ModeType}
449
+ */
450
+ get mode(): ModeType {
451
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
452
+ .get()
453
+ .addParameter(PropertyType.Mode)
454
+ .build();
455
+ return this.gate.runScript(cmd!);
456
+ }
457
+
458
+ set mode(value: ModeType) {
459
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
460
+ .set()
461
+ .addParameter(PropertyType.Mode)
462
+ .addParameter(value)
463
+ .build();
464
+ this.gate.runScript(cmd!);
465
+ }
466
+ }
467
+
468
+ export {
469
+ PresenceSensor, PresenceSensorRaw, PresenceSensorRemote, StateType, LockedType, ModeType
470
+ }