iobroker.smartcontrol 2.0.1 → 2.2.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 +2 -0
- package/README.md +41 -266
- package/admin/custom/assets/Components-CDPYnOs-.js +77 -0
- package/admin/custom/assets/Components-DpQjIfuo.js +1 -0
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__SmartcontrolSet__mf_owner__1-C9SdP7_s.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Ca-6Y14s.js +1525 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__loadShare__shared-4MdeZwge.js +2 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-QT6he7QZ.js +122 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-BWTOCVCn.js +1 -0
- package/admin/custom/assets/dist-Cnxr-ruU.js +1 -0
- package/admin/custom/assets/helpers-CNHzo155.js +1 -0
- package/admin/custom/assets/hostInit-BVoHSU7s.js +1 -0
- package/admin/custom/assets/iconLibraryData-B5fiyl1C.js +1 -0
- package/admin/custom/assets/index-CwC_q7vn.js +1 -0
- package/admin/custom/assets/lib-CgOpGT17.js +3 -0
- package/admin/custom/assets/mf-entry-bootstrap-0-6167c687.js +54 -0
- package/admin/custom/assets/pendingShares-CEz9fejL.js +2 -0
- package/admin/custom/assets/prod-XWAlCKxB.js +492 -0
- package/admin/custom/assets/rolldown-runtime-9C0vUP4u.js +1 -0
- package/admin/custom/assets/utils-DmVoYT7i.js +4 -0
- package/admin/custom/assets/vite-preload-helper-nldAWQd6.js +1 -0
- package/admin/custom/customComponents.js +12 -0
- package/admin/custom/i18n/de.json +59 -0
- package/admin/custom/i18n/en.json +59 -0
- package/admin/custom/mf-manifest.json +1 -0
- package/admin/doc-md/readme.txt +2 -6
- package/admin/doc-md/start_de.md +34 -89
- package/admin/doc-md/start_en.md +33 -90
- package/admin/doc-md/table-conditions_de.md +7 -9
- package/admin/doc-md/table-conditions_en.md +7 -9
- package/admin/doc-md/table-execution_de.md +11 -10
- package/admin/doc-md/table-execution_en.md +12 -11
- package/admin/doc-md/table-options_de.md +58 -0
- package/admin/doc-md/table-options_en.md +58 -0
- package/admin/doc-md/table-target-devices_de.md +20 -16
- package/admin/doc-md/table-target-devices_en.md +18 -16
- package/admin/doc-md/table-target-enums_de.md +13 -13
- package/admin/doc-md/table-target-enums_en.md +12 -14
- package/admin/doc-md/table-target-url_de.md +14 -25
- package/admin/doc-md/table-target-url_en.md +14 -23
- package/admin/doc-md/table-trigger-devices_de.md +10 -11
- package/admin/doc-md/table-trigger-devices_en.md +10 -10
- package/admin/doc-md/table-trigger-motion_de.md +41 -24
- package/admin/doc-md/table-trigger-motion_en.md +35 -19
- package/admin/doc-md/table-trigger-times_de.md +11 -12
- package/admin/doc-md/table-trigger-times_en.md +11 -11
- package/admin/doc-md/table-zones_de.md +19 -14
- package/admin/doc-md/table-zones_en.md +19 -14
- package/admin/doc-md/table-zones_select-targets_de.md +7 -15
- package/admin/doc-md/table-zones_select-targets_en.md +7 -15
- package/admin/i18n/{de/translations.json → de.json} +2 -1
- package/admin/i18n/{en/translations.json → en.json} +3 -1
- package/admin/i18n/{es/translations.json → es.json} +2 -1
- package/admin/i18n/{fr/translations.json → fr.json} +2 -1
- package/admin/i18n/{it/translations.json → it.json} +2 -1
- package/admin/i18n/{nl/translations.json → nl.json} +2 -1
- package/admin/i18n/{pl/translations.json → pl.json} +2 -1
- package/admin/i18n/{pt/translations.json → pt.json} +2 -1
- package/admin/i18n/{ru/translations.json → ru.json} +2 -1
- package/admin/i18n/uk.json +110 -0
- package/admin/i18n/{zh-cn/translations.json → zh-cn.json} +2 -1
- package/admin/img/option-screenshots/tab-conditions.png +0 -0
- package/admin/img/option-screenshots/tab-further-options.png +0 -0
- package/admin/img/option-screenshots/tab-start.png +0 -0
- package/admin/img/option-screenshots/tab-target-devices.png +0 -0
- package/admin/img/option-screenshots/tab-triggers-motion.png +0 -0
- package/admin/img/option-screenshots/tab-triggers-other.png +0 -0
- package/admin/img/option-screenshots/tab-triggers-time.png +0 -0
- package/admin/img/option-screenshots/tab-zones-execution.png +0 -0
- package/admin/img/option-screenshots/tab-zones.png +0 -0
- package/admin/jsonConfig.json5 +524 -0
- package/io-package.json +46 -31
- package/lib/boolean-value.js +30 -0
- package/lib/constants.js +299 -65
- package/lib/cron-schedule.js +59 -0
- package/lib/helper.js +416 -375
- package/lib/midnight-reschedule.js +31 -0
- package/lib/motion-zone-timer.js +55 -0
- package/lib/num-comparator.js +70 -0
- package/lib/tools.js +12 -6
- package/lib/trigger-class.js +661 -311
- package/lib/trigger-match.js +76 -0
- package/main.js +1040 -652
- package/package.json +30 -38
- package/admin/admin.d.ts +0 -4
- package/admin/doc-md/img/start_dropdown-ani.gif +0 -0
- package/admin/doc-md/img/start_open-dialog.png +0 -0
- package/admin/doc-md/img/start_show-explanation.gif +0 -0
- package/admin/doc-md/img/table-zones_select-target-devices-overwrite.gif +0 -0
- package/admin/fancytree/skin-lion/icons-rtl.gif +0 -0
- package/admin/fancytree/skin-lion/icons.gif +0 -0
- package/admin/fancytree/skin-lion/loading.gif +0 -0
- package/admin/fancytree/skin-lion/ui.fancytree.min.css +0 -6
- package/admin/fancytree/skin-lion/vline-rtl.gif +0 -0
- package/admin/fancytree/skin-lion/vline.gif +0 -0
- package/admin/img/info-big.png +0 -0
- package/admin/img/info-big.png_README.txt +0 -6
- package/admin/img/sc_always.png +0 -0
- package/admin/img/select-target-devices-overwrite.gif +0 -0
- package/admin/img/smartControl_options1.gif +0 -0
- package/admin/img/smartControl_options_dropdown.gif +0 -0
- package/admin/img/smartControl_options_dropdown_2.gif +0 -0
- package/admin/index_m.html +0 -812
- package/admin/index_m.js +0 -1455
- package/admin/style.css +0 -187
- package/admin/tsconfig.json +0 -49
- package/admin/words.js +0 -113
- package/admin/zero-md/readme.txt +0 -1
- package/admin/zero-md/webcomponents-loader.min.js +0 -9
- package/admin/zero-md/zero-md.min.js.js +0 -9
package/lib/constants.js
CHANGED
|
@@ -1,129 +1,363 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @description Define adapter constants, which will be available in adapter class instance
|
|
4
4
|
* @author Mic-M <https://github.com/Mic-M/ioBroker.smartcontrol>
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
module.exports = {
|
|
9
9
|
forbiddenStatePaths: /[\][*,;'"`<>\\?]/g, // Source: https://github.com/ioBroker/ioBroker.js-controller/blob/master/lib/adapter.js - Version 3.1.6
|
|
10
|
-
astroTimes:
|
|
11
|
-
|
|
10
|
+
astroTimes: [
|
|
11
|
+
'nightEnd',
|
|
12
|
+
'nauticalDawn',
|
|
13
|
+
'dawn',
|
|
14
|
+
'sunrise',
|
|
15
|
+
'sunriseEnd',
|
|
16
|
+
'goldenHourEnd',
|
|
17
|
+
'solarNoon',
|
|
18
|
+
'goldenHour',
|
|
19
|
+
'sunsetStart',
|
|
20
|
+
'sunset',
|
|
21
|
+
'dusk',
|
|
22
|
+
'nauticalDusk',
|
|
23
|
+
'night',
|
|
24
|
+
'nadir',
|
|
25
|
+
],
|
|
26
|
+
astroTimesGerman: [
|
|
27
|
+
'Ende der Nacht',
|
|
28
|
+
'Nautische Morgendämmerung',
|
|
29
|
+
'Morgendämmerung',
|
|
30
|
+
'Sonnenaufgang',
|
|
31
|
+
'Ende des Sonnenaufgangs',
|
|
32
|
+
'Ende der goldenen Stunde',
|
|
33
|
+
'Mittag',
|
|
34
|
+
'Goldene Abendstunde',
|
|
35
|
+
'Start des Sonnenuntergangs',
|
|
36
|
+
'Sonnenuntergang',
|
|
37
|
+
'Dämmerung Abends',
|
|
38
|
+
'Nautische Dämmerung Abends',
|
|
39
|
+
'Start der Nacht',
|
|
40
|
+
'Mitternacht',
|
|
41
|
+
],
|
|
12
42
|
configTableValidation: [
|
|
13
43
|
{
|
|
14
44
|
tableName: 'Target Devices',
|
|
15
45
|
tableId: 'tableTargetDevices',
|
|
16
46
|
tableMustHaveActiveRows: false,
|
|
17
47
|
isTargetTable: true,
|
|
18
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
19
|
-
check_2: {id: 'onState', type:'statePath', deactivateIfError:true },
|
|
20
|
-
check_3: {id: 'onValue', type:'stateValue', stateValueStatePath:'onState', deactivateIfError:true },
|
|
21
|
-
check_4: {id: 'offState', type:'statePath', deactivateIfError:true },
|
|
22
|
-
check_5: {id: 'offValue', type:'stateValue', stateValueStatePath:'offState', deactivateIfError:true },
|
|
23
|
-
check_6: {id: 'onAfter', type:'number', numberLowerLimit: 0, deactivateIfError:true, optional:true },
|
|
48
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
49
|
+
check_2: { id: 'onState', type: 'statePath', deactivateIfError: true },
|
|
50
|
+
check_3: { id: 'onValue', type: 'stateValue', stateValueStatePath: 'onState', deactivateIfError: true },
|
|
51
|
+
check_4: { id: 'offState', type: 'statePath', deactivateIfError: true },
|
|
52
|
+
check_5: { id: 'offValue', type: 'stateValue', stateValueStatePath: 'offState', deactivateIfError: true },
|
|
53
|
+
check_6: { id: 'onAfter', type: 'number', numberLowerLimit: 0, deactivateIfError: true, optional: true },
|
|
24
54
|
},
|
|
25
55
|
{
|
|
26
56
|
tableName: 'Targets: Enums',
|
|
27
57
|
tableId: 'tableTargetEnums',
|
|
28
58
|
tableMustHaveActiveRows: false,
|
|
29
59
|
isTargetTable: true,
|
|
30
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
31
|
-
check_2: {id: 'enumId', type:'name', deactivateIfError:true},
|
|
32
|
-
check_3: {id: 'onValue', type:'name', deactivateIfError:true },
|
|
33
|
-
check_5: {id: 'offValue', type:'name', deactivateIfError:true },
|
|
60
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
61
|
+
check_2: { id: 'enumId', type: 'name', deactivateIfError: true },
|
|
62
|
+
check_3: { id: 'onValue', type: 'name', deactivateIfError: true },
|
|
63
|
+
check_5: { id: 'offValue', type: 'name', deactivateIfError: true },
|
|
34
64
|
},
|
|
35
65
|
{
|
|
36
66
|
tableName: 'Targets: URLs',
|
|
37
67
|
tableId: 'tableTargetURLs',
|
|
38
68
|
tableMustHaveActiveRows: false,
|
|
39
69
|
isTargetTable: true,
|
|
40
|
-
check_1: {id: 'name', type:'targetURLname', deactivateIfError:true, removeForbidden:true },
|
|
41
|
-
check_2: {id: 'urlOn', type:'url', deactivateIfError:true},
|
|
42
|
-
check_3: {id: 'urlOff', type:'url', deactivateIfError:true, optional:true},
|
|
70
|
+
check_1: { id: 'name', type: 'targetURLname', deactivateIfError: true, removeForbidden: true },
|
|
71
|
+
check_2: { id: 'urlOn', type: 'url', deactivateIfError: true },
|
|
72
|
+
check_3: { id: 'urlOff', type: 'url', deactivateIfError: true, optional: true },
|
|
43
73
|
},
|
|
44
74
|
{
|
|
45
75
|
tableName: 'Conditions',
|
|
46
76
|
tableId: 'tableConditions',
|
|
47
77
|
tableMustHaveActiveRows: false,
|
|
48
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
49
|
-
check_2: {id: 'conditionState', type:'statePath', deactivateIfError:true },
|
|
50
|
-
check_3: {
|
|
78
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
79
|
+
check_2: { id: 'conditionState', type: 'statePath', deactivateIfError: true },
|
|
80
|
+
check_3: {
|
|
81
|
+
id: 'conditionValue',
|
|
82
|
+
type: 'stateValue',
|
|
83
|
+
stateValueStatePath: 'conditionState',
|
|
84
|
+
deactivateIfError: true,
|
|
85
|
+
},
|
|
51
86
|
},
|
|
52
87
|
{
|
|
53
|
-
tableName: 'Triggers: Motion Sensors',
|
|
88
|
+
tableName: 'Triggers: Motion Sensors', // Name of table, just for logging purposes
|
|
54
89
|
tableId: 'tableTriggerMotion',
|
|
55
90
|
tableMustHaveActiveRows: false,
|
|
56
91
|
isTriggerTable: true,
|
|
57
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
58
|
-
check_2: {id: 'stateId', type:'statePath', deactivateIfError:true },
|
|
59
|
-
check_4: {id: 'duration', type:'number', numberLowerLimit: 0, deactivateIfError:true, optional:true },
|
|
60
|
-
check_5: {id: 'briStateId', type:'statePath', deactivateIfError:true, optional:true },
|
|
61
|
-
check_6: {id: 'briThreshold', type:'number', deactivateIfError:true, optional:true },
|
|
92
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
93
|
+
check_2: { id: 'stateId', type: 'statePath', deactivateIfError: true },
|
|
94
|
+
check_4: { id: 'duration', type: 'number', numberLowerLimit: 0, deactivateIfError: true, optional: true },
|
|
95
|
+
check_5: { id: 'briStateId', type: 'statePath', deactivateIfError: true, optional: true },
|
|
96
|
+
check_6: { id: 'briThreshold', type: 'number', deactivateIfError: true, optional: true },
|
|
62
97
|
},
|
|
63
98
|
{
|
|
64
99
|
tableName: 'Triggers: Other Devices',
|
|
65
100
|
tableId: 'tableTriggerDevices',
|
|
66
101
|
tableMustHaveActiveRows: false,
|
|
67
102
|
isTriggerTable: true,
|
|
68
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
69
|
-
check_2: {id: 'stateId', type:'statePath', deactivateIfError:true },
|
|
70
|
-
check_3: {id: 'stateVal', type:'stateValue', stateValueStatePath:'stateId', deactivateIfError:true },
|
|
103
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
104
|
+
check_2: { id: 'stateId', type: 'statePath', deactivateIfError: true },
|
|
105
|
+
check_3: { id: 'stateVal', type: 'stateValue', stateValueStatePath: 'stateId', deactivateIfError: true },
|
|
71
106
|
},
|
|
72
107
|
{
|
|
73
108
|
tableName: 'Triggers: Times',
|
|
74
109
|
tableId: 'tableTriggerTimes',
|
|
75
110
|
tableMustHaveActiveRows: false,
|
|
76
111
|
isTriggerTable: true,
|
|
77
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
78
|
-
check_2: {id: 'time', type:'timeCron', deactivateIfError:true },
|
|
79
|
-
check_3: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
112
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
113
|
+
check_2: { id: 'time', type: 'timeCron', deactivateIfError: true },
|
|
114
|
+
check_3: {
|
|
115
|
+
id: 'additionalConditions',
|
|
116
|
+
type: 'name',
|
|
117
|
+
deactivateIfError: true,
|
|
118
|
+
removeForbidden: true,
|
|
119
|
+
optional: true,
|
|
120
|
+
},
|
|
121
|
+
check_4: { id: 'never', type: 'name', deactivateIfError: true, removeForbidden: true, optional: true },
|
|
83
122
|
},
|
|
84
123
|
{
|
|
85
124
|
tableName: 'Zones',
|
|
86
125
|
tableId: 'tableZones',
|
|
87
126
|
tableMustHaveActiveRows: true,
|
|
88
|
-
check_1: {id: 'name', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
89
|
-
check_2: {id: 'triggers', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
90
|
-
check_3: {id: 'targets', type:'name', deactivateIfError:true, removeForbidden:true },
|
|
91
|
-
check_4: {id: 'onAfter', type:'number', numberLowerLimit: 0, deactivateIfError:true, optional:true },
|
|
92
|
-
check_5: {id: 'offAfter', type:'number', numberLowerLimit: 0, deactivateIfError:true, optional:true },
|
|
93
|
-
check_6: {id: 'targetsOverwrite', type:'overwrite'}, // special for tableZones
|
|
127
|
+
check_1: { id: 'name', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
128
|
+
check_2: { id: 'triggers', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
129
|
+
check_3: { id: 'targets', type: 'name', deactivateIfError: true, removeForbidden: true },
|
|
130
|
+
check_4: { id: 'onAfter', type: 'number', numberLowerLimit: 0, deactivateIfError: true, optional: true },
|
|
131
|
+
check_5: { id: 'offAfter', type: 'number', numberLowerLimit: 0, deactivateIfError: true, optional: true },
|
|
132
|
+
check_6: { id: 'targetsOverwrite', type: 'overwrite' }, // special for tableZones
|
|
94
133
|
},
|
|
95
134
|
{
|
|
96
135
|
// Special for sub "table" for each Zone
|
|
97
136
|
tableName: 'Zone Execution',
|
|
98
137
|
tableId: 'tableZoneExecution',
|
|
99
138
|
tableMustHaveActiveRows: true,
|
|
100
|
-
check_1: {id: 'start', type:'time', deactivateIfError:true },
|
|
101
|
-
check_2: {id: 'end', type:'time', deactivateIfError:true },
|
|
102
|
-
check_3: {
|
|
103
|
-
|
|
139
|
+
check_1: { id: 'start', type: 'time', deactivateIfError: true },
|
|
140
|
+
check_2: { id: 'end', type: 'time', deactivateIfError: true },
|
|
141
|
+
check_3: {
|
|
142
|
+
id: 'additionalConditions',
|
|
143
|
+
type: 'name',
|
|
144
|
+
deactivateIfError: true,
|
|
145
|
+
removeForbidden: true,
|
|
146
|
+
optional: true,
|
|
147
|
+
},
|
|
148
|
+
check_4: { id: 'never', type: 'name', deactivateIfError: true, removeForbidden: true, optional: true },
|
|
104
149
|
},
|
|
105
150
|
],
|
|
106
151
|
|
|
107
152
|
testStates: [
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
153
|
+
{
|
|
154
|
+
statePath: 'Test.trigger.Bathroom_motion',
|
|
155
|
+
commonObject: {
|
|
156
|
+
name: 'Bathroom Motion',
|
|
157
|
+
type: 'boolean',
|
|
158
|
+
read: true,
|
|
159
|
+
write: true,
|
|
160
|
+
role: 'button',
|
|
161
|
+
def: false,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
statePath: 'Test.trigger.Bathroom_wall-switch',
|
|
166
|
+
commonObject: {
|
|
167
|
+
name: 'Bathroom Wall Switch',
|
|
168
|
+
type: 'boolean',
|
|
169
|
+
read: true,
|
|
170
|
+
write: true,
|
|
171
|
+
role: 'state',
|
|
172
|
+
def: false,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
statePath: 'Test.trigger.Hallway1_motion',
|
|
177
|
+
commonObject: {
|
|
178
|
+
name: 'Hallway Motion',
|
|
179
|
+
type: 'boolean',
|
|
180
|
+
read: true,
|
|
181
|
+
write: true,
|
|
182
|
+
role: 'button',
|
|
183
|
+
def: false,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
statePath: 'Test.trigger.Hallway2_motion',
|
|
188
|
+
commonObject: {
|
|
189
|
+
name: 'HallwayMotion',
|
|
190
|
+
type: 'boolean',
|
|
191
|
+
read: true,
|
|
192
|
+
write: true,
|
|
193
|
+
role: 'button',
|
|
194
|
+
def: false,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
statePath: 'Test.trigger.Hallway1_wall-switch',
|
|
199
|
+
commonObject: {
|
|
200
|
+
name: 'Hallway Wall Switch',
|
|
201
|
+
type: 'boolean',
|
|
202
|
+
read: true,
|
|
203
|
+
write: true,
|
|
204
|
+
role: 'state',
|
|
205
|
+
def: false,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
statePath: 'Test.trigger.Hallway2_wall-switch',
|
|
210
|
+
commonObject: {
|
|
211
|
+
name: 'Hallway Wall Switch',
|
|
212
|
+
type: 'boolean',
|
|
213
|
+
read: true,
|
|
214
|
+
write: true,
|
|
215
|
+
role: 'state',
|
|
216
|
+
def: false,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
statePath: 'Test.trigger.RelaxPersonSitting',
|
|
221
|
+
commonObject: {
|
|
222
|
+
name: 'Relax Area: Someone sitting on sofa',
|
|
223
|
+
type: 'boolean',
|
|
224
|
+
read: true,
|
|
225
|
+
write: true,
|
|
226
|
+
role: 'state',
|
|
227
|
+
def: false,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
statePath: 'Test.brightness.Bathroom_bri',
|
|
232
|
+
commonObject: {
|
|
233
|
+
name: 'Bathroom Brightness',
|
|
234
|
+
type: 'number',
|
|
235
|
+
read: true,
|
|
236
|
+
write: true,
|
|
237
|
+
role: 'state',
|
|
238
|
+
def: 0,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
statePath: 'Test.brightness.Hallway1_bri',
|
|
243
|
+
commonObject: {
|
|
244
|
+
name: 'Hallway Brightness 1',
|
|
245
|
+
type: 'number',
|
|
246
|
+
read: true,
|
|
247
|
+
write: true,
|
|
248
|
+
role: 'state',
|
|
249
|
+
def: 0,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
statePath: 'Test.brightness.Hallway2_bri',
|
|
254
|
+
commonObject: {
|
|
255
|
+
name: 'Hallway Brightness 2',
|
|
256
|
+
type: 'number',
|
|
257
|
+
read: true,
|
|
258
|
+
write: true,
|
|
259
|
+
role: 'state',
|
|
260
|
+
def: 0,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
statePath: 'Test.light.Bathroom',
|
|
265
|
+
commonObject: {
|
|
266
|
+
name: 'Bathroom Light',
|
|
267
|
+
type: 'boolean',
|
|
268
|
+
read: true,
|
|
269
|
+
write: true,
|
|
270
|
+
role: 'state',
|
|
271
|
+
def: false,
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
statePath: 'Test.light.Hallway',
|
|
276
|
+
commonObject: {
|
|
277
|
+
name: 'Hallway Light',
|
|
278
|
+
type: 'boolean',
|
|
279
|
+
read: true,
|
|
280
|
+
write: true,
|
|
281
|
+
role: 'state',
|
|
282
|
+
def: false,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
statePath: 'Test.light.RelaxAreaCeiling',
|
|
287
|
+
commonObject: {
|
|
288
|
+
name: 'Relax Area Light',
|
|
289
|
+
type: 'boolean',
|
|
290
|
+
read: true,
|
|
291
|
+
write: true,
|
|
292
|
+
role: 'state',
|
|
293
|
+
def: false,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
statePath: 'Test.light.RelaxAreaWall',
|
|
298
|
+
commonObject: {
|
|
299
|
+
name: 'Relax Area Light',
|
|
300
|
+
type: 'boolean',
|
|
301
|
+
read: true,
|
|
302
|
+
write: true,
|
|
303
|
+
role: 'state',
|
|
304
|
+
def: false,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
statePath: 'Test.radio.Bathroom',
|
|
309
|
+
commonObject: {
|
|
310
|
+
name: 'Bath Radio Station (String)',
|
|
311
|
+
type: 'string',
|
|
312
|
+
read: true,
|
|
313
|
+
write: true,
|
|
314
|
+
role: 'state',
|
|
315
|
+
def: '',
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
statePath: 'Test.radio.Bathroom_pause',
|
|
320
|
+
commonObject: {
|
|
321
|
+
name: 'Bath Radio Pause',
|
|
322
|
+
type: 'boolean',
|
|
323
|
+
read: true,
|
|
324
|
+
write: true,
|
|
325
|
+
role: 'button',
|
|
326
|
+
def: false,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
statePath: 'Test.condition.isHolidayToday',
|
|
331
|
+
commonObject: {
|
|
332
|
+
name: 'Condition: is Holiday Today?',
|
|
333
|
+
type: 'boolean',
|
|
334
|
+
read: true,
|
|
335
|
+
write: true,
|
|
336
|
+
role: 'state',
|
|
337
|
+
def: false,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
statePath: 'Test.condition.isAnyonePresent',
|
|
342
|
+
commonObject: {
|
|
343
|
+
name: 'Condition: is Anyone Present?',
|
|
344
|
+
type: 'boolean',
|
|
345
|
+
read: true,
|
|
346
|
+
write: true,
|
|
347
|
+
role: 'state',
|
|
348
|
+
def: false,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
statePath: 'Test.condition.isFrontDoorLocked',
|
|
353
|
+
commonObject: {
|
|
354
|
+
name: 'Condition: is Front Door locked?',
|
|
355
|
+
type: 'boolean',
|
|
356
|
+
read: true,
|
|
357
|
+
write: true,
|
|
358
|
+
role: 'state',
|
|
359
|
+
def: false,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
127
362
|
],
|
|
128
|
-
|
|
129
|
-
};
|
|
363
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Prüft, ob ein Cron-Ausdruck gültig ist (5 Felder wie "0 15 * * 1-5" oder 6 mit Sekunden).
|
|
5
|
+
*
|
|
6
|
+
* Warum eigene Datei:
|
|
7
|
+
* Früher wurde `cron-parser` nur als Abhängigkeit von `node-schedule` geladen.
|
|
8
|
+
* Auf ioBroker kann Node dann eine andere Version finden (ab v5 gibt es kein
|
|
9
|
+
* `parseExpression` mehr). Gültige Crons wurden abgelehnt, Speichern ging nicht (#281).
|
|
10
|
+
*
|
|
11
|
+
* @param {unknown} str z. B. '0 15 * * 1-5' oder '5 4 * * sun'
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
*/
|
|
14
|
+
function isCronScheduleValid(str) {
|
|
15
|
+
// Nur echte Strings prüfen – sonst würde .trim() den Adapter crashen.
|
|
16
|
+
if (typeof str !== 'string') {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const expr = str.trim();
|
|
20
|
+
if (!expr) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const cronParser = require('cron-parser');
|
|
26
|
+
parseWithCronParser(cronParser, expr);
|
|
27
|
+
return true;
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* v4 und v5 von cron-parser haben unterschiedliche Einstiege – beide abdecken.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} cronParser
|
|
37
|
+
* @param {string} expr
|
|
38
|
+
*/
|
|
39
|
+
function parseWithCronParser(cronParser, expr) {
|
|
40
|
+
// v4 (von node-schedule genutzt)
|
|
41
|
+
if (typeof cronParser.parseExpression === 'function') {
|
|
42
|
+
cronParser.parseExpression(expr);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// v5: TypeScript-Rewrite
|
|
46
|
+
if (cronParser.CronExpressionParser && typeof cronParser.CronExpressionParser.parse === 'function') {
|
|
47
|
+
cronParser.CronExpressionParser.parse(expr);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (typeof cronParser.parse === 'function') {
|
|
51
|
+
cronParser.parse(expr);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
throw new Error('cron-parser API not found');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
isCronScheduleValid,
|
|
59
|
+
};
|