iobroker.loxone 3.0.0 → 4.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.
- package/LICENSE +1 -1
- package/README.md +425 -402
- package/admin/i18n/de.json +15 -0
- package/admin/i18n/en.json +15 -0
- package/admin/i18n/es.json +18 -0
- package/admin/i18n/fr.json +18 -0
- package/admin/i18n/it.json +18 -0
- package/admin/i18n/nl.json +18 -0
- package/admin/i18n/pl.json +18 -0
- package/admin/i18n/pt.json +18 -0
- package/admin/i18n/ru.json +18 -0
- package/admin/i18n/uk.json +18 -0
- package/admin/i18n/zh-cn.json +18 -0
- package/admin/jsonConfig.json +96 -0
- package/io-package.json +309 -349
- package/package.json +42 -46
- package/src/controls/AalEmergency.ts +90 -0
- package/src/controls/AalSmartAlarm.ts +99 -0
- package/src/controls/Alarm.ts +146 -0
- package/src/controls/AlarmClock.ts +137 -0
- package/src/controls/Application.ts +13 -0
- package/src/controls/AudioZone.ts +227 -0
- package/src/controls/AudioZoneV2.ts +135 -0
- package/src/controls/CentralAlarm.ts +59 -0
- package/src/controls/CentralAudioZone.ts +41 -0
- package/src/controls/CentralGate.ts +53 -0
- package/src/controls/CentralJalousie.ts +67 -0
- package/src/controls/CentralLightController.ts +45 -0
- package/src/controls/ColorPickerV2.ts +34 -0
- package/src/controls/Colorpicker.ts +30 -0
- package/src/controls/ColorpickerBase.ts +326 -0
- package/src/controls/Daytimer.ts +201 -0
- package/src/controls/Dimmer.ts +64 -0
- package/src/controls/EIBDimmer.ts +61 -0
- package/src/controls/Fronius.ts +217 -0
- package/src/controls/Gate.ts +150 -0
- package/src/controls/Hourcounter.ts +115 -0
- package/src/controls/IRCDaytimer.ts +4 -0
- package/src/controls/IRCV2Daytimer.ts +4 -0
- package/src/controls/IRoomControllerV2.ts +595 -0
- package/src/controls/InfoOnlyAnalog.ts +56 -0
- package/src/controls/InfoOnlyDigital.ts +95 -0
- package/src/controls/InfoOnlyText.ts +52 -0
- package/{build/controls/Intercom.js → src/controls/Intercom.ts} +27 -11
- package/src/controls/Jalousie.ts +219 -0
- package/src/controls/LightController.ts +112 -0
- package/src/controls/LightControllerV2.ts +246 -0
- package/src/controls/MailBox.ts +92 -0
- package/src/controls/Meter.ts +94 -0
- package/src/controls/None.ts +29 -0
- package/src/controls/PresenceDetector.ts +47 -0
- package/src/controls/Pushbutton.ts +55 -0
- package/src/controls/Radio.ts +61 -0
- package/src/controls/Remote.ts +44 -0
- package/src/controls/Slider.ts +78 -0
- package/src/controls/SmokeAlarm.ts +163 -0
- package/src/controls/Switch.ts +46 -0
- package/src/controls/SystemScheme.ts +13 -0
- package/src/controls/TextInput.ts +96 -0
- package/src/controls/TextState.ts +37 -0
- package/src/controls/TimedSwitch.ts +75 -0
- package/src/controls/Tracker.ts +30 -0
- package/{build/controls/Unknown.js → src/controls/Unknown.ts} +19 -13
- package/src/controls/UpDownAnalog.ts +78 -0
- package/{build/controls/ValueSelector.js → src/controls/ValueSelector.ts} +21 -9
- package/src/controls/WindowMonitor.ts +139 -0
- package/src/controls/all-controls.ts +99 -0
- package/src/controls/control-base.ts +28 -0
- package/src/lib/adapter-config.d.ts +22 -0
- package/src/loxone-handler-base.ts +285 -0
- package/src/lxcommunicator.d.ts +1 -0
- package/src/main.test.ts +24 -0
- package/src/main.ts +1178 -0
- package/src/structure-file.d.ts +154 -0
- package/src/weather-server-handler.ts +266 -0
- package/admin/admin.d.ts +0 -58
- package/admin/index_m.html +0 -126
- package/admin/style.css +0 -32
- package/admin/words.js +0 -25
- package/build/controls/AalEmergency.js +0 -45
- package/build/controls/AalEmergency.js.map +0 -1
- package/build/controls/AalSmartAlarm.js +0 -48
- package/build/controls/AalSmartAlarm.js.map +0 -1
- package/build/controls/Alarm.js +0 -81
- package/build/controls/Alarm.js.map +0 -1
- package/build/controls/AlarmClock.js +0 -59
- package/build/controls/AlarmClock.js.map +0 -1
- package/build/controls/Application.js +0 -11
- package/build/controls/Application.js.map +0 -1
- package/build/controls/AudioZone.js +0 -116
- package/build/controls/AudioZone.js.map +0 -1
- package/build/controls/CentralAlarm.js +0 -30
- package/build/controls/CentralAlarm.js.map +0 -1
- package/build/controls/CentralAudioZone.js +0 -22
- package/build/controls/CentralAudioZone.js.map +0 -1
- package/build/controls/CentralGate.js +0 -30
- package/build/controls/CentralGate.js.map +0 -1
- package/build/controls/CentralJalousie.js +0 -39
- package/build/controls/CentralJalousie.js.map +0 -1
- package/build/controls/CentralLightController.js +0 -27
- package/build/controls/CentralLightController.js.map +0 -1
- package/build/controls/ColorPickerV2.js +0 -24
- package/build/controls/ColorPickerV2.js.map +0 -1
- package/build/controls/Colorpicker.js +0 -20
- package/build/controls/Colorpicker.js.map +0 -1
- package/build/controls/ColorpickerBase.js +0 -263
- package/build/controls/ColorpickerBase.js.map +0 -1
- package/build/controls/Daytimer.js +0 -119
- package/build/controls/Daytimer.js.map +0 -1
- package/build/controls/Dimmer.js +0 -34
- package/build/controls/Dimmer.js.map +0 -1
- package/build/controls/EIBDimmer.js +0 -31
- package/build/controls/EIBDimmer.js.map +0 -1
- package/build/controls/Fronius.js +0 -64
- package/build/controls/Fronius.js.map +0 -1
- package/build/controls/Gate.js +0 -109
- package/build/controls/Gate.js.map +0 -1
- package/build/controls/Hourcounter.js +0 -46
- package/build/controls/Hourcounter.js.map +0 -1
- package/build/controls/IRCDaytimer.js +0 -9
- package/build/controls/IRCDaytimer.js.map +0 -1
- package/build/controls/IRoomControllerV2.js +0 -272
- package/build/controls/IRoomControllerV2.js.map +0 -1
- package/build/controls/InfoOnlyAnalog.js +0 -38
- package/build/controls/InfoOnlyAnalog.js.map +0 -1
- package/build/controls/InfoOnlyDigital.js +0 -65
- package/build/controls/InfoOnlyDigital.js.map +0 -1
- package/build/controls/InfoOnlyText.js +0 -35
- package/build/controls/InfoOnlyText.js.map +0 -1
- package/build/controls/Intercom.js.map +0 -1
- package/build/controls/Jalousie.js +0 -156
- package/build/controls/Jalousie.js.map +0 -1
- package/build/controls/LightController.js +0 -68
- package/build/controls/LightController.js.map +0 -1
- package/build/controls/LightControllerV2.js +0 -195
- package/build/controls/LightControllerV2.js.map +0 -1
- package/build/controls/MailBox.js +0 -41
- package/build/controls/MailBox.js.map +0 -1
- package/build/controls/Meter.js +0 -52
- package/build/controls/Meter.js.map +0 -1
- package/build/controls/None.js +0 -23
- package/build/controls/None.js.map +0 -1
- package/build/controls/PresenceDetector.js +0 -29
- package/build/controls/PresenceDetector.js.map +0 -1
- package/build/controls/Pushbutton.js +0 -38
- package/build/controls/Pushbutton.js.map +0 -1
- package/build/controls/Radio.js +0 -42
- package/build/controls/Radio.js.map +0 -1
- package/build/controls/Slider.js +0 -44
- package/build/controls/Slider.js.map +0 -1
- package/build/controls/SmokeAlarm.js +0 -85
- package/build/controls/SmokeAlarm.js.map +0 -1
- package/build/controls/Switch.js +0 -34
- package/build/controls/Switch.js.map +0 -1
- package/build/controls/SystemScheme.js +0 -11
- package/build/controls/SystemScheme.js.map +0 -1
- package/build/controls/TextInput.js +0 -55
- package/build/controls/TextInput.js.map +0 -1
- package/build/controls/TextState.js +0 -20
- package/build/controls/TextState.js.map +0 -1
- package/build/controls/TimedSwitch.js +0 -36
- package/build/controls/TimedSwitch.js.map +0 -1
- package/build/controls/Tracker.js +0 -20
- package/build/controls/Tracker.js.map +0 -1
- package/build/controls/Unknown.js.map +0 -1
- package/build/controls/UpDownAnalog.js +0 -44
- package/build/controls/UpDownAnalog.js.map +0 -1
- package/build/controls/ValueSelector.js.map +0 -1
- package/build/controls/WindowMonitor.js +0 -84
- package/build/controls/WindowMonitor.js.map +0 -1
- package/build/controls/control-base.js +0 -12
- package/build/controls/control-base.js.map +0 -1
- package/build/loxone-handler-base.js +0 -186
- package/build/loxone-handler-base.js.map +0 -1
- package/build/main.js +0 -643
- package/build/main.js.map +0 -1
- package/build/weather-server-handler.js +0 -120
- package/build/weather-server-handler.js.map +0 -1
- package/doc/details-missing-control-type.png +0 -0
- package/doc/log-missing-control-type.png +0 -0
- package/doc/loxone-config-display-diagnostics.png +0 -0
- package/doc/loxone-config-info-only-digital.png +0 -0
- package/doc/loxone-config-use-in-visualization.png +0 -0
package/package.json
CHANGED
|
@@ -1,78 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.loxone",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Communicates with a Loxone Miniserver.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "UncleSamSwiss",
|
|
7
7
|
"email": "samuel.weibel@gmail.com"
|
|
8
8
|
},
|
|
9
|
+
"contributors": [
|
|
10
|
+
{
|
|
11
|
+
"name": "Robin Rainton",
|
|
12
|
+
"email": "robin@rainton.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
9
15
|
"homepage": "https://github.com/UncleSamSwiss/ioBroker.loxone",
|
|
10
16
|
"license": "Apache-2.0",
|
|
11
17
|
"keywords": [
|
|
18
|
+
"ioBroker",
|
|
12
19
|
"loxone",
|
|
13
20
|
"miniserver",
|
|
14
21
|
"smarthome"
|
|
15
22
|
],
|
|
16
23
|
"repository": {
|
|
17
24
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/UncleSamSwiss/ioBroker.loxone"
|
|
25
|
+
"url": "https://github.com/UncleSamSwiss/ioBroker.loxone.git"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">= 20"
|
|
19
29
|
},
|
|
20
30
|
"dependencies": {
|
|
21
|
-
"@iobroker/adapter-core": "^
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"form-data": "^4.0.0",
|
|
31
|
+
"@iobroker/adapter-core": "^3.3.2",
|
|
32
|
+
"axios": "^1.4.0",
|
|
33
|
+
"color-convert": "^3.1.3",
|
|
34
|
+
"form-data": "^4.0.4",
|
|
26
35
|
"lxcommunicator": "^1.1.1",
|
|
27
|
-
"queue-fifo": "
|
|
36
|
+
"queue-fifo": "^0.2.6",
|
|
28
37
|
"sprintf-js": "^1.1.2",
|
|
29
|
-
"uuid": "^
|
|
38
|
+
"uuid": "^13.0.0"
|
|
30
39
|
},
|
|
31
40
|
"devDependencies": {
|
|
32
|
-
"@alcalzone/release-script": "^
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/sprintf-js": "^1.1.2",
|
|
44
|
-
"@types/uuid": "^8.3.3",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
|
46
|
-
"@typescript-eslint/parser": "^5.8.1",
|
|
47
|
-
"chai": "^4.3.4",
|
|
48
|
-
"chai-as-promised": "^7.1.1",
|
|
49
|
-
"eslint": "^8.5.0",
|
|
50
|
-
"eslint-config-prettier": "^8.3.0",
|
|
51
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
52
|
-
"mocha": "^9.1.3",
|
|
53
|
-
"prettier": "^2.5.0",
|
|
54
|
-
"proxyquire": "^2.1.3",
|
|
55
|
-
"rimraf": "^3.0.2",
|
|
56
|
-
"sinon": "^12.0.1",
|
|
57
|
-
"sinon-chai": "^3.7.0",
|
|
41
|
+
"@alcalzone/release-script": "^5.0.0",
|
|
42
|
+
"@alcalzone/release-script-plugin-iobroker": "^4.0.0",
|
|
43
|
+
"@alcalzone/release-script-plugin-license": "^4.0.0",
|
|
44
|
+
"@alcalzone/release-script-plugin-manual-review": "^4.0.0",
|
|
45
|
+
"@iobroker/adapter-dev": "^1.5.0",
|
|
46
|
+
"@iobroker/eslint-config": "^2.2.0",
|
|
47
|
+
"@iobroker/testing": "^5.2.2",
|
|
48
|
+
"@tsconfig/node20": "^20.1.8",
|
|
49
|
+
"@types/iobroker": "npm:@iobroker/types@^7.1.0",
|
|
50
|
+
"@types/node": "^20.19.26",
|
|
51
|
+
"@types/sprintf-js": "^1.1.4",
|
|
58
52
|
"source-map-support": "^0.5.21",
|
|
59
|
-
"ts-node": "^10.
|
|
60
|
-
"typescript": "
|
|
53
|
+
"ts-node": "^10.9.2",
|
|
54
|
+
"typescript": "~5.9.3"
|
|
61
55
|
},
|
|
62
|
-
"main": "
|
|
56
|
+
"main": "src/main.ts",
|
|
57
|
+
"files": [
|
|
58
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).{json,json5}",
|
|
59
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
60
|
+
"src/",
|
|
61
|
+
"www/",
|
|
62
|
+
"io-package.json",
|
|
63
|
+
"LICENSE"
|
|
64
|
+
],
|
|
63
65
|
"scripts": {
|
|
64
|
-
"
|
|
65
|
-
"build:ts": "tsc -p tsconfig.build.json",
|
|
66
|
-
"build": "npm run build:ts",
|
|
67
|
-
"watch:ts": "tsc -p tsconfig.build.json --watch",
|
|
68
|
-
"watch": "npm run watch:ts",
|
|
66
|
+
"check": "tsc --noEmit",
|
|
69
67
|
"test:ts": "mocha --config test/mocharc.custom.json src/**/*.test.ts",
|
|
70
68
|
"test:package": "mocha test/package --exit",
|
|
71
|
-
"test:unit": "mocha test/unit --exit",
|
|
72
69
|
"test:integration": "mocha test/integration --exit",
|
|
73
70
|
"test": "npm run test:ts && npm run test:package",
|
|
74
|
-
"
|
|
75
|
-
"lint": "eslint --ext .ts src/",
|
|
71
|
+
"lint": "eslint -c eslint.config.mjs .",
|
|
76
72
|
"translate": "translate-adapter",
|
|
77
73
|
"release": "release-script"
|
|
78
74
|
},
|
|
@@ -0,0 +1,90 @@
|
|
|
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 AalEmergency controls.
|
|
8
|
+
*/
|
|
9
|
+
export class AalEmergency 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.loadOtherControlStatesAsync(control.name, uuid, control.states, [
|
|
28
|
+
'status',
|
|
29
|
+
'disableEndTime',
|
|
30
|
+
'resetActive',
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const statusStates = {
|
|
34
|
+
0: 'Running',
|
|
35
|
+
1: 'Triggered',
|
|
36
|
+
2: 'Reset',
|
|
37
|
+
3: 'Disabled',
|
|
38
|
+
};
|
|
39
|
+
await this.createSimpleControlStateObjectAsync(
|
|
40
|
+
control.name,
|
|
41
|
+
uuid,
|
|
42
|
+
control.states,
|
|
43
|
+
'status',
|
|
44
|
+
'number',
|
|
45
|
+
'value',
|
|
46
|
+
{ states: statusStates },
|
|
47
|
+
);
|
|
48
|
+
await this.createSimpleControlStateObjectAsync(
|
|
49
|
+
control.name,
|
|
50
|
+
uuid,
|
|
51
|
+
control.states,
|
|
52
|
+
'disableEndTime',
|
|
53
|
+
'number',
|
|
54
|
+
'value.interval',
|
|
55
|
+
);
|
|
56
|
+
await this.createSimpleControlStateObjectAsync(
|
|
57
|
+
control.name,
|
|
58
|
+
uuid,
|
|
59
|
+
control.states,
|
|
60
|
+
'resetActive',
|
|
61
|
+
'string',
|
|
62
|
+
'text',
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'trigger');
|
|
66
|
+
this.addStateChangeListener(
|
|
67
|
+
`${uuid}.trigger`,
|
|
68
|
+
() => {
|
|
69
|
+
this.sendCommand(control.uuidAction, 'trigger');
|
|
70
|
+
},
|
|
71
|
+
{ selfAck: true },
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'quit');
|
|
75
|
+
this.addStateChangeListener(
|
|
76
|
+
`${uuid}.quit`,
|
|
77
|
+
() => {
|
|
78
|
+
this.sendCommand(control.uuidAction, 'quit');
|
|
79
|
+
},
|
|
80
|
+
{ selfAck: true },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
await this.createNumberInputStateObjectAsync(control.name, uuid, 'disable', 'level.timer');
|
|
84
|
+
this.addStateChangeListener(`${uuid}.disable`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
85
|
+
this.sendCommand(control.uuidAction, `disable/${newValue || '0'}`);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
await this.loadSubControlsAsync(uuid, control);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 AAL Smart Alarm controls.
|
|
8
|
+
*/
|
|
9
|
+
export class AalSmartAlarm 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.loadOtherControlStatesAsync(control.name, uuid, control.states, [
|
|
28
|
+
'alarmLevel',
|
|
29
|
+
'alarmCause',
|
|
30
|
+
'isLocked',
|
|
31
|
+
'isLeaveActive',
|
|
32
|
+
'disableEndTime',
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const levelStates = {
|
|
36
|
+
0: 'None',
|
|
37
|
+
1: 'Immediate',
|
|
38
|
+
2: 'Delayed',
|
|
39
|
+
};
|
|
40
|
+
await this.createSimpleControlStateObjectAsync(
|
|
41
|
+
control.name,
|
|
42
|
+
uuid,
|
|
43
|
+
control.states,
|
|
44
|
+
'alarmLevel',
|
|
45
|
+
'number',
|
|
46
|
+
'value',
|
|
47
|
+
{ states: levelStates },
|
|
48
|
+
);
|
|
49
|
+
await this.createSimpleControlStateObjectAsync(
|
|
50
|
+
control.name,
|
|
51
|
+
uuid,
|
|
52
|
+
control.states,
|
|
53
|
+
'alarmCause',
|
|
54
|
+
'string',
|
|
55
|
+
'text',
|
|
56
|
+
);
|
|
57
|
+
await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'isLocked', 'indicator');
|
|
58
|
+
await this.createBooleanControlStateObjectAsync(
|
|
59
|
+
control.name,
|
|
60
|
+
uuid,
|
|
61
|
+
control.states,
|
|
62
|
+
'isLeaveActive',
|
|
63
|
+
'indicator',
|
|
64
|
+
);
|
|
65
|
+
await this.createSimpleControlStateObjectAsync(
|
|
66
|
+
control.name,
|
|
67
|
+
uuid,
|
|
68
|
+
control.states,
|
|
69
|
+
'disableEndTime',
|
|
70
|
+
'number',
|
|
71
|
+
'value.interval',
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'confirm');
|
|
75
|
+
this.addStateChangeListener(
|
|
76
|
+
`${uuid}.confirm`,
|
|
77
|
+
() => {
|
|
78
|
+
this.sendCommand(control.uuidAction, 'confirm');
|
|
79
|
+
},
|
|
80
|
+
{ selfAck: true },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
await this.createNumberInputStateObjectAsync(control.name, uuid, 'disable', 'level.timer');
|
|
84
|
+
this.addStateChangeListener(`${uuid}.disable`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
85
|
+
this.sendCommand(control.uuidAction, `disable/${newValue || '0'}`);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'startDrill');
|
|
89
|
+
this.addStateChangeListener(
|
|
90
|
+
`${uuid}.startDrill`,
|
|
91
|
+
() => {
|
|
92
|
+
this.sendCommand(control.uuidAction, 'startDrill');
|
|
93
|
+
},
|
|
94
|
+
{ selfAck: true },
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
await this.loadSubControlsAsync(uuid, control);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
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 Alarm controls.
|
|
8
|
+
*/
|
|
9
|
+
export class Alarm 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.loadOtherControlStatesAsync(control.name, uuid, control.states, [
|
|
28
|
+
'armed',
|
|
29
|
+
'nextLevel',
|
|
30
|
+
'nextLevelDelay',
|
|
31
|
+
'nextLevelDelayTotal',
|
|
32
|
+
'level',
|
|
33
|
+
'startTime',
|
|
34
|
+
'armedDelay',
|
|
35
|
+
'armedDelayTotal',
|
|
36
|
+
'sensors',
|
|
37
|
+
'disabledMove',
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
const levelStates = {
|
|
41
|
+
0: 'None',
|
|
42
|
+
1: 'Silent',
|
|
43
|
+
2: 'Acustic',
|
|
44
|
+
3: 'Optical',
|
|
45
|
+
4: 'Internal',
|
|
46
|
+
5: 'External',
|
|
47
|
+
6: 'Remote',
|
|
48
|
+
};
|
|
49
|
+
await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'armed', 'switch', {
|
|
50
|
+
write: true,
|
|
51
|
+
// TODO: re-add: smartIgnore: false,
|
|
52
|
+
});
|
|
53
|
+
await this.createSimpleControlStateObjectAsync(
|
|
54
|
+
control.name,
|
|
55
|
+
uuid,
|
|
56
|
+
control.states,
|
|
57
|
+
'nextLevel',
|
|
58
|
+
'number',
|
|
59
|
+
'value',
|
|
60
|
+
{ states: levelStates },
|
|
61
|
+
);
|
|
62
|
+
await this.createSimpleControlStateObjectAsync(
|
|
63
|
+
control.name,
|
|
64
|
+
uuid,
|
|
65
|
+
control.states,
|
|
66
|
+
'nextLevelDelay',
|
|
67
|
+
'number',
|
|
68
|
+
'value.interval',
|
|
69
|
+
);
|
|
70
|
+
await this.createSimpleControlStateObjectAsync(
|
|
71
|
+
control.name,
|
|
72
|
+
uuid,
|
|
73
|
+
control.states,
|
|
74
|
+
'nextLevelDelayTotal',
|
|
75
|
+
'number',
|
|
76
|
+
'value.interval',
|
|
77
|
+
);
|
|
78
|
+
await this.createSimpleControlStateObjectAsync(control.name, uuid, control.states, 'level', 'number', 'value', {
|
|
79
|
+
states: levelStates,
|
|
80
|
+
});
|
|
81
|
+
await this.createSimpleControlStateObjectAsync(
|
|
82
|
+
control.name,
|
|
83
|
+
uuid,
|
|
84
|
+
control.states,
|
|
85
|
+
'startTime',
|
|
86
|
+
'string',
|
|
87
|
+
'value.datetime',
|
|
88
|
+
);
|
|
89
|
+
await this.createSimpleControlStateObjectAsync(
|
|
90
|
+
control.name,
|
|
91
|
+
uuid,
|
|
92
|
+
control.states,
|
|
93
|
+
'armedDelay',
|
|
94
|
+
'number',
|
|
95
|
+
'value.interval',
|
|
96
|
+
);
|
|
97
|
+
await this.createSimpleControlStateObjectAsync(
|
|
98
|
+
control.name,
|
|
99
|
+
uuid,
|
|
100
|
+
control.states,
|
|
101
|
+
'armedDelayTotal',
|
|
102
|
+
'number',
|
|
103
|
+
'value.interval',
|
|
104
|
+
);
|
|
105
|
+
await this.createListControlStateObjectAsync(control.name, uuid, control.states, 'sensors');
|
|
106
|
+
await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'disabledMove', 'switch', {
|
|
107
|
+
write: true,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
this.addStateChangeListener(`${uuid}.armed`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
111
|
+
if (newValue) {
|
|
112
|
+
this.sendCommand(control.uuidAction, 'on');
|
|
113
|
+
} else {
|
|
114
|
+
this.sendCommand(control.uuidAction, 'off');
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
this.addStateChangeListener(`${uuid}.disabledMove`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
119
|
+
if (newValue) {
|
|
120
|
+
this.sendCommand(control.uuidAction, 'dismv/0');
|
|
121
|
+
} else {
|
|
122
|
+
this.sendCommand(control.uuidAction, 'dismv/1');
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'delayedOn');
|
|
127
|
+
this.addStateChangeListener(
|
|
128
|
+
`${uuid}.delayedOn`,
|
|
129
|
+
(oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
130
|
+
this.sendCommand(control.uuidAction, `delayedon/${newValue ? 1 : 0}`);
|
|
131
|
+
},
|
|
132
|
+
{ selfAck: true },
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'quit');
|
|
136
|
+
this.addStateChangeListener(
|
|
137
|
+
`${uuid}.quit`,
|
|
138
|
+
() => {
|
|
139
|
+
this.sendCommand(control.uuidAction, 'quit');
|
|
140
|
+
},
|
|
141
|
+
{ selfAck: true },
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// subControls are not needed because "sensors" already contains the information from the tracker
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
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 Alarm Clock controls.
|
|
8
|
+
*/
|
|
9
|
+
export class AlarmClock 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', // TODO: what's the best role here? ioBroker doc is not very clear on what's an "alarm"
|
|
23
|
+
},
|
|
24
|
+
native: { control },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
await this.loadOtherControlStatesAsync(control.name, uuid, control.states, [
|
|
28
|
+
'isEnabled',
|
|
29
|
+
'isAlarmActive',
|
|
30
|
+
'confirmationNeeded',
|
|
31
|
+
'ringingTime',
|
|
32
|
+
'ringDuration',
|
|
33
|
+
'prepareDuration',
|
|
34
|
+
'snoozeTime',
|
|
35
|
+
'snoozeDuration',
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
await this.createBooleanControlStateObjectAsync(control.name, uuid, control.states, 'isEnabled', 'switch', {
|
|
39
|
+
write: true,
|
|
40
|
+
// TODO: re-add: smartIgnore: false,
|
|
41
|
+
});
|
|
42
|
+
await this.createBooleanControlStateObjectAsync(
|
|
43
|
+
control.name,
|
|
44
|
+
uuid,
|
|
45
|
+
control.states,
|
|
46
|
+
'isAlarmActive',
|
|
47
|
+
'indicator',
|
|
48
|
+
);
|
|
49
|
+
await this.createBooleanControlStateObjectAsync(
|
|
50
|
+
control.name,
|
|
51
|
+
uuid,
|
|
52
|
+
control.states,
|
|
53
|
+
'confirmationNeeded',
|
|
54
|
+
'indicator',
|
|
55
|
+
);
|
|
56
|
+
await this.createSimpleControlStateObjectAsync(
|
|
57
|
+
control.name,
|
|
58
|
+
uuid,
|
|
59
|
+
control.states,
|
|
60
|
+
'ringingTime',
|
|
61
|
+
'number',
|
|
62
|
+
'value.interval',
|
|
63
|
+
);
|
|
64
|
+
await this.createSimpleControlStateObjectAsync(
|
|
65
|
+
control.name,
|
|
66
|
+
uuid,
|
|
67
|
+
control.states,
|
|
68
|
+
'ringDuration',
|
|
69
|
+
'number',
|
|
70
|
+
'value.interval',
|
|
71
|
+
{ write: true },
|
|
72
|
+
);
|
|
73
|
+
await this.createSimpleControlStateObjectAsync(
|
|
74
|
+
control.name,
|
|
75
|
+
uuid,
|
|
76
|
+
control.states,
|
|
77
|
+
'prepareDuration',
|
|
78
|
+
'number',
|
|
79
|
+
'value.interval',
|
|
80
|
+
{ write: true },
|
|
81
|
+
);
|
|
82
|
+
await this.createSimpleControlStateObjectAsync(
|
|
83
|
+
control.name,
|
|
84
|
+
uuid,
|
|
85
|
+
control.states,
|
|
86
|
+
'snoozeTime',
|
|
87
|
+
'number',
|
|
88
|
+
'value.interval',
|
|
89
|
+
);
|
|
90
|
+
await this.createSimpleControlStateObjectAsync(
|
|
91
|
+
control.name,
|
|
92
|
+
uuid,
|
|
93
|
+
control.states,
|
|
94
|
+
'snoozeDuration',
|
|
95
|
+
'number',
|
|
96
|
+
'value.interval',
|
|
97
|
+
{ write: true },
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
this.addStateChangeListener(`${uuid}.isEnabled`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
101
|
+
this.sendCommand(control.uuidAction, `setActive/${newValue ? '0' : '1'}`); // yes, really, this is inverted!
|
|
102
|
+
});
|
|
103
|
+
this.addStateChangeListener(`${uuid}.ringDuration`, (oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
104
|
+
this.sendCommand(control.uuidAction, `setRingDuration/${newValue}`);
|
|
105
|
+
});
|
|
106
|
+
this.addStateChangeListener(
|
|
107
|
+
`${uuid}.prepareDuration`,
|
|
108
|
+
(oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
109
|
+
this.sendCommand(control.uuidAction, `setPrepDuration/${newValue}`);
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
this.addStateChangeListener(
|
|
113
|
+
`${uuid}.snoozeDuration`,
|
|
114
|
+
(oldValue: OldStateValue, newValue: CurrentStateValue) => {
|
|
115
|
+
this.sendCommand(control.uuidAction, `setSnoozeDuration/${newValue}`);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'snooze');
|
|
120
|
+
this.addStateChangeListener(
|
|
121
|
+
`${uuid}.snooze`,
|
|
122
|
+
() => {
|
|
123
|
+
this.sendCommand(control.uuidAction, 'snooze');
|
|
124
|
+
},
|
|
125
|
+
{ selfAck: true },
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
await this.createButtonCommandStateObjectAsync(control.name, uuid, 'dismiss');
|
|
129
|
+
this.addStateChangeListener(
|
|
130
|
+
`${uuid}.dismiss`,
|
|
131
|
+
() => {
|
|
132
|
+
this.sendCommand(control.uuidAction, 'dismiss');
|
|
133
|
+
},
|
|
134
|
+
{ selfAck: true },
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ControlBase } from './control-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handler for Application controls.
|
|
5
|
+
*/
|
|
6
|
+
export class Application extends ControlBase {
|
|
7
|
+
/**
|
|
8
|
+
* Loads the control and sets up state objects and event handlers.
|
|
9
|
+
*/
|
|
10
|
+
async loadAsync(): Promise<void> {
|
|
11
|
+
// Application has no states, thus we don't use it at all
|
|
12
|
+
}
|
|
13
|
+
}
|