iobroker.loxone 3.0.1 → 4.0.1

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 (185) hide show
  1. package/LICENSE +183 -183
  2. package/README.md +421 -411
  3. package/admin/i18n/de.json +15 -0
  4. package/admin/i18n/en.json +15 -0
  5. package/admin/i18n/es.json +18 -0
  6. package/admin/i18n/fr.json +18 -0
  7. package/admin/i18n/it.json +18 -0
  8. package/admin/i18n/nl.json +18 -0
  9. package/admin/i18n/pl.json +18 -0
  10. package/admin/i18n/pt.json +18 -0
  11. package/admin/i18n/ru.json +18 -0
  12. package/admin/i18n/uk.json +18 -0
  13. package/admin/i18n/zh-cn.json +18 -0
  14. package/admin/jsonConfig.json +96 -0
  15. package/io-package.json +60 -49
  16. package/package.json +36 -49
  17. package/src/controls/AalEmergency.ts +90 -0
  18. package/src/controls/AalSmartAlarm.ts +99 -0
  19. package/src/controls/Alarm.ts +146 -0
  20. package/src/controls/AlarmClock.ts +137 -0
  21. package/src/controls/Application.ts +13 -0
  22. package/src/controls/AudioZone.ts +227 -0
  23. package/src/controls/AudioZoneV2.ts +135 -0
  24. package/src/controls/CentralAlarm.ts +59 -0
  25. package/src/controls/CentralAudioZone.ts +41 -0
  26. package/src/controls/CentralGate.ts +53 -0
  27. package/src/controls/CentralJalousie.ts +67 -0
  28. package/src/controls/CentralLightController.ts +45 -0
  29. package/src/controls/ColorPickerV2.ts +34 -0
  30. package/src/controls/Colorpicker.ts +30 -0
  31. package/src/controls/ColorpickerBase.ts +326 -0
  32. package/src/controls/Daytimer.ts +201 -0
  33. package/src/controls/Dimmer.ts +64 -0
  34. package/src/controls/EIBDimmer.ts +61 -0
  35. package/src/controls/Fronius.ts +217 -0
  36. package/src/controls/Gate.ts +150 -0
  37. package/src/controls/Hourcounter.ts +115 -0
  38. package/src/controls/IRCDaytimer.ts +4 -0
  39. package/src/controls/IRCV2Daytimer.ts +4 -0
  40. package/src/controls/IRoomControllerV2.ts +595 -0
  41. package/src/controls/InfoOnlyAnalog.ts +56 -0
  42. package/src/controls/InfoOnlyDigital.ts +95 -0
  43. package/src/controls/InfoOnlyText.ts +52 -0
  44. package/{build/controls/Intercom.js → src/controls/Intercom.ts} +27 -11
  45. package/src/controls/Jalousie.ts +219 -0
  46. package/src/controls/LightController.ts +112 -0
  47. package/src/controls/LightControllerV2.ts +246 -0
  48. package/src/controls/MailBox.ts +92 -0
  49. package/src/controls/Meter.ts +94 -0
  50. package/src/controls/None.ts +29 -0
  51. package/src/controls/PresenceDetector.ts +47 -0
  52. package/src/controls/Pushbutton.ts +55 -0
  53. package/src/controls/Radio.ts +61 -0
  54. package/{build/controls/Remote.js → src/controls/Remote.ts} +19 -11
  55. package/src/controls/Slider.ts +78 -0
  56. package/src/controls/SmokeAlarm.ts +163 -0
  57. package/src/controls/Switch.ts +46 -0
  58. package/src/controls/SystemScheme.ts +13 -0
  59. package/src/controls/TextInput.ts +96 -0
  60. package/src/controls/TextState.ts +37 -0
  61. package/src/controls/TimedSwitch.ts +75 -0
  62. package/src/controls/Tracker.ts +30 -0
  63. package/{build/controls/Unknown.js → src/controls/Unknown.ts} +18 -11
  64. package/src/controls/UpDownAnalog.ts +78 -0
  65. package/{build/controls/ValueSelector.js → src/controls/ValueSelector.ts} +21 -9
  66. package/src/controls/WindowMonitor.ts +139 -0
  67. package/src/controls/all-controls.ts +99 -0
  68. package/src/controls/control-base.ts +28 -0
  69. package/src/lib/adapter-config.d.ts +22 -0
  70. package/src/loxone-handler-base.ts +285 -0
  71. package/src/lxcommunicator.d.ts +1 -0
  72. package/src/main.test.ts +24 -0
  73. package/{build/main.js → src/main.ts} +516 -310
  74. package/src/structure-file.d.ts +154 -0
  75. package/src/weather-server-handler.ts +266 -0
  76. package/admin/admin.d.ts +0 -58
  77. package/admin/index_m.html +0 -126
  78. package/admin/style.css +0 -32
  79. package/admin/words.js +0 -25
  80. package/build/controls/AalEmergency.js +0 -45
  81. package/build/controls/AalEmergency.js.map +0 -1
  82. package/build/controls/AalSmartAlarm.js +0 -48
  83. package/build/controls/AalSmartAlarm.js.map +0 -1
  84. package/build/controls/Alarm.js +0 -81
  85. package/build/controls/Alarm.js.map +0 -1
  86. package/build/controls/AlarmClock.js +0 -59
  87. package/build/controls/AlarmClock.js.map +0 -1
  88. package/build/controls/Application.js +0 -11
  89. package/build/controls/Application.js.map +0 -1
  90. package/build/controls/AudioZone.js +0 -116
  91. package/build/controls/AudioZone.js.map +0 -1
  92. package/build/controls/CentralAlarm.js +0 -30
  93. package/build/controls/CentralAlarm.js.map +0 -1
  94. package/build/controls/CentralAudioZone.js +0 -22
  95. package/build/controls/CentralAudioZone.js.map +0 -1
  96. package/build/controls/CentralGate.js +0 -30
  97. package/build/controls/CentralGate.js.map +0 -1
  98. package/build/controls/CentralJalousie.js +0 -39
  99. package/build/controls/CentralJalousie.js.map +0 -1
  100. package/build/controls/CentralLightController.js +0 -27
  101. package/build/controls/CentralLightController.js.map +0 -1
  102. package/build/controls/ColorPickerV2.js +0 -24
  103. package/build/controls/ColorPickerV2.js.map +0 -1
  104. package/build/controls/Colorpicker.js +0 -20
  105. package/build/controls/Colorpicker.js.map +0 -1
  106. package/build/controls/ColorpickerBase.js +0 -263
  107. package/build/controls/ColorpickerBase.js.map +0 -1
  108. package/build/controls/Daytimer.js +0 -119
  109. package/build/controls/Daytimer.js.map +0 -1
  110. package/build/controls/Dimmer.js +0 -34
  111. package/build/controls/Dimmer.js.map +0 -1
  112. package/build/controls/EIBDimmer.js +0 -31
  113. package/build/controls/EIBDimmer.js.map +0 -1
  114. package/build/controls/Fronius.js +0 -64
  115. package/build/controls/Fronius.js.map +0 -1
  116. package/build/controls/Gate.js +0 -104
  117. package/build/controls/Gate.js.map +0 -1
  118. package/build/controls/Hourcounter.js +0 -46
  119. package/build/controls/Hourcounter.js.map +0 -1
  120. package/build/controls/IRCDaytimer.js +0 -9
  121. package/build/controls/IRCDaytimer.js.map +0 -1
  122. package/build/controls/IRCV2Daytimer.js +0 -9
  123. package/build/controls/IRCV2Daytimer.js.map +0 -1
  124. package/build/controls/IRoomControllerV2.js +0 -371
  125. package/build/controls/IRoomControllerV2.js.map +0 -1
  126. package/build/controls/InfoOnlyAnalog.js +0 -38
  127. package/build/controls/InfoOnlyAnalog.js.map +0 -1
  128. package/build/controls/InfoOnlyDigital.js +0 -65
  129. package/build/controls/InfoOnlyDigital.js.map +0 -1
  130. package/build/controls/InfoOnlyText.js +0 -35
  131. package/build/controls/InfoOnlyText.js.map +0 -1
  132. package/build/controls/Intercom.js.map +0 -1
  133. package/build/controls/Jalousie.js +0 -153
  134. package/build/controls/Jalousie.js.map +0 -1
  135. package/build/controls/LightController.js +0 -68
  136. package/build/controls/LightController.js.map +0 -1
  137. package/build/controls/LightControllerV2.js +0 -195
  138. package/build/controls/LightControllerV2.js.map +0 -1
  139. package/build/controls/MailBox.js +0 -41
  140. package/build/controls/MailBox.js.map +0 -1
  141. package/build/controls/Meter.js +0 -52
  142. package/build/controls/Meter.js.map +0 -1
  143. package/build/controls/None.js +0 -23
  144. package/build/controls/None.js.map +0 -1
  145. package/build/controls/PresenceDetector.js +0 -29
  146. package/build/controls/PresenceDetector.js.map +0 -1
  147. package/build/controls/Pushbutton.js +0 -35
  148. package/build/controls/Pushbutton.js.map +0 -1
  149. package/build/controls/Radio.js +0 -39
  150. package/build/controls/Radio.js.map +0 -1
  151. package/build/controls/Remote.js.map +0 -1
  152. package/build/controls/Slider.js +0 -44
  153. package/build/controls/Slider.js.map +0 -1
  154. package/build/controls/SmokeAlarm.js +0 -85
  155. package/build/controls/SmokeAlarm.js.map +0 -1
  156. package/build/controls/Switch.js +0 -31
  157. package/build/controls/Switch.js.map +0 -1
  158. package/build/controls/SystemScheme.js +0 -11
  159. package/build/controls/SystemScheme.js.map +0 -1
  160. package/build/controls/TextInput.js +0 -55
  161. package/build/controls/TextInput.js.map +0 -1
  162. package/build/controls/TextState.js +0 -20
  163. package/build/controls/TextState.js.map +0 -1
  164. package/build/controls/TimedSwitch.js +0 -36
  165. package/build/controls/TimedSwitch.js.map +0 -1
  166. package/build/controls/Tracker.js +0 -20
  167. package/build/controls/Tracker.js.map +0 -1
  168. package/build/controls/Unknown.js.map +0 -1
  169. package/build/controls/UpDownAnalog.js +0 -44
  170. package/build/controls/UpDownAnalog.js.map +0 -1
  171. package/build/controls/ValueSelector.js.map +0 -1
  172. package/build/controls/WindowMonitor.js +0 -84
  173. package/build/controls/WindowMonitor.js.map +0 -1
  174. package/build/controls/control-base.js +0 -12
  175. package/build/controls/control-base.js.map +0 -1
  176. package/build/loxone-handler-base.js +0 -186
  177. package/build/loxone-handler-base.js.map +0 -1
  178. package/build/main.js.map +0 -1
  179. package/build/weather-server-handler.js +0 -120
  180. package/build/weather-server-handler.js.map +0 -1
  181. package/doc/details-missing-control-type.png +0 -0
  182. package/doc/log-missing-control-type.png +0 -0
  183. package/doc/loxone-config-display-diagnostics.png +0 -0
  184. package/doc/loxone-config-info-only-digital.png +0 -0
  185. package/doc/loxone-config-use-in-visualization.png +0 -0
@@ -0,0 +1,227 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for AudioZone controls.
8
+ */
9
+ export class AudioZone extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'media.music',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.loadOtherControlStatesAsync(control.name, uuid, control.states, [
28
+ 'serverState',
29
+ 'playState',
30
+ 'clientState',
31
+ 'power',
32
+ 'volume',
33
+ 'maxVolume',
34
+ 'volumeStep',
35
+ 'shuffle',
36
+ 'sourceList',
37
+ 'repeat',
38
+ 'songName',
39
+ 'duration',
40
+ 'progress',
41
+ 'album',
42
+ 'artist',
43
+ 'station',
44
+ 'genre',
45
+ 'cover',
46
+ 'source',
47
+ ]);
48
+
49
+ const serverStates = {
50
+ '-3': 'invalid zone',
51
+ '-2': 'not reachable',
52
+ '-1': 'unknown',
53
+ 0: 'offline',
54
+ 1: 'initializing',
55
+ 2: 'online',
56
+ };
57
+ const playStates = {
58
+ '-1': 'unknown',
59
+ 0: 'stopped',
60
+ 1: 'paused',
61
+ 2: 'playing',
62
+ };
63
+ const clientStates = {
64
+ 0: 'offline',
65
+ 1: 'initializing',
66
+ 2: 'online',
67
+ };
68
+ await this.createSimpleControlStateObjectAsync(
69
+ control.name,
70
+ uuid,
71
+ control.states,
72
+ 'serverState',
73
+ 'number',
74
+ 'value',
75
+ { states: serverStates },
76
+ );
77
+ await this.createSimpleControlStateObjectAsync(
78
+ control.name,
79
+ uuid,
80
+ control.states,
81
+ 'playState',
82
+ 'number',
83
+ 'value',
84
+ { write: true, states: playStates },
85
+ );
86
+ await this.createSimpleControlStateObjectAsync(
87
+ control.name,
88
+ uuid,
89
+ control.states,
90
+ 'clientState',
91
+ 'number',
92
+ 'value',
93
+ { states: clientStates },
94
+ );
95
+ await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'power', 'switch', {
96
+ write: true,
97
+ // TODO: re-add: smartIgnore: false,
98
+ });
99
+ await this.createSimpleControlStateObjectAsync(
100
+ control.name,
101
+ uuid,
102
+ control.states,
103
+ 'volume',
104
+ 'number',
105
+ 'level.volume',
106
+ { write: true },
107
+ );
108
+ await this.createSimpleControlStateObjectAsync(
109
+ control.name,
110
+ uuid,
111
+ control.states,
112
+ 'maxVolume',
113
+ 'number',
114
+ 'value',
115
+ );
116
+ await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'shuffle', 'switch', {
117
+ write: true,
118
+ });
119
+ await this.createSimpleControlStateObjectAsync(
120
+ control.name,
121
+ uuid,
122
+ control.states,
123
+ 'sourceList',
124
+ 'string',
125
+ 'json',
126
+ );
127
+ await this.createSimpleControlStateObjectAsync(
128
+ control.name,
129
+ uuid,
130
+ control.states,
131
+ 'repeat',
132
+ 'number',
133
+ 'value',
134
+ { write: true },
135
+ );
136
+ await this.createSimpleControlStateObjectAsync(
137
+ control.name,
138
+ uuid,
139
+ control.states,
140
+ 'songName',
141
+ 'string',
142
+ 'text',
143
+ );
144
+ await this.createSimpleControlStateObjectAsync(
145
+ control.name,
146
+ uuid,
147
+ control.states,
148
+ 'duration',
149
+ 'number',
150
+ 'value.interval',
151
+ );
152
+ await this.createSimpleControlStateObjectAsync(
153
+ control.name,
154
+ uuid,
155
+ control.states,
156
+ 'progress',
157
+ 'number',
158
+ 'value.interval',
159
+ { write: true },
160
+ );
161
+ await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'album', 'string', 'text');
162
+ await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'artist', 'string', 'text');
163
+ await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'station', 'string', 'text');
164
+ await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'genre', 'string', 'text');
165
+ await this.createSimpleControlStateObjectAsync(
166
+ control.name,
167
+ uuid,
168
+ control.states,
169
+ 'cover',
170
+ 'string',
171
+ 'text.url',
172
+ );
173
+ await this.createSimpleControlStateObjectAsync(
174
+ control.name,
175
+ uuid,
176
+ control.states,
177
+ 'source',
178
+ 'number',
179
+ 'value',
180
+ { write: true },
181
+ );
182
+
183
+ this.addStateChangeListener(`${uuid}.playState`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
184
+ newValue = this.convertStateToInt(newValue);
185
+ if (newValue === 0 || newValue === 1) {
186
+ this.sendCommand(control.uuidAction, 'pause');
187
+ } else if (newValue === 2) {
188
+ this.sendCommand(control.uuidAction, 'play');
189
+ }
190
+ });
191
+ this.addStateChangeListener(`${uuid}.power`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
192
+ this.sendCommand(control.uuidAction, newValue ? 'on' : 'off');
193
+ });
194
+ this.addStateChangeListener(`${uuid}.volume`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
195
+ this.sendCommand(control.uuidAction, `volume/${newValue}`);
196
+ });
197
+ this.addStateChangeListener(`${uuid}.shuffle`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
198
+ this.sendCommand(control.uuidAction, `shuffle/${newValue ? 1 : 0}`);
199
+ });
200
+ this.addStateChangeListener(`${uuid}.repeat`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
201
+ this.sendCommand(control.uuidAction, `repeat/${newValue}`);
202
+ });
203
+ this.addStateChangeListener(`${uuid}.progress`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
204
+ this.sendCommand(control.uuidAction, `progress/${newValue}`);
205
+ });
206
+ this.addStateChangeListener(`${uuid}.source`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
207
+ this.sendCommand(control.uuidAction, `source/${newValue}`);
208
+ });
209
+
210
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'prev');
211
+ this.addStateChangeListener(
212
+ `${uuid}.prev`,
213
+ () => {
214
+ this.sendCommand(control.uuidAction, 'prev');
215
+ },
216
+ { selfAck: true },
217
+ );
218
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'next');
219
+ this.addStateChangeListener(
220
+ `${uuid}.next`,
221
+ () => {
222
+ this.sendCommand(control.uuidAction, 'next');
223
+ },
224
+ { selfAck: true },
225
+ );
226
+ }
227
+ }
@@ -0,0 +1,135 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for AudioZoneV2 controls.
8
+ */
9
+ export class AudioZoneV2 extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'media.music',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.loadOtherControlStatesAsync(control.name, uuid, control.states, [
28
+ 'serverState',
29
+ 'playState',
30
+ 'clientState',
31
+ 'power',
32
+ 'volume',
33
+ 'volumeStep',
34
+ 'tts',
35
+ ]);
36
+
37
+ const serverStates = {
38
+ '-3': 'invalid zone',
39
+ '-2': 'not reachable',
40
+ '-1': 'unknown',
41
+ 0: 'offline',
42
+ 1: 'initializing',
43
+ 2: 'online',
44
+ };
45
+ const playStates = {
46
+ '-1': 'unknown',
47
+ 0: 'stopped',
48
+ 1: 'paused',
49
+ 2: 'playing',
50
+ };
51
+ const clientStates = {
52
+ 0: 'offline',
53
+ 1: 'initializing',
54
+ 2: 'online',
55
+ };
56
+ await this.createSimpleControlStateObjectAsync(
57
+ control.name,
58
+ uuid,
59
+ control.states,
60
+ 'serverState',
61
+ 'number',
62
+ 'value',
63
+ { states: serverStates },
64
+ );
65
+ await this.createSimpleControlStateObjectAsync(
66
+ control.name,
67
+ uuid,
68
+ control.states,
69
+ 'playState',
70
+ 'number',
71
+ 'value',
72
+ { write: true, states: playStates },
73
+ );
74
+ await this.createSimpleControlStateObjectAsync(
75
+ control.name,
76
+ uuid,
77
+ control.states,
78
+ 'clientState',
79
+ 'number',
80
+ 'value',
81
+ { states: clientStates },
82
+ );
83
+ await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'power', 'switch', {
84
+ write: true,
85
+ // TODO: re-add: smartIgnore: false,
86
+ });
87
+ this.addStateChangeListener(`${uuid}.playState`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
88
+ newValue = this.convertStateToInt(newValue);
89
+ if (newValue === 0 || newValue === 1) {
90
+ this.sendCommand(control.uuidAction, 'pause');
91
+ } else if (newValue === 2) {
92
+ this.sendCommand(control.uuidAction, 'play');
93
+ }
94
+ });
95
+ this.addStateChangeListener(`${uuid}.power`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
96
+ this.sendCommand(control.uuidAction, newValue ? 'on' : 'off');
97
+ });
98
+ await this.createSimpleControlStateObjectAsync(
99
+ control.name,
100
+ uuid,
101
+ control.states,
102
+ 'volume',
103
+ 'number',
104
+ 'level.volume',
105
+ {
106
+ write: true,
107
+ },
108
+ );
109
+ this.addStateChangeListener(`${uuid}.volume`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
110
+ this.sendCommand(control.uuidAction, `volume/${newValue}`);
111
+ });
112
+ await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'tts', 'string', 'text', {
113
+ write: true,
114
+ });
115
+ this.addStateChangeListener(`${uuid}.tts`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
116
+ this.sendCommand(control.uuidAction, `tts/${newValue}`);
117
+ });
118
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'prev');
119
+ this.addStateChangeListener(`${uuid}.prev`, () => {
120
+ this.sendCommand(control.uuidAction, 'prev');
121
+ });
122
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'next');
123
+ this.addStateChangeListener(`${uuid}.next`, () => {
124
+ this.sendCommand(control.uuidAction, 'next');
125
+ });
126
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'play');
127
+ this.addStateChangeListener(`${uuid}.pause`, () => {
128
+ this.sendCommand(control.uuidAction, 'pause');
129
+ });
130
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'pause');
131
+ this.addStateChangeListener(`${uuid}.pause`, () => {
132
+ this.sendCommand(control.uuidAction, 'pause');
133
+ });
134
+ }
135
+ }
@@ -0,0 +1,59 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for the CentralAlarm control.
8
+ */
9
+ export class CentralAlarm extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'alarm',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.createButtonCommandStateObjectAsync(
28
+ control.name,
29
+ uuid,
30
+ 'armed',
31
+ /* TODO: re-add: { smartIgnore: false }, */
32
+ );
33
+ this.addStateChangeListener(
34
+ `${uuid}.armed`,
35
+ (oldValue: OldStateValue, newValue: CurrentStateValue) => {
36
+ this.sendCommand(control.uuidAction, newValue ? 'on' : 'off');
37
+ },
38
+ { selfAck: true },
39
+ );
40
+
41
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'delayedOn');
42
+ this.addStateChangeListener(
43
+ `${uuid}.delayedOn`,
44
+ () => {
45
+ this.sendCommand(control.uuidAction, 'delayedon');
46
+ },
47
+ { selfAck: true },
48
+ );
49
+
50
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'quit');
51
+ this.addStateChangeListener(
52
+ `${uuid}.quit`,
53
+ () => {
54
+ this.sendCommand(control.uuidAction, 'quit');
55
+ },
56
+ { selfAck: true },
57
+ );
58
+ }
59
+ }
@@ -0,0 +1,41 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for the CentralAudioZone control.
8
+ */
9
+ export class CentralAudioZone extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'media.music',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.createButtonCommandStateObjectAsync(
28
+ control.name,
29
+ uuid,
30
+ 'control',
31
+ /* TODO: re-add: { smartIgnore: false }, */
32
+ );
33
+ this.addStateChangeListener(
34
+ `${uuid}.control`,
35
+ (oldValue: OldStateValue, newValue: CurrentStateValue) => {
36
+ this.sendCommand(control.uuidAction, newValue ? 'play' : 'pause');
37
+ },
38
+ { selfAck: true },
39
+ );
40
+ }
41
+ }
@@ -0,0 +1,53 @@
1
+ import type { Control } from '../structure-file';
2
+ import type { ControlType } from './control-base';
3
+ import { ControlBase } from './control-base';
4
+
5
+ /**
6
+ * Handler for the CentralGate control.
7
+ */
8
+ export class CentralGate extends ControlBase {
9
+ /**
10
+ * Loads the control and sets up state objects and event handlers.
11
+ *
12
+ * @param type The type of the control ('device' or 'channel').
13
+ * @param uuid The unique identifier of the control.
14
+ * @param control The control data from the structure file.
15
+ */
16
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
17
+ await this.updateObjectAsync(uuid, {
18
+ type: type,
19
+ common: {
20
+ name: control.name,
21
+ role: 'blind',
22
+ },
23
+ native: { control },
24
+ });
25
+
26
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'open');
27
+ this.addStateChangeListener(
28
+ `${uuid}.open`,
29
+ () => {
30
+ this.sendCommand(control.uuidAction, 'open');
31
+ },
32
+ { selfAck: true },
33
+ );
34
+
35
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'close');
36
+ this.addStateChangeListener(
37
+ `${uuid}.close`,
38
+ () => {
39
+ this.sendCommand(control.uuidAction, 'close');
40
+ },
41
+ { selfAck: true },
42
+ );
43
+
44
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'stop');
45
+ this.addStateChangeListener(
46
+ `${uuid}.stop`,
47
+ () => {
48
+ this.sendCommand(control.uuidAction, 'stop');
49
+ },
50
+ { selfAck: true },
51
+ );
52
+ }
53
+ }
@@ -0,0 +1,67 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for the CentralJalousie control.
8
+ */
9
+ export class CentralJalousie extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'blind',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'autoActive');
28
+ this.addStateChangeListener(
29
+ `${uuid}.autoActive`,
30
+ (oldValue: OldStateValue, newValue: CurrentStateValue) => {
31
+ if (newValue) {
32
+ this.sendCommand(control.uuidAction, 'auto');
33
+ } else {
34
+ this.sendCommand(control.uuidAction, 'NoAuto');
35
+ }
36
+ },
37
+ { selfAck: true },
38
+ );
39
+
40
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'fullUp');
41
+ this.addStateChangeListener(
42
+ `${uuid}.fullUp`,
43
+ () => {
44
+ this.sendCommand(control.uuidAction, 'FullUp');
45
+ },
46
+ { selfAck: true },
47
+ );
48
+
49
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'fullDown');
50
+ this.addStateChangeListener(
51
+ `${uuid}.fullDown`,
52
+ () => {
53
+ this.sendCommand(control.uuidAction, 'FullDown');
54
+ },
55
+ { selfAck: true },
56
+ );
57
+
58
+ await this.createButtonCommandStateObjectAsync(control.name, uuid, 'shade');
59
+ this.addStateChangeListener(
60
+ `${uuid}.shade`,
61
+ () => {
62
+ this.sendCommand(control.uuidAction, 'shade');
63
+ },
64
+ { selfAck: true },
65
+ );
66
+ }
67
+ }
@@ -0,0 +1,45 @@
1
+ import type { CurrentStateValue, OldStateValue } from '../main';
2
+ import type { Control } from '../structure-file';
3
+ import type { ControlType } from './control-base';
4
+ import { ControlBase } from './control-base';
5
+
6
+ /**
7
+ * Handler for the CentralLightController control.
8
+ */
9
+ export class CentralLightController extends ControlBase {
10
+ /**
11
+ * Loads the control and sets up state objects and event handlers.
12
+ *
13
+ * @param type The type of the control ('device' or 'channel').
14
+ * @param uuid The unique identifier of the control.
15
+ * @param control The control data from the structure file.
16
+ */
17
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
18
+ await this.updateObjectAsync(uuid, {
19
+ type: type,
20
+ common: {
21
+ name: control.name,
22
+ role: 'light',
23
+ },
24
+ native: { control },
25
+ });
26
+
27
+ await this.createButtonCommandStateObjectAsync(
28
+ control.name,
29
+ uuid,
30
+ 'control',
31
+ /* TODO: re-add: { smartIgnore: false }, */
32
+ );
33
+ this.addStateChangeListener(
34
+ `${uuid}.control`,
35
+ (oldValue: OldStateValue, newValue: CurrentStateValue) => {
36
+ if (newValue) {
37
+ this.sendCommand(control.uuidAction, 'on');
38
+ } else {
39
+ this.sendCommand(control.uuidAction, 'reset');
40
+ }
41
+ },
42
+ { selfAck: true },
43
+ );
44
+ }
45
+ }
@@ -0,0 +1,34 @@
1
+ import type { Control } from '../structure-file';
2
+ import { ColorpickerBase } from './ColorpickerBase';
3
+ import type { ControlType } from './control-base';
4
+
5
+ /**
6
+ * Handler for ColorPickerV2 controls.
7
+ */
8
+ export class ColorPickerV2 extends ColorpickerBase {
9
+ /**
10
+ * Loads the control and sets up state objects and event handlers.
11
+ *
12
+ * @param type The type of the control ('device' or 'channel').
13
+ * @param uuid The unique identifier of the control.
14
+ * @param control The control data from the structure file.
15
+ */
16
+ async loadAsync(type: ControlType, uuid: string, control: Control): Promise<void> {
17
+ await this.updateObjectAsync(uuid, {
18
+ type: type,
19
+ common: {
20
+ name: control.name,
21
+ role: 'light.color.rgb',
22
+ },
23
+ native: { control },
24
+ });
25
+
26
+ await this.loadOtherControlStatesAsync(control.name, uuid, control.states, [
27
+ 'color',
28
+ 'sequence',
29
+ 'sequenceColorIdx',
30
+ ]);
31
+
32
+ await this.loadColorPickerControlBaseAsync(uuid, control);
33
+ }
34
+ }