iobroker.airzone 1.0.4 → 2.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/Airzone.png +0 -0
- package/LocalApi/AirzoneLocalApi.js +78 -0
- package/LocalApi/Constants.js +14 -0
- package/LocalApi/System.js +150 -0
- package/{Cloud → LocalApi}/Zone.js +28 -51
- package/README.md +3 -0
- package/Utils/asyncRequest.js +31 -0
- package/admin/Airzone.png +0 -0
- package/admin/AirzoneSmall.png +0 -0
- package/admin/index_m.html +15 -19
- package/admin/words.js +34 -46
- package/io-package.json +141 -134
- package/main.js +153 -144
- package/package.json +2 -2
- package/Cloud/AirzoneCloud.js +0 -137
- package/Cloud/Constants.js +0 -81
- package/Cloud/Device.js +0 -139
- package/Cloud/System.js +0 -236
- package/settings/secrets/AUTO_MERGE_TOKEN +0 -1
package/io-package.json
CHANGED
|
@@ -1,135 +1,142 @@
|
|
|
1
|
-
{
|
|
2
|
-
"common":{
|
|
3
|
-
"name":"airzone",
|
|
4
|
-
"version":"
|
|
5
|
-
"news":{
|
|
6
|
-
"1.0.0":{
|
|
7
|
-
"en": "initial release",
|
|
8
|
-
"de": "Erstveröffentlichung",
|
|
9
|
-
"ru": "Первый выпуск",
|
|
10
|
-
"pt": "lançamento inicial",
|
|
11
|
-
"nl": "Eerste uitgave",
|
|
12
|
-
"fr": "Première version",
|
|
13
|
-
"it": "Versione iniziale",
|
|
14
|
-
"es": "Versión inicial",
|
|
15
|
-
"pl": "Pierwsze wydanie",
|
|
16
|
-
"zh-cn": "初始发行"
|
|
17
|
-
},
|
|
18
|
-
"1.0.1":{
|
|
19
|
-
"en": "Various corrections in the project structure",
|
|
20
|
-
"de": "Verschiedene Korrekturen in der Projektstruktur",
|
|
21
|
-
"ru": "Различные исправления в структуре проекта",
|
|
22
|
-
"pt": "Várias correções na estrutura do projeto",
|
|
23
|
-
"nl": "Diverse correcties in de projectstructuur",
|
|
24
|
-
"fr": "Diverses corrections dans la structure du projet",
|
|
25
|
-
"it": "Varie correzioni nella struttura del progetto",
|
|
26
|
-
"es": "Varias correcciones en la estructura del proyecto",
|
|
27
|
-
"pl": "Różne poprawki w strukturze projektu",
|
|
28
|
-
"zh-cn": "项目结构中的各种更正"
|
|
29
|
-
},
|
|
30
|
-
"1.0.2":{
|
|
31
|
-
"en": "Corrections after code review by Apollon77",
|
|
32
|
-
"de": "Korrekturen nach Codeüberprüfung durch Apollon77",
|
|
33
|
-
"ru": "Исправления после проверки кода Apollon77",
|
|
34
|
-
"pt": "Correções após revisão de código por Apollon77",
|
|
35
|
-
"nl": "Correcties na codebeoordeling door Apollon77",
|
|
36
|
-
"fr": "Corrections après révision du code par Apollon77",
|
|
37
|
-
"it": "Correzioni dopo la revisione del codice da parte di Apollon77",
|
|
38
|
-
"es": "Correcciones después de la revisión del código por Apollon77",
|
|
39
|
-
"pl": "Poprawki po przeglądzie kodu przez Apollon77",
|
|
40
|
-
"zh-cn": "经过Apollon77代码审查后的更正"
|
|
41
|
-
},
|
|
42
|
-
"1.0.3":{
|
|
43
|
-
"en": "Fix of SyntaxError: Unexpected end of JSON input when calling askSystemInfo",
|
|
44
|
-
"de": "Korrektur von SyntaxError: Unerwartetes Ende der JSON-Eingabe beim Aufruf von askSystemInfo",
|
|
45
|
-
"ru": "Исправление SyntaxError: неожиданный конец ввода JSON при вызове askSystemInfo",
|
|
46
|
-
"pt": "Correção de SyntaxError: fim inesperado da entrada JSON ao chamar askSystemInfo",
|
|
47
|
-
"nl": "Fix van SyntaxError: onverwacht einde van JSON-invoer bij het aanroepen van askSystemInfo",
|
|
48
|
-
"fr": "Correction de SyntaxError: fin inattendue de l'entrée JSON lors de l'appel de askSystemInfo",
|
|
49
|
-
"it": "Correzione di SyntaxError: fine imprevista dell'input JSON durante la chiamata a askSystemInfo",
|
|
50
|
-
"es": "Corrección de SyntaxError: final inesperado de la entrada JSON al llamar a askSystemInfo",
|
|
51
|
-
"pl": "Poprawka błędu SyntaxError: nieoczekiwany koniec danych wejściowych JSON podczas wywoływania askSystemInfo",
|
|
52
|
-
"zh-cn": "解决SyntaxError:调用askSystemInfo时JSON输入意外结束"
|
|
53
|
-
},
|
|
54
|
-
"1.0.4":{
|
|
55
|
-
"en": "Small fixes",
|
|
56
|
-
"de": "Kleine Korrekturen",
|
|
57
|
-
"ru": "Небольшие исправления",
|
|
58
|
-
"pt": "Pequenas correções",
|
|
59
|
-
"nl": "Kleine reparaties",
|
|
60
|
-
"fr": "Petits correctifs",
|
|
61
|
-
"it": "Piccole correzioni",
|
|
62
|
-
"es": "Pequeñas correcciones",
|
|
63
|
-
"pl": "Małe poprawki",
|
|
64
|
-
"zh-cn": "小修正"
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
"en": "
|
|
82
|
-
"de": "
|
|
83
|
-
"ru": "
|
|
84
|
-
"pt": "
|
|
85
|
-
"nl": "
|
|
86
|
-
"fr": "
|
|
87
|
-
"it": "
|
|
88
|
-
"es": "
|
|
89
|
-
"pl": "
|
|
90
|
-
"zh-cn": "
|
|
91
|
-
},
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
|
|
1
|
+
{
|
|
2
|
+
"common":{
|
|
3
|
+
"name":"airzone",
|
|
4
|
+
"version":"2.0.0",
|
|
5
|
+
"news":{
|
|
6
|
+
"1.0.0":{
|
|
7
|
+
"en": "initial release",
|
|
8
|
+
"de": "Erstveröffentlichung",
|
|
9
|
+
"ru": "Первый выпуск",
|
|
10
|
+
"pt": "lançamento inicial",
|
|
11
|
+
"nl": "Eerste uitgave",
|
|
12
|
+
"fr": "Première version",
|
|
13
|
+
"it": "Versione iniziale",
|
|
14
|
+
"es": "Versión inicial",
|
|
15
|
+
"pl": "Pierwsze wydanie",
|
|
16
|
+
"zh-cn": "初始发行"
|
|
17
|
+
},
|
|
18
|
+
"1.0.1":{
|
|
19
|
+
"en": "Various corrections in the project structure",
|
|
20
|
+
"de": "Verschiedene Korrekturen in der Projektstruktur",
|
|
21
|
+
"ru": "Различные исправления в структуре проекта",
|
|
22
|
+
"pt": "Várias correções na estrutura do projeto",
|
|
23
|
+
"nl": "Diverse correcties in de projectstructuur",
|
|
24
|
+
"fr": "Diverses corrections dans la structure du projet",
|
|
25
|
+
"it": "Varie correzioni nella struttura del progetto",
|
|
26
|
+
"es": "Varias correcciones en la estructura del proyecto",
|
|
27
|
+
"pl": "Różne poprawki w strukturze projektu",
|
|
28
|
+
"zh-cn": "项目结构中的各种更正"
|
|
29
|
+
},
|
|
30
|
+
"1.0.2":{
|
|
31
|
+
"en": "Corrections after code review by Apollon77",
|
|
32
|
+
"de": "Korrekturen nach Codeüberprüfung durch Apollon77",
|
|
33
|
+
"ru": "Исправления после проверки кода Apollon77",
|
|
34
|
+
"pt": "Correções após revisão de código por Apollon77",
|
|
35
|
+
"nl": "Correcties na codebeoordeling door Apollon77",
|
|
36
|
+
"fr": "Corrections après révision du code par Apollon77",
|
|
37
|
+
"it": "Correzioni dopo la revisione del codice da parte di Apollon77",
|
|
38
|
+
"es": "Correcciones después de la revisión del código por Apollon77",
|
|
39
|
+
"pl": "Poprawki po przeglądzie kodu przez Apollon77",
|
|
40
|
+
"zh-cn": "经过Apollon77代码审查后的更正"
|
|
41
|
+
},
|
|
42
|
+
"1.0.3":{
|
|
43
|
+
"en": "Fix of SyntaxError: Unexpected end of JSON input when calling askSystemInfo",
|
|
44
|
+
"de": "Korrektur von SyntaxError: Unerwartetes Ende der JSON-Eingabe beim Aufruf von askSystemInfo",
|
|
45
|
+
"ru": "Исправление SyntaxError: неожиданный конец ввода JSON при вызове askSystemInfo",
|
|
46
|
+
"pt": "Correção de SyntaxError: fim inesperado da entrada JSON ao chamar askSystemInfo",
|
|
47
|
+
"nl": "Fix van SyntaxError: onverwacht einde van JSON-invoer bij het aanroepen van askSystemInfo",
|
|
48
|
+
"fr": "Correction de SyntaxError: fin inattendue de l'entrée JSON lors de l'appel de askSystemInfo",
|
|
49
|
+
"it": "Correzione di SyntaxError: fine imprevista dell'input JSON durante la chiamata a askSystemInfo",
|
|
50
|
+
"es": "Corrección de SyntaxError: final inesperado de la entrada JSON al llamar a askSystemInfo",
|
|
51
|
+
"pl": "Poprawka błędu SyntaxError: nieoczekiwany koniec danych wejściowych JSON podczas wywoływania askSystemInfo",
|
|
52
|
+
"zh-cn": "解决SyntaxError:调用askSystemInfo时JSON输入意外结束"
|
|
53
|
+
},
|
|
54
|
+
"1.0.4":{
|
|
55
|
+
"en": "Small fixes",
|
|
56
|
+
"de": "Kleine Korrekturen",
|
|
57
|
+
"ru": "Небольшие исправления",
|
|
58
|
+
"pt": "Pequenas correções",
|
|
59
|
+
"nl": "Kleine reparaties",
|
|
60
|
+
"fr": "Petits correctifs",
|
|
61
|
+
"it": "Piccole correzioni",
|
|
62
|
+
"es": "Pequeñas correcciones",
|
|
63
|
+
"pl": "Małe poprawki",
|
|
64
|
+
"zh-cn": "小修正"
|
|
65
|
+
},
|
|
66
|
+
"2.0.0":{
|
|
67
|
+
"en": "Using the local API",
|
|
68
|
+
"de": "Verwendung der local API",
|
|
69
|
+
"ru": "Использование локального API",
|
|
70
|
+
"pt": "Utilização do API local",
|
|
71
|
+
"nl": "Gebruik van de lokale API",
|
|
72
|
+
"fr": "Utilisation de l'API locale",
|
|
73
|
+
"it": "Uso dell'API locale",
|
|
74
|
+
"es": "Uso de la API local",
|
|
75
|
+
"pl": "Korzystanie z lokalnego API",
|
|
76
|
+
"zh-cn": "使用本地API"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"title":"Airzone Local API",
|
|
80
|
+
"titleLang":{
|
|
81
|
+
"en": "Airzone local API",
|
|
82
|
+
"de": "Airzone lokale API",
|
|
83
|
+
"ru": "Airzone local API",
|
|
84
|
+
"pt": "Airzone local API",
|
|
85
|
+
"nl": "Airzone lokale API",
|
|
86
|
+
"fr": "Airzone local API",
|
|
87
|
+
"it": "API locale di Airzone",
|
|
88
|
+
"es": "API local de Airzone",
|
|
89
|
+
"pl": "Lokalne API strefy lotniczej",
|
|
90
|
+
"zh-cn": "Airzone本地API"
|
|
91
|
+
},
|
|
92
|
+
"desc":{
|
|
93
|
+
"en": "Allows the integration of an Airzone system.",
|
|
94
|
+
"de": "Ermöglicht die Integration eines Airzone Systems.",
|
|
95
|
+
"ru": "Позволяет интегрировать систему Airzone.",
|
|
96
|
+
"pt": "Permite a integração de um sistema de Zona Aérea.",
|
|
97
|
+
"nl": "Maakt de integratie van een Airzone-systeem mogelijk.",
|
|
98
|
+
"fr": "Permet d'intégrer un système Airzone.",
|
|
99
|
+
"it": "Permette l'integrazione di un sistema Airzone.",
|
|
100
|
+
"es": "Permite la integración de un sistema Airzone.",
|
|
101
|
+
"pl": "Umożliwia integrację systemu Airzone.",
|
|
102
|
+
"zh-cn": "实现了Airzone系统的整合。"
|
|
103
|
+
},
|
|
104
|
+
"authors":[
|
|
105
|
+
"Christian Schemmer <christian.silentphoenix11@gmail.com>"
|
|
106
|
+
],
|
|
107
|
+
"keywords":[
|
|
108
|
+
"ioBroker",
|
|
109
|
+
"airzone",
|
|
110
|
+
"Smart Home",
|
|
111
|
+
"home automation"
|
|
112
|
+
],
|
|
113
|
+
"license":"MIT",
|
|
114
|
+
"platform":"Javascript/Node.js",
|
|
115
|
+
"main":"main.js",
|
|
116
|
+
"icon":"AirzoneSmall.png",
|
|
117
|
+
"extIcon":"https://raw.githubusercontent.com/SilentPhoenix11/ioBroker.airzone/master/admin/AirzoneSmall.png",
|
|
118
|
+
"enabled":true,
|
|
119
|
+
"readme":"https://github.com/SilentPhoenix11/ioBroker.airzone/blob/master/README.md",
|
|
120
|
+
"loglevel":"info",
|
|
121
|
+
"mode":"daemon",
|
|
122
|
+
"type":"climate-control",
|
|
123
|
+
"compact":true,
|
|
124
|
+
"connectionType":"local",
|
|
125
|
+
"dataSource":"poll",
|
|
126
|
+
"materialize":true,
|
|
127
|
+
"dependencies":[
|
|
128
|
+
{
|
|
129
|
+
"js-controller":">=2.0.0"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"native":{
|
|
134
|
+
"local_ip":"192.168.XXX.XXX",
|
|
135
|
+
"system_id":1,
|
|
136
|
+
"sync_time":5
|
|
137
|
+
},
|
|
138
|
+
"encryptedNative": [],
|
|
139
|
+
"protectedNative": [],
|
|
140
|
+
"objects":[],
|
|
141
|
+
"instanceObjects":[]
|
|
135
142
|
}
|
package/main.js
CHANGED
|
@@ -1,145 +1,154 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const adaptername = "airzone"
|
|
4
|
-
|
|
5
|
-
const utils = require('@iobroker/adapter-core');
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Template extends utils.Adapter {
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param {Partial<utils.AdapterOptions>} [options={}]
|
|
13
|
-
*/
|
|
14
|
-
constructor(options) {
|
|
15
|
-
super({
|
|
16
|
-
...options,
|
|
17
|
-
name: adaptername,
|
|
18
|
-
});
|
|
19
|
-
this.on('ready', this.onReady.bind(this));
|
|
20
|
-
this.on('stateChange', this.onStateChange.bind(this));
|
|
21
|
-
// this.on('objectChange', this.onObjectChange.bind(this));
|
|
22
|
-
// this.on('message', this.onMessage.bind(this));
|
|
23
|
-
this.on('unload', this.onUnload.bind(this));
|
|
24
|
-
this.stateChangeCallbacks = {};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Is called when databases are connected and adapter received configuration.
|
|
29
|
-
*/
|
|
30
|
-
async onReady() {
|
|
31
|
-
// Initialize your adapter here
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.
|
|
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
|
-
* Is called
|
|
72
|
-
* @param {
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const adaptername = "airzone"
|
|
4
|
+
|
|
5
|
+
const utils = require('@iobroker/adapter-core');
|
|
6
|
+
const AirzoneLocalApi = require("./LocalApi/AirzoneLocalApi");
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Template extends utils.Adapter {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {Partial<utils.AdapterOptions>} [options={}]
|
|
13
|
+
*/
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super({
|
|
16
|
+
...options,
|
|
17
|
+
name: adaptername,
|
|
18
|
+
});
|
|
19
|
+
this.on('ready', this.onReady.bind(this));
|
|
20
|
+
this.on('stateChange', this.onStateChange.bind(this));
|
|
21
|
+
// this.on('objectChange', this.onObjectChange.bind(this));
|
|
22
|
+
// this.on('message', this.onMessage.bind(this));
|
|
23
|
+
this.on('unload', this.onUnload.bind(this));
|
|
24
|
+
this.stateChangeCallbacks = {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Is called when databases are connected and adapter received configuration.
|
|
29
|
+
*/
|
|
30
|
+
async onReady() {
|
|
31
|
+
// Initialize your adapter here
|
|
32
|
+
try
|
|
33
|
+
{
|
|
34
|
+
this.log.info('Init Airzone local api...');
|
|
35
|
+
this.session = new AirzoneLocalApi(this, this.config.local_ip);
|
|
36
|
+
await this.session.init(parseInt(this.config.system_id));
|
|
37
|
+
this.log.info('Init Airzone local api succeeded.');
|
|
38
|
+
}
|
|
39
|
+
catch (e)
|
|
40
|
+
{
|
|
41
|
+
this.log.error('Init Airzone local api failed: '+e+'\r\n'+e.stack);
|
|
42
|
+
}
|
|
43
|
+
this.initialized = true;
|
|
44
|
+
|
|
45
|
+
if(this.config.sync_time > 0) {
|
|
46
|
+
this.update();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
update() {
|
|
51
|
+
var syncTime = Math.max(this.config.sync_time, 1);
|
|
52
|
+
|
|
53
|
+
setTimeout(
|
|
54
|
+
(function(self) { //Self-executing func which takes 'this' as self
|
|
55
|
+
return async function() { //Return a function in the context of 'self'
|
|
56
|
+
if(!self.initialized)
|
|
57
|
+
return;
|
|
58
|
+
try {
|
|
59
|
+
await self.session.update();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
self.log.error('error during update '+e+'\r\n'+e.stack);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if(self.initialized)
|
|
65
|
+
self.update();
|
|
66
|
+
}
|
|
67
|
+
})(this), syncTime * 1000);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Is called when adapter shuts down - callback has to be called under any circumstances!
|
|
72
|
+
* @param {() => void} callback
|
|
73
|
+
*/
|
|
74
|
+
onUnload(callback) {
|
|
75
|
+
this.initialized = false;
|
|
76
|
+
callback();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Is called if a subscribed state changes
|
|
81
|
+
* @param {string} id
|
|
82
|
+
* @param {ioBroker.State | null | undefined} state
|
|
83
|
+
*/
|
|
84
|
+
async onStateChange(id, state) {
|
|
85
|
+
|
|
86
|
+
if (state.from.search (adaptername) != -1) {return;} // do not process self generated state changes
|
|
87
|
+
|
|
88
|
+
if (state) {
|
|
89
|
+
var callback = this.stateChangeCallbacks[id];
|
|
90
|
+
if(callback != undefined) {
|
|
91
|
+
var method = callback['method'];
|
|
92
|
+
var target = callback['target'];
|
|
93
|
+
await method(target, id, state);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async createProperty(_path, _name, _type, _read, _write, _role){
|
|
99
|
+
await this.setObjectNotExistsAsync(_path+"."+_name, {
|
|
100
|
+
type: 'state',
|
|
101
|
+
common: {
|
|
102
|
+
name: _name,
|
|
103
|
+
type: _type,
|
|
104
|
+
read: _read,
|
|
105
|
+
write: _write,
|
|
106
|
+
role: _role,
|
|
107
|
+
},
|
|
108
|
+
native: {},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async createUnitProperty(_path, _name, _type, _min, _max, _unit, _read, _write, _role){
|
|
113
|
+
await this.setObjectNotExistsAsync(_path+"."+_name, {
|
|
114
|
+
type: 'state',
|
|
115
|
+
common: {
|
|
116
|
+
name: _name,
|
|
117
|
+
type: _type,
|
|
118
|
+
read: _read,
|
|
119
|
+
write: _write,
|
|
120
|
+
role: _role,
|
|
121
|
+
min : _min,
|
|
122
|
+
max : _max,
|
|
123
|
+
unit : _unit
|
|
124
|
+
},
|
|
125
|
+
native: {},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async updatePropertyValue(_path, _name, _value) {
|
|
130
|
+
await this.setStateAsync(_path+"."+_name, { val: _value, ack: true } );
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async createPropertyAndInit(_path, _name, _type, _read, _write, _value, _role){
|
|
134
|
+
await this.createProperty(_path, _name, _type, _read, _write, _role);
|
|
135
|
+
await this.updatePropertyValue(_path, _name, _value);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
subscribeState(path, obj, callback) {
|
|
139
|
+
this.subscribeStates(path);
|
|
140
|
+
var id = this.namespace+'.'+path;
|
|
141
|
+
this.stateChangeCallbacks[id] = {target: obj, method : callback};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (require.main !== module) {
|
|
146
|
+
// Export the constructor in compact mode
|
|
147
|
+
/**
|
|
148
|
+
* @param {Partial<utils.AdapterOptions>} [options={}]
|
|
149
|
+
*/
|
|
150
|
+
module.exports = (options) => new Template(options);
|
|
151
|
+
} else {
|
|
152
|
+
// otherwise start the instance directly
|
|
153
|
+
new Template();
|
|
145
154
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name":"iobroker.airzone",
|
|
3
|
-
"version":"
|
|
4
|
-
"description":"Airzone
|
|
3
|
+
"version":"2.0.0",
|
|
4
|
+
"description":"Airzone local api integration for ioBroker",
|
|
5
5
|
"author":{
|
|
6
6
|
"name":"Christian Schemmer",
|
|
7
7
|
"email":"christian.silentphoenix11@gmail.com"
|