iobroker.smartcontrol 1.2.0 → 1.2.2
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/.github/ISSUE_TEMPLATE/BugReport.md +36 -36
- package/.github/ISSUE_TEMPLATE/Enhancement.md +19 -19
- package/.github/auto-merge.yml +17 -17
- package/.github/workflows/dependabot-auto-merge.yml +22 -22
- package/.github/workflows/npmpublish.yml +30 -30
- package/.github/workflows/test-and-release.yml +92 -129
- package/.releaseconfig.json +3 -0
- package/LICENSE +21 -21
- package/README.md +374 -402
- package/admin/doc-md/readme.txt +6 -6
- package/admin/doc-md/start_de.md +124 -124
- package/admin/doc-md/start_en.md +126 -126
- package/admin/doc-md/table-conditions_de.md +10 -10
- package/admin/doc-md/table-conditions_en.md +10 -10
- package/admin/doc-md/table-execution_de.md +12 -12
- package/admin/doc-md/table-execution_en.md +12 -12
- package/admin/doc-md/table-target-devices_de.md +18 -18
- package/admin/doc-md/table-target-devices_en.md +21 -21
- package/admin/doc-md/table-target-enums_de.md +13 -13
- package/admin/doc-md/table-target-enums_en.md +15 -15
- package/admin/doc-md/table-target-url_de.md +29 -29
- package/admin/doc-md/table-target-url_en.md +27 -27
- package/admin/doc-md/table-trigger-devices_de.md +12 -12
- package/admin/doc-md/table-trigger-devices_en.md +10 -10
- package/admin/doc-md/table-trigger-motion_de.md +23 -23
- package/admin/doc-md/table-trigger-motion_en.md +24 -24
- package/admin/doc-md/table-trigger-times_de.md +13 -13
- package/admin/doc-md/table-trigger-times_en.md +11 -11
- package/admin/doc-md/table-zones_de.md +14 -14
- package/admin/doc-md/table-zones_en.md +13 -13
- package/admin/doc-md/table-zones_select-targets_de.md +18 -18
- package/admin/doc-md/table-zones_select-targets_en.md +18 -18
- package/admin/index_m.html +1 -1
- package/admin/index_m.js +118 -88
- package/admin/zero-md/webcomponents-loader.min.js +8 -8
- package/admin/zero-md/zero-md.min.js.js +8 -8
- package/io-package.json +461 -433
- package/lib/adapter-config.d.ts +15 -15
- package/lib/constants.js +128 -125
- package/lib/helper.js +1069 -1059
- package/lib/tools.js +93 -93
- package/lib/trigger-class.js +964 -964
- package/main.js +105 -48
- package/main.test.js +30 -30
- package/package.json +73 -70
package/lib/adapter-config.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// This file extends the AdapterConfig type from "@types/iobroker"
|
|
2
|
-
// using the actual properties present in io-package.json
|
|
3
|
-
// in order to provide typings for adapter.config properties
|
|
4
|
-
|
|
5
|
-
import { native } from '../io-package.json';
|
|
6
|
-
|
|
7
|
-
type _AdapterConfig = typeof native;
|
|
8
|
-
|
|
9
|
-
// Augment the globally declared type ioBroker.AdapterConfig
|
|
10
|
-
declare global {
|
|
11
|
-
namespace ioBroker {
|
|
12
|
-
interface AdapterConfig extends _AdapterConfig {
|
|
13
|
-
// Do not enter anything here!
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
// This file extends the AdapterConfig type from "@types/iobroker"
|
|
2
|
+
// using the actual properties present in io-package.json
|
|
3
|
+
// in order to provide typings for adapter.config properties
|
|
4
|
+
|
|
5
|
+
import { native } from '../io-package.json';
|
|
6
|
+
|
|
7
|
+
type _AdapterConfig = typeof native;
|
|
8
|
+
|
|
9
|
+
// Augment the globally declared type ioBroker.AdapterConfig
|
|
10
|
+
declare global {
|
|
11
|
+
namespace ioBroker {
|
|
12
|
+
interface AdapterConfig extends _AdapterConfig {
|
|
13
|
+
// Do not enter anything here!
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
}
|
package/lib/constants.js
CHANGED
|
@@ -1,126 +1,129 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* @desc Define adapter constants, which will be available in adapter class instance
|
|
4
|
-
* @author Mic-M <https://github.com/Mic-M/ioBroker.smartcontrol>
|
|
5
|
-
* @license MIT
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
forbiddenStatePaths: /[\][*,;'"`<>\\?]/g, // Source: https://github.com/ioBroker/ioBroker.js-controller/blob/master/lib/adapter.js - Version 3.1.6
|
|
10
|
-
astroTimes: ['nightEnd', 'nauticalDawn', 'dawn', 'sunrise', 'sunriseEnd', 'goldenHourEnd', 'solarNoon', 'goldenHour', 'sunsetStart', 'sunset', 'dusk', 'nauticalDusk', 'night', 'nadir'],
|
|
11
|
-
astroTimesGerman: ['Ende der Nacht', 'Nautische Morgendämmerung', 'Morgendämmerung', 'Sonnenaufgang', 'Ende des Sonnenaufgangs', 'Ende der goldenen Stunde', 'Mittag', 'Goldene Abendstunde', 'Start des Sonnenuntergangs', 'Sonnenuntergang', 'Dämmerung Abends', 'Nautische Dämmerung Abends', 'Start der Nacht', 'Mitternacht'],
|
|
12
|
-
configTableValidation: [
|
|
13
|
-
{
|
|
14
|
-
tableName: 'Target Devices',
|
|
15
|
-
tableId: 'tableTargetDevices',
|
|
16
|
-
tableMustHaveActiveRows: false,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{statePath:'Test.trigger.
|
|
109
|
-
{statePath:'Test.trigger.
|
|
110
|
-
{statePath:'Test.trigger.
|
|
111
|
-
{statePath:'Test.trigger.
|
|
112
|
-
{statePath:'Test.
|
|
113
|
-
{statePath:'Test.
|
|
114
|
-
{statePath:'Test.
|
|
115
|
-
{statePath:'Test.
|
|
116
|
-
{statePath:'Test.
|
|
117
|
-
{statePath:'Test.
|
|
118
|
-
{statePath:'Test.light.
|
|
119
|
-
{statePath:'Test.
|
|
120
|
-
{statePath:'Test.
|
|
121
|
-
{statePath:'Test.
|
|
122
|
-
{statePath:'Test.
|
|
123
|
-
{statePath:'Test.
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @desc Define adapter constants, which will be available in adapter class instance
|
|
4
|
+
* @author Mic-M <https://github.com/Mic-M/ioBroker.smartcontrol>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
forbiddenStatePaths: /[\][*,;'"`<>\\?]/g, // Source: https://github.com/ioBroker/ioBroker.js-controller/blob/master/lib/adapter.js - Version 3.1.6
|
|
10
|
+
astroTimes: ['nightEnd', 'nauticalDawn', 'dawn', 'sunrise', 'sunriseEnd', 'goldenHourEnd', 'solarNoon', 'goldenHour', 'sunsetStart', 'sunset', 'dusk', 'nauticalDusk', 'night', 'nadir'],
|
|
11
|
+
astroTimesGerman: ['Ende der Nacht', 'Nautische Morgendämmerung', 'Morgendämmerung', 'Sonnenaufgang', 'Ende des Sonnenaufgangs', 'Ende der goldenen Stunde', 'Mittag', 'Goldene Abendstunde', 'Start des Sonnenuntergangs', 'Sonnenuntergang', 'Dämmerung Abends', 'Nautische Dämmerung Abends', 'Start der Nacht', 'Mitternacht'],
|
|
12
|
+
configTableValidation: [
|
|
13
|
+
{
|
|
14
|
+
tableName: 'Target Devices',
|
|
15
|
+
tableId: 'tableTargetDevices',
|
|
16
|
+
tableMustHaveActiveRows: false,
|
|
17
|
+
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 },
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
tableName: 'Targets: Enums',
|
|
27
|
+
tableId: 'tableTargetEnums',
|
|
28
|
+
tableMustHaveActiveRows: false,
|
|
29
|
+
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 },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
tableName: 'Targets: URLs',
|
|
37
|
+
tableId: 'tableTargetURLs',
|
|
38
|
+
tableMustHaveActiveRows: false,
|
|
39
|
+
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},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
tableName: 'Conditions',
|
|
46
|
+
tableId: 'tableConditions',
|
|
47
|
+
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: {id: 'conditionValue', type:'stateValue', stateValueStatePath:'conditionState', deactivateIfError:true },
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tableName: 'Triggers: Motion Sensors', // Name of table, just for logging purposes
|
|
54
|
+
tableId: 'tableTriggerMotion',
|
|
55
|
+
tableMustHaveActiveRows: false,
|
|
56
|
+
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 },
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
tableName: 'Triggers: Other Devices',
|
|
65
|
+
tableId: 'tableTriggerDevices',
|
|
66
|
+
tableMustHaveActiveRows: false,
|
|
67
|
+
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 },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
tableName: 'Triggers: Times',
|
|
74
|
+
tableId: 'tableTriggerTimes',
|
|
75
|
+
tableMustHaveActiveRows: false,
|
|
76
|
+
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: {id: 'additionalConditions', type:'name', deactivateIfError:true, removeForbidden:true, optional:true },
|
|
80
|
+
check_4: {id: 'never', type:'name', deactivateIfError:true, removeForbidden:true, optional:true },
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
tableName: 'Zones',
|
|
86
|
+
tableId: 'tableZones',
|
|
87
|
+
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
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
// Special for sub "table" for each Zone
|
|
97
|
+
tableName: 'Zone Execution',
|
|
98
|
+
tableId: 'tableZoneExecution',
|
|
99
|
+
tableMustHaveActiveRows: true,
|
|
100
|
+
check_1: {id: 'start', type:'time', deactivateIfError:true },
|
|
101
|
+
check_2: {id: 'end', type:'time', deactivateIfError:true },
|
|
102
|
+
check_3: {id: 'additionalConditions', type:'name', deactivateIfError:true, removeForbidden:true, optional:true },
|
|
103
|
+
check_4: {id: 'never', type:'name', deactivateIfError:true, removeForbidden:true, optional:true },
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
|
|
107
|
+
testStates: [
|
|
108
|
+
{statePath:'Test.trigger.Bathroom_motion', commonObject:{name:'Bathroom Motion', type:'boolean', read:true, write:true, role:'button', def:false} },
|
|
109
|
+
{statePath:'Test.trigger.Bathroom_wall-switch', commonObject:{name:'Bathroom Wall Switch', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
110
|
+
{statePath:'Test.trigger.Hallway1_motion', commonObject:{name:'Hallway Motion', type:'boolean', read:true, write:true, role:'button', def:false} },
|
|
111
|
+
{statePath:'Test.trigger.Hallway2_motion', commonObject:{name:'HallwayMotion', type:'boolean', read:true, write:true, role:'button', def:false} },
|
|
112
|
+
{statePath:'Test.trigger.Hallway1_wall-switch', commonObject:{name:'Hallway Wall Switch', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
113
|
+
{statePath:'Test.trigger.Hallway2_wall-switch', commonObject:{name:'Hallway Wall Switch', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
114
|
+
{statePath:'Test.trigger.RelaxPersonSitting', commonObject:{name:'Relax Area: Someone sitting on sofa', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
115
|
+
{statePath:'Test.brightness.Bathroom_bri', commonObject:{name:'Bathroom Brightness', type:'number', read:true, write:true, role:'state', def:0} },
|
|
116
|
+
{statePath:'Test.brightness.Hallway1_bri', commonObject:{name:'Hallway Brightness 1', type:'number', read:true, write:true, role:'state', def:0} },
|
|
117
|
+
{statePath:'Test.brightness.Hallway2_bri', commonObject:{name:'Hallway Brightness 2', type:'number', read:true, write:true, role:'state', def:0} },
|
|
118
|
+
{statePath:'Test.light.Bathroom', commonObject:{name:'Bathroom Light', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
119
|
+
{statePath:'Test.light.Hallway', commonObject:{name:'Hallway Light', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
120
|
+
{statePath:'Test.light.RelaxAreaCeiling', commonObject:{name:'Relax Area Light', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
121
|
+
{statePath:'Test.light.RelaxAreaWall', commonObject:{name:'Relax Area Light', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
122
|
+
{statePath:'Test.radio.Bathroom', commonObject:{name:'Bath Radio Station (String)', type:'string', read:true, write:true, role:'state', def:''} },
|
|
123
|
+
{statePath:'Test.radio.Bathroom_pause', commonObject:{name:'Bath Radio Pause', type:'boolean', read:true, write:true, role:'button', def:false} },
|
|
124
|
+
{statePath:'Test.condition.isHolidayToday', commonObject:{name:'Condition: is Holiday Today?', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
125
|
+
{statePath:'Test.condition.isAnyonePresent', commonObject:{name:'Condition: is Anyone Present?', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
126
|
+
{statePath:'Test.condition.isFrontDoorLocked', commonObject:{name:'Condition: is Front Door locked?', type:'boolean', read:true, write:true, role:'state', def:false} },
|
|
127
|
+
],
|
|
128
|
+
|
|
126
129
|
};
|