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,413 @@
1
+ // Created from: packages/grenton-api/interfaces/object_statistics_v1.xml, object name="Statistics" version="1"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
4
+ import { RemoteGate } from "../../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnValueChange = 0
8
+ }
9
+
10
+ enum PropertyType {
11
+ Value = 0,
12
+ StatisticState = 1,
13
+ Load = 2,
14
+ StatisticTypeSensor = 4,
15
+ StatisticTypeGrid = 5,
16
+ StatisticSubtypeGrid = 6,
17
+ StatisticTypeEnergyProduction = 7,
18
+ StatisticTypeEnergyStorage = 8,
19
+ StatisticTypeCharger = 9
20
+ }
21
+
22
+ enum StatisticStateType {
23
+ Off = 0,
24
+ Media = 1,
25
+ Sensor = 4,
26
+ Grid = 5,
27
+ EnergyProduction = 6,
28
+ EnergyStorage = 7,
29
+ Charger = 8,
30
+ Other = 9
31
+ }
32
+
33
+ enum StatisticTypeSensorType {
34
+ Temperature = 0,
35
+ Humidity = 1,
36
+ Lux = 2,
37
+ Pressure = 3,
38
+ CO2 = 4,
39
+ VOC = 5,
40
+ Sound = 6,
41
+ AverageValue = 18
42
+ }
43
+
44
+ enum StatisticTypeGridType {
45
+ EnergyConsumption = 20,
46
+ EnergyExport = 11,
47
+ Voltage = 8,
48
+ Power = 7,
49
+ ReactivePower = 9
50
+ }
51
+
52
+ enum StatisticSubtypeGridType {
53
+ General = 0,
54
+ Phase1 = 1,
55
+ Phase2 = 2,
56
+ Phase3 = 3
57
+ }
58
+
59
+ enum StatisticTypeEnergyProductionType {
60
+ EnergyProduction = 12,
61
+ Power = 7,
62
+ ReactivePower = 9
63
+ }
64
+
65
+ enum StatisticTypeEnergyStorageType {
66
+ BatteryLevel = 15,
67
+ EnergyCharging = 13,
68
+ EnergyDischarging = 14
69
+ }
70
+
71
+ enum StatisticTypeChargerType {
72
+ EnergyCharging = 13,
73
+ Power = 7
74
+ }
75
+
76
+ declare class StatisticsRaw {
77
+ add_event(event: EventType, callback: () => void): void;
78
+ get(property: PropertyType): any;
79
+ set(property: PropertyType, value: any): void;
80
+ execute(method: number, ...args: any[]): any;
81
+ }
82
+
83
+ interface IStatistics {
84
+ /**
85
+ * Zdarzenie wywoływane po zmianie wartości cechy Value.
86
+ * @param callback
87
+ */
88
+ addOnValueChange: (callback: () => void) => void
89
+ /** Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Dla pomiarów 'Media' – ustaw wartość w zakresie od 0.0 do 1.0 (zużycie energii zostanie obliczone automatycznie na podstawie cechy Load). Dla pomiarów 'Sensor', 'Battery Level', 'Voltage', 'Power', 'Reactive Power' i 'Other Average Value' – ustaw aktualną wartość (wartość średnia zostanie obliczona automatycznie). Dla pomiarów 'Energy' – ustaw aktualną całkowitą wartość energii w watogodzinach (różnica zostanie obliczona automatycznie). */
90
+ readonly value: number
91
+ /** Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury. */
92
+ statisticState: StatisticStateType
93
+ /** Wartość obciążenia w watach. */
94
+ load: number
95
+ /** Statystyki są wysyłane na podstawie obliczenia wartości średniej dla ustawionej wartości cechy Value w okresie 15 minut. */
96
+ statisticTypeSensor: StatisticTypeSensorType
97
+ /** Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut. */
98
+ statisticTypeGrid: StatisticTypeGridType
99
+ /** Podkategoria pomiaru. Może być to pomiar ogólny lub konkretna faza L1, L2 lub L3. */
100
+ statisticSubtypeGrid: StatisticSubtypeGridType
101
+ /** Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut. */
102
+ statisticTypeEnergyProduction: StatisticTypeEnergyProductionType
103
+ /** Dla pomiaru poziomu naładowania zliczana jest wartość średnia w okresie 15 minut. Dla pomiaru energii ładowania i rozładowywania statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. */
104
+ statisticTypeEnergyStorage: StatisticTypeEnergyStorageType
105
+ /** Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii bieżącej sesji ładowania w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut. */
106
+ statisticTypeCharger: StatisticTypeChargerType
107
+ }
108
+
109
+ class Statistics implements IStatistics {
110
+ private onValueChangeCallbacks: Array<() => void> = [];
111
+
112
+ constructor(private raw: StatisticsRaw) {
113
+ this.raw.add_event(EventType.OnValueChange, () => {
114
+ this.onValueChangeCallbacks.forEach(callback => { callback(); });
115
+ });
116
+ }
117
+
118
+ /**
119
+ * Zdarzenie wywoływane po zmianie wartości cechy Value.
120
+ * @param callback
121
+ */
122
+ addOnValueChange(callback: () => void): void {
123
+ this.onValueChangeCallbacks.push(callback);
124
+ }
125
+ /**
126
+ * Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Dla pomiarów 'Media' – ustaw wartość w zakresie od 0.0 do 1.0 (zużycie energii zostanie obliczone automatycznie na podstawie cechy Load). Dla pomiarów 'Sensor', 'Battery Level', 'Voltage', 'Power', 'Reactive Power' i 'Other Average Value' – ustaw aktualną wartość (wartość średnia zostanie obliczona automatycznie). Dla pomiarów 'Energy' – ustaw aktualną całkowitą wartość energii w watogodzinach (różnica zostanie obliczona automatycznie).
127
+ * @returns {number}
128
+ */
129
+ get value(): number {
130
+ return this.raw.get(PropertyType.Value);
131
+ }
132
+ /**
133
+ * Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury.
134
+ * @returns {StatisticStateType}
135
+ */
136
+ get statisticState(): StatisticStateType {
137
+ return this.raw.get(PropertyType.StatisticState);
138
+ }
139
+ set statisticState(value: StatisticStateType) {
140
+ this.raw.set(PropertyType.StatisticState, value);
141
+ }
142
+ /**
143
+ * Wartość obciążenia w watach.
144
+ * @returns {number}
145
+ */
146
+ get load(): number {
147
+ return this.raw.get(PropertyType.Load);
148
+ }
149
+ set load(value: number) {
150
+ this.raw.set(PropertyType.Load, value);
151
+ }
152
+ /**
153
+ * Statystyki są wysyłane na podstawie obliczenia wartości średniej dla ustawionej wartości cechy Value w okresie 15 minut.
154
+ * @returns {StatisticTypeSensorType}
155
+ */
156
+ get statisticTypeSensor(): StatisticTypeSensorType {
157
+ return this.raw.get(PropertyType.StatisticTypeSensor);
158
+ }
159
+ set statisticTypeSensor(value: StatisticTypeSensorType) {
160
+ this.raw.set(PropertyType.StatisticTypeSensor, value);
161
+ }
162
+ /**
163
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
164
+ * @returns {StatisticTypeGridType}
165
+ */
166
+ get statisticTypeGrid(): StatisticTypeGridType {
167
+ return this.raw.get(PropertyType.StatisticTypeGrid);
168
+ }
169
+ set statisticTypeGrid(value: StatisticTypeGridType) {
170
+ this.raw.set(PropertyType.StatisticTypeGrid, value);
171
+ }
172
+ /**
173
+ * Podkategoria pomiaru. Może być to pomiar ogólny lub konkretna faza L1, L2 lub L3.
174
+ * @returns {StatisticSubtypeGridType}
175
+ */
176
+ get statisticSubtypeGrid(): StatisticSubtypeGridType {
177
+ return this.raw.get(PropertyType.StatisticSubtypeGrid);
178
+ }
179
+ set statisticSubtypeGrid(value: StatisticSubtypeGridType) {
180
+ this.raw.set(PropertyType.StatisticSubtypeGrid, value);
181
+ }
182
+ /**
183
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
184
+ * @returns {StatisticTypeEnergyProductionType}
185
+ */
186
+ get statisticTypeEnergyProduction(): StatisticTypeEnergyProductionType {
187
+ return this.raw.get(PropertyType.StatisticTypeEnergyProduction);
188
+ }
189
+ set statisticTypeEnergyProduction(value: StatisticTypeEnergyProductionType) {
190
+ this.raw.set(PropertyType.StatisticTypeEnergyProduction, value);
191
+ }
192
+ /**
193
+ * Dla pomiaru poziomu naładowania zliczana jest wartość średnia w okresie 15 minut. Dla pomiaru energii ładowania i rozładowywania statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach.
194
+ * @returns {StatisticTypeEnergyStorageType}
195
+ */
196
+ get statisticTypeEnergyStorage(): StatisticTypeEnergyStorageType {
197
+ return this.raw.get(PropertyType.StatisticTypeEnergyStorage);
198
+ }
199
+ set statisticTypeEnergyStorage(value: StatisticTypeEnergyStorageType) {
200
+ this.raw.set(PropertyType.StatisticTypeEnergyStorage, value);
201
+ }
202
+ /**
203
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii bieżącej sesji ładowania w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
204
+ * @returns {StatisticTypeChargerType}
205
+ */
206
+ get statisticTypeCharger(): StatisticTypeChargerType {
207
+ return this.raw.get(PropertyType.StatisticTypeCharger);
208
+ }
209
+ set statisticTypeCharger(value: StatisticTypeChargerType) {
210
+ this.raw.set(PropertyType.StatisticTypeCharger, value);
211
+ }
212
+ }
213
+
214
+ class StatisticsRemote implements IStatistics {
215
+ constructor(private objectName: string, private gate: RemoteGate) {
216
+
217
+ }
218
+
219
+ /**
220
+ * Zdarzenie wywoływane po zmianie wartości cechy Value.
221
+ * @param callback
222
+ */
223
+ addOnValueChange(_callback: () => void): void {
224
+ // Remote events are not supported
225
+ }
226
+
227
+ /**
228
+ * Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Dla pomiarów 'Media' – ustaw wartość w zakresie od 0.0 do 1.0 (zużycie energii zostanie obliczone automatycznie na podstawie cechy Load). Dla pomiarów 'Sensor', 'Battery Level', 'Voltage', 'Power', 'Reactive Power' i 'Other Average Value' – ustaw aktualną wartość (wartość średnia zostanie obliczona automatycznie). Dla pomiarów 'Energy' – ustaw aktualną całkowitą wartość energii w watogodzinach (różnica zostanie obliczona automatycznie).
229
+ * @returns {number}
230
+ */
231
+ get value(): number {
232
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
233
+ .get()
234
+ .addParameter(PropertyType.Value)
235
+ .build();
236
+ return this.gate.runScript(cmd!);
237
+ }
238
+
239
+ /**
240
+ * Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury.
241
+ * @returns {StatisticStateType}
242
+ */
243
+ get statisticState(): StatisticStateType {
244
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
245
+ .get()
246
+ .addParameter(PropertyType.StatisticState)
247
+ .build();
248
+ return this.gate.runScript(cmd!);
249
+ }
250
+
251
+ set statisticState(value: StatisticStateType) {
252
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
253
+ .set()
254
+ .addParameter(PropertyType.StatisticState)
255
+ .addParameter(value)
256
+ .build();
257
+ this.gate.runScript(cmd!);
258
+ }
259
+
260
+ /**
261
+ * Wartość obciążenia w watach.
262
+ * @returns {number}
263
+ */
264
+ get load(): number {
265
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
266
+ .get()
267
+ .addParameter(PropertyType.Load)
268
+ .build();
269
+ return this.gate.runScript(cmd!);
270
+ }
271
+
272
+ set load(value: number) {
273
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
274
+ .set()
275
+ .addParameter(PropertyType.Load)
276
+ .addParameter(value)
277
+ .build();
278
+ this.gate.runScript(cmd!);
279
+ }
280
+
281
+ /**
282
+ * Statystyki są wysyłane na podstawie obliczenia wartości średniej dla ustawionej wartości cechy Value w okresie 15 minut.
283
+ * @returns {StatisticTypeSensorType}
284
+ */
285
+ get statisticTypeSensor(): StatisticTypeSensorType {
286
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
287
+ .get()
288
+ .addParameter(PropertyType.StatisticTypeSensor)
289
+ .build();
290
+ return this.gate.runScript(cmd!);
291
+ }
292
+
293
+ set statisticTypeSensor(value: StatisticTypeSensorType) {
294
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
295
+ .set()
296
+ .addParameter(PropertyType.StatisticTypeSensor)
297
+ .addParameter(value)
298
+ .build();
299
+ this.gate.runScript(cmd!);
300
+ }
301
+
302
+ /**
303
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
304
+ * @returns {StatisticTypeGridType}
305
+ */
306
+ get statisticTypeGrid(): StatisticTypeGridType {
307
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
308
+ .get()
309
+ .addParameter(PropertyType.StatisticTypeGrid)
310
+ .build();
311
+ return this.gate.runScript(cmd!);
312
+ }
313
+
314
+ set statisticTypeGrid(value: StatisticTypeGridType) {
315
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
316
+ .set()
317
+ .addParameter(PropertyType.StatisticTypeGrid)
318
+ .addParameter(value)
319
+ .build();
320
+ this.gate.runScript(cmd!);
321
+ }
322
+
323
+ /**
324
+ * Podkategoria pomiaru. Może być to pomiar ogólny lub konkretna faza L1, L2 lub L3.
325
+ * @returns {StatisticSubtypeGridType}
326
+ */
327
+ get statisticSubtypeGrid(): StatisticSubtypeGridType {
328
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
329
+ .get()
330
+ .addParameter(PropertyType.StatisticSubtypeGrid)
331
+ .build();
332
+ return this.gate.runScript(cmd!);
333
+ }
334
+
335
+ set statisticSubtypeGrid(value: StatisticSubtypeGridType) {
336
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
337
+ .set()
338
+ .addParameter(PropertyType.StatisticSubtypeGrid)
339
+ .addParameter(value)
340
+ .build();
341
+ this.gate.runScript(cmd!);
342
+ }
343
+
344
+ /**
345
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
346
+ * @returns {StatisticTypeEnergyProductionType}
347
+ */
348
+ get statisticTypeEnergyProduction(): StatisticTypeEnergyProductionType {
349
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
350
+ .get()
351
+ .addParameter(PropertyType.StatisticTypeEnergyProduction)
352
+ .build();
353
+ return this.gate.runScript(cmd!);
354
+ }
355
+
356
+ set statisticTypeEnergyProduction(value: StatisticTypeEnergyProductionType) {
357
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
358
+ .set()
359
+ .addParameter(PropertyType.StatisticTypeEnergyProduction)
360
+ .addParameter(value)
361
+ .build();
362
+ this.gate.runScript(cmd!);
363
+ }
364
+
365
+ /**
366
+ * Dla pomiaru poziomu naładowania zliczana jest wartość średnia w okresie 15 minut. Dla pomiaru energii ładowania i rozładowywania statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii w watogodzinach.
367
+ * @returns {StatisticTypeEnergyStorageType}
368
+ */
369
+ get statisticTypeEnergyStorage(): StatisticTypeEnergyStorageType {
370
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
371
+ .get()
372
+ .addParameter(PropertyType.StatisticTypeEnergyStorage)
373
+ .build();
374
+ return this.gate.runScript(cmd!);
375
+ }
376
+
377
+ set statisticTypeEnergyStorage(value: StatisticTypeEnergyStorageType) {
378
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
379
+ .set()
380
+ .addParameter(PropertyType.StatisticTypeEnergyStorage)
381
+ .addParameter(value)
382
+ .build();
383
+ this.gate.runScript(cmd!);
384
+ }
385
+
386
+ /**
387
+ * Dla pomiaru energii statystyki są wysyłane na podstawie zliczania różnicy w wartości cechy Value w okresie 15 minut. Cechę Value należy aktualizować o całkowitą wartość energii bieżącej sesji ładowania w watogodzinach. Dla pozostałych typów pomiaru zliczana jest wartość średnia w okresie 15 minut.
388
+ * @returns {StatisticTypeChargerType}
389
+ */
390
+ get statisticTypeCharger(): StatisticTypeChargerType {
391
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
392
+ .get()
393
+ .addParameter(PropertyType.StatisticTypeCharger)
394
+ .build();
395
+ return this.gate.runScript(cmd!);
396
+ }
397
+
398
+ set statisticTypeCharger(value: StatisticTypeChargerType) {
399
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
400
+ .set()
401
+ .addParameter(PropertyType.StatisticTypeCharger)
402
+ .addParameter(value)
403
+ .build();
404
+ this.gate.runScript(cmd!);
405
+ }
406
+ }
407
+
408
+ export {
409
+ Statistics, StatisticsRaw, StatisticsRemote,
410
+ StatisticStateType, StatisticTypeSensorType, StatisticTypeGridType,
411
+ StatisticSubtypeGridType, StatisticTypeEnergyProductionType,
412
+ StatisticTypeEnergyStorageType, StatisticTypeChargerType
413
+ }
@@ -0,0 +1,218 @@
1
+ // Created from: packages/grenton-api/interfaces/object_statistics_pulse_v1.xml, object name="StatisticsPulse" version="1"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
4
+ import { RemoteGate } from "../../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnPulseTriggered = 1
8
+ }
9
+
10
+ enum PropertyType {
11
+ Value = 10,
12
+ StatisticState = 1,
13
+ Load = 2,
14
+ StatisticTypePulse = 3
15
+ }
16
+
17
+ enum MethodType {
18
+ TriggerPulse = 0
19
+ }
20
+
21
+ enum StatisticStateType {
22
+ Off = 0,
23
+ Media = 2,
24
+ OtherCounter = 10
25
+ }
26
+
27
+ enum StatisticTypePulseType {
28
+ Energy = 10,
29
+ Water = 16,
30
+ Gas = 17
31
+ }
32
+
33
+ declare class StatisticsPulseRaw {
34
+ add_event(event: EventType, callback: () => void): void;
35
+ get(property: PropertyType): any;
36
+ set(property: PropertyType, value: any): void;
37
+ execute(method: MethodType, ...args: any[]): any;
38
+ }
39
+
40
+ interface IStatisticsPulse {
41
+ /**
42
+ * Zdarzenie wywoływane po wyzwoleniu impulsu.
43
+ * @param callback
44
+ */
45
+ addOnPulseTriggered: (callback: () => void) => void
46
+ /** Wyzwala impuls dla pomiaru typu Pulse, lub dla licznika impulsów. */
47
+ triggerPulse: () => void
48
+ /** Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Użyj metody TriggerPulse aby dodać kolejną wartość do pomiaru. Dla pomiarów 'Media' – do licznika zostanie dodana wartość cechy Load. Po wysłaniu wartości na serwer, licznik jest resetowany. */
49
+ readonly value: number
50
+ /** Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury. */
51
+ statisticState: StatisticStateType
52
+ /** Wartość na impuls w watach lub metrach sześciennych. */
53
+ load: number
54
+ /** Statystyki są wysyłane na podstawie zliczania impulsów za pomocą metody TriggerPulse, oraz zadeklarowanej wartości dla jednego impulsu wyrażonej w watach lub m³. Wartość Value przedtsaiwa aktualną wartość do wysłania na serwer. */
55
+ statisticTypePulse: StatisticTypePulseType
56
+ }
57
+
58
+ class StatisticsPulse implements IStatisticsPulse {
59
+ private onPulseTriggeredCallbacks: Array<() => void> = [];
60
+
61
+ constructor(private raw: StatisticsPulseRaw) {
62
+ this.raw.add_event(EventType.OnPulseTriggered, () => {
63
+ this.onPulseTriggeredCallbacks.forEach(callback => { callback(); });
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Zdarzenie wywoływane po wyzwoleniu impulsu.
69
+ * @param callback
70
+ */
71
+ addOnPulseTriggered(callback: () => void): void {
72
+ this.onPulseTriggeredCallbacks.push(callback);
73
+ }
74
+ /** Wyzwala impuls dla pomiaru typu Pulse, lub dla licznika impulsów. */
75
+ triggerPulse(): void {
76
+ this.raw.execute(MethodType.TriggerPulse);
77
+ }
78
+ /**
79
+ * Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Użyj metody TriggerPulse aby dodać kolejną wartość do pomiaru. Dla pomiarów 'Media' – do licznika zostanie dodana wartość cechy Load. Po wysłaniu wartości na serwer, licznik jest resetowany.
80
+ * @returns {number}
81
+ */
82
+ get value(): number {
83
+ return this.raw.get(PropertyType.Value);
84
+ }
85
+ /**
86
+ * Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury.
87
+ * @returns {StatisticStateType}
88
+ */
89
+ get statisticState(): StatisticStateType {
90
+ return this.raw.get(PropertyType.StatisticState);
91
+ }
92
+ set statisticState(value: StatisticStateType) {
93
+ this.raw.set(PropertyType.StatisticState, value);
94
+ }
95
+ /**
96
+ * Wartość na impuls w watach lub metrach sześciennych.
97
+ * @returns {number}
98
+ */
99
+ get load(): number {
100
+ return this.raw.get(PropertyType.Load);
101
+ }
102
+ set load(value: number) {
103
+ this.raw.set(PropertyType.Load, value);
104
+ }
105
+ /**
106
+ * Statystyki są wysyłane na podstawie zliczania impulsów za pomocą metody TriggerPulse, oraz zadeklarowanej wartości dla jednego impulsu wyrażonej w watach lub m³. Wartość Value przedtsaiwa aktualną wartość do wysłania na serwer.
107
+ * @returns {StatisticTypePulseType}
108
+ */
109
+ get statisticTypePulse(): StatisticTypePulseType {
110
+ return this.raw.get(PropertyType.StatisticTypePulse);
111
+ }
112
+ set statisticTypePulse(value: StatisticTypePulseType) {
113
+ this.raw.set(PropertyType.StatisticTypePulse, value);
114
+ }
115
+ }
116
+
117
+ class StatisticsPulseRemote implements IStatisticsPulse {
118
+ constructor(private objectName: string, private gate: RemoteGate) {
119
+
120
+ }
121
+
122
+ /**
123
+ * Zdarzenie wywoływane po wyzwoleniu impulsu.
124
+ * @param callback
125
+ */
126
+ addOnPulseTriggered(_callback: () => void): void {
127
+ // Remote events are not supported
128
+ }
129
+
130
+ /** Wyzwala impuls dla pomiaru typu Pulse, lub dla licznika impulsów. */
131
+ triggerPulse(): void {
132
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
133
+ .execute()
134
+ .addParameter(MethodType.TriggerPulse)
135
+ .build();
136
+ this.gate.runScript(cmd!);
137
+ }
138
+
139
+ /**
140
+ * Wartość pomiarowa obliczana i wysyłana jako statystyka do serwera co pełne 15 minut. Użyj metody TriggerPulse aby dodać kolejną wartość do pomiaru. Dla pomiarów 'Media' – do licznika zostanie dodana wartość cechy Load. Po wysłaniu wartości na serwer, licznik jest resetowany.
141
+ * @returns {number}
142
+ */
143
+ get value(): number {
144
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
145
+ .get()
146
+ .addParameter(PropertyType.Value)
147
+ .build();
148
+ return this.gate.runScript(cmd!);
149
+ }
150
+
151
+ /**
152
+ * Włącza raportowanie pomiaru do statystyk oraz definiuje kategorię pomiaru. Uwaga! Raz wysłana statystyka pozostaje w historii statystyk na serwerze. Możliwe jest manualne usunięcie statystyk z poziomu panelu konta w chmurze. Off - Statystyki nie są wysyłane do chmury.
153
+ * @returns {StatisticStateType}
154
+ */
155
+ get statisticState(): StatisticStateType {
156
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
157
+ .get()
158
+ .addParameter(PropertyType.StatisticState)
159
+ .build();
160
+ return this.gate.runScript(cmd!);
161
+ }
162
+
163
+ set statisticState(value: StatisticStateType) {
164
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
165
+ .set()
166
+ .addParameter(PropertyType.StatisticState)
167
+ .addParameter(value)
168
+ .build();
169
+ this.gate.runScript(cmd!);
170
+ }
171
+
172
+ /**
173
+ * Wartość na impuls w watach lub metrach sześciennych.
174
+ * @returns {number}
175
+ */
176
+ get load(): number {
177
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
178
+ .get()
179
+ .addParameter(PropertyType.Load)
180
+ .build();
181
+ return this.gate.runScript(cmd!);
182
+ }
183
+
184
+ set load(value: number) {
185
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
186
+ .set()
187
+ .addParameter(PropertyType.Load)
188
+ .addParameter(value)
189
+ .build();
190
+ this.gate.runScript(cmd!);
191
+ }
192
+
193
+ /**
194
+ * Statystyki są wysyłane na podstawie zliczania impulsów za pomocą metody TriggerPulse, oraz zadeklarowanej wartości dla jednego impulsu wyrażonej w watach lub m³. Wartość Value przedtsaiwa aktualną wartość do wysłania na serwer.
195
+ * @returns {StatisticTypePulseType}
196
+ */
197
+ get statisticTypePulse(): StatisticTypePulseType {
198
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
199
+ .get()
200
+ .addParameter(PropertyType.StatisticTypePulse)
201
+ .build();
202
+ return this.gate.runScript(cmd!);
203
+ }
204
+
205
+ set statisticTypePulse(value: StatisticTypePulseType) {
206
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
207
+ .set()
208
+ .addParameter(PropertyType.StatisticTypePulse)
209
+ .addParameter(value)
210
+ .build();
211
+ this.gate.runScript(cmd!);
212
+ }
213
+ }
214
+
215
+ export {
216
+ StatisticsPulse, StatisticsPulseRaw, StatisticsPulseRemote,
217
+ StatisticStateType, StatisticTypePulseType
218
+ }