iobroker.airzone 1.0.2 → 2.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.
package/io-package.json CHANGED
@@ -1,111 +1,154 @@
1
- {
2
- "common":{
3
- "name":"airzone",
4
- "version":"1.0.2",
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
- },
43
- "title":"Airzone Cloud",
44
- "titleLang":{
45
- "en": "Airzone Cloud",
46
- "de": "Airzone Cloud",
47
- "ru": "Облако Airzone",
48
- "pt": "Airzone Cloud",
49
- "nl": "Airzone Cloud",
50
- "fr": "Nuage d'Airzone",
51
- "it": "Airzone Cloud",
52
- "es": "Nube de Airzone",
53
- "pl": "Chmura Airzone",
54
- "zh-cn": "空域云"
55
- },
56
- "desc":{
57
- "en": "Adapter for connecting the Airzone Cloud.",
58
- "de": "Adapter zum Anschließen der Airzone Cloud.",
59
- "ru": "Адаптер для подключения Airzone Cloud.",
60
- "pt": "Adaptador para conectar o Airzone Cloud.",
61
- "nl": "Adapter voor het aansluiten van de Airzone Cloud.",
62
- "fr": "Adaptateur pour connecter le Cloud Airzone.",
63
- "it": "Adattatore per il collegamento dell'Airzone Cloud.",
64
- "es": "Adaptador para conectar Airzone Cloud.",
65
- "pl": "Adapter do podłączenia chmury Airzone.",
66
- "zh-cn": "用于连接Airzone Cloud的适配器。"
67
- },
68
- "authors":[
69
- "Christian Schemmer <christian.silentphoenix11@gmail.com>"
70
- ],
71
- "keywords":[
72
- "ioBroker",
73
- "airzone",
74
- "Smart Home",
75
- "home automation"
76
- ],
77
- "license":"MIT",
78
- "platform":"Javascript/Node.js",
79
- "main":"main.js",
80
- "icon":"AirzoneSmall.png",
81
- "extIcon":"https://raw.githubusercontent.com/SilentPhoenix11/ioBroker.airzone/master/admin/AirzoneSmall.png",
82
- "enabled":true,
83
- "readme":"https://github.com/SilentPhoenix11/ioBroker.airzone/blob/master/README.md",
84
- "loglevel":"info",
85
- "mode":"daemon",
86
- "type":"climate-control",
87
- "compact":true,
88
- "connectionType":"cloud",
89
- "dataSource":"poll",
90
- "materialize":true,
91
- "dependencies":[
92
- {
93
- "js-controller":">=2.0.0"
94
- }
95
- ]
96
- },
97
- "native":{
98
- "username":"",
99
- "password":"",
100
- "base_url":"https://airzonecloud.com",
101
- "sync_time":30
102
- },
103
- "encryptedNative": [
104
- "password"
105
- ],
106
- "protectedNative": [
107
- "password"
108
- ],
109
- "objects":[],
110
- "instanceObjects":[]
1
+ {
2
+ "common":{
3
+ "name":"airzone",
4
+ "version":"2.0.1",
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
+ "2.0.1":{
79
+ "en": "Small fixes",
80
+ "de": "Kleine Korrekturen",
81
+ "ru": "Небольшие исправления",
82
+ "pt": "Pequenas correções",
83
+ "nl": "Kleine reparaties",
84
+ "fr": "Petits correctifs",
85
+ "it": "Piccole correzioni",
86
+ "es": "Pequeñas correcciones",
87
+ "pl": "Małe poprawki",
88
+ "zh-cn": "小修正"
89
+ }
90
+ },
91
+ "title":"Airzone Local API",
92
+ "titleLang":{
93
+ "en": "Airzone local API",
94
+ "de": "Airzone lokale API",
95
+ "ru": "Airzone local API",
96
+ "pt": "Airzone local API",
97
+ "nl": "Airzone lokale API",
98
+ "fr": "Airzone local API",
99
+ "it": "API locale di Airzone",
100
+ "es": "API local de Airzone",
101
+ "pl": "Lokalne API strefy lotniczej",
102
+ "zh-cn": "Airzone本地API"
103
+ },
104
+ "desc":{
105
+ "en": "Allows the integration of an Airzone system.",
106
+ "de": "Ermöglicht die Integration eines Airzone Systems.",
107
+ "ru": "Позволяет интегрировать систему Airzone.",
108
+ "pt": "Permite a integração de um sistema de Zona Aérea.",
109
+ "nl": "Maakt de integratie van een Airzone-systeem mogelijk.",
110
+ "fr": "Permet d'intégrer un système Airzone.",
111
+ "it": "Permette l'integrazione di un sistema Airzone.",
112
+ "es": "Permite la integración de un sistema Airzone.",
113
+ "pl": "Umożliwia integrację systemu Airzone.",
114
+ "zh-cn": "实现了Airzone系统的整合。"
115
+ },
116
+ "authors":[
117
+ "Christian Schemmer <christian.silentphoenix11@gmail.com>"
118
+ ],
119
+ "keywords":[
120
+ "ioBroker",
121
+ "airzone",
122
+ "Smart Home",
123
+ "home automation"
124
+ ],
125
+ "license":"MIT",
126
+ "platform":"Javascript/Node.js",
127
+ "main":"main.js",
128
+ "icon":"AirzoneSmall.png",
129
+ "extIcon":"https://raw.githubusercontent.com/SilentPhoenix11/ioBroker.airzone/master/admin/AirzoneSmall.png",
130
+ "enabled":true,
131
+ "readme":"https://github.com/SilentPhoenix11/ioBroker.airzone/blob/master/README.md",
132
+ "loglevel":"info",
133
+ "mode":"daemon",
134
+ "type":"climate-control",
135
+ "compact":true,
136
+ "connectionType":"local",
137
+ "dataSource":"poll",
138
+ "materialize":true,
139
+ "dependencies":[
140
+ {
141
+ "js-controller":">=2.0.0"
142
+ }
143
+ ]
144
+ },
145
+ "native":{
146
+ "local_ip":"",
147
+ "system_id":1,
148
+ "sync_time":5
149
+ },
150
+ "encryptedNative": [],
151
+ "protectedNative": [],
152
+ "objects":[],
153
+ "instanceObjects":[]
111
154
  }
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 AirzoneCloud = require("./Cloud/AirzoneCloud");
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
- this.session = new AirzoneCloud(this, this.config.username, this.config.password, this.config.base_url);
33
- await this.session.init();
34
- this.initialized = true;
35
-
36
- if(this.config.sync_time > 0) {
37
- this.update();
38
- }
39
- }
40
-
41
- update() {
42
- var syncTime = Math.max(this.config.sync_time, 15);
43
-
44
- setTimeout(
45
- (function(self) { //Self-executing func which takes 'this' as self
46
- return async function() { //Return a function in the context of 'self'
47
- if(!self.initialized)
48
- return;
49
- try {
50
- await self.session.update();
51
- } catch (e) {
52
- adapter.log.error('error during update '+e);
53
- }
54
-
55
- if(self.initialized)
56
- self.update();
57
- }
58
- })(this), syncTime * 1000);
59
- }
60
-
61
- /**
62
- * Is called when adapter shuts down - callback has to be called under any circumstances!
63
- * @param {() => void} callback
64
- */
65
- onUnload(callback) {
66
- this.initialized = false;
67
- callback();
68
- }
69
-
70
- /**
71
- * Is called if a subscribed state changes
72
- * @param {string} id
73
- * @param {ioBroker.State | null | undefined} state
74
- */
75
- async onStateChange(id, state) {
76
-
77
- if (state.from.search (adaptername) != -1) {return;} // do not process self generated state changes
78
-
79
- if (state) {
80
- var callback = this.stateChangeCallbacks[id];
81
- if(callback != undefined) {
82
- var method = callback['method'];
83
- var target = callback['target'];
84
- await method(target, id, state);
85
- }
86
- }
87
- }
88
-
89
- async createProperty(_path, _name, _type, _read, _write, _role){
90
- await this.setObjectNotExistsAsync(_path+"."+_name, {
91
- type: 'state',
92
- common: {
93
- name: _name,
94
- type: _type,
95
- read: _read,
96
- write: _write,
97
- role: _role,
98
- },
99
- native: {},
100
- });
101
- }
102
-
103
- async createProperty(_path, _name, _type, _min, _max, _unit, _read, _write, _role){
104
- await this.setObjectNotExistsAsync(_path+"."+_name, {
105
- type: 'state',
106
- common: {
107
- name: _name,
108
- type: _type,
109
- read: _read,
110
- write: _write,
111
- role: _role,
112
- min : _min,
113
- max : _max,
114
- unit : _unit
115
- },
116
- native: {},
117
- });
118
- }
119
-
120
- async updatePropertyValue(_path, _name, _value) {
121
- await this.setStateAsync(_path+"."+_name, { val: _value, ack: true } );
122
- }
123
-
124
- async createPropertyAndInit(_path, _name, _type, _read, _write, _value, _role){
125
- await this.createProperty(_path, _name, _type, _read, _write, _role);
126
- await this.updatePropertyValue(_path, _name, _value);
127
- }
128
-
129
- subscribeState(path, obj, callback) {
130
- this.subscribeStates(path);
131
- var id = this.namespace+'.'+path;
132
- this.stateChangeCallbacks[id] = {target: obj, method : callback};
133
- }
134
- }
135
-
136
- if (require.main !== module) {
137
- // Export the constructor in compact mode
138
- /**
139
- * @param {Partial<utils.AdapterOptions>} [options={}]
140
- */
141
- module.exports = (options) => new Template(options);
142
- } else {
143
- // otherwise start the instance directly
144
- new Template();
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":"1.0.2",
4
- "description":"Airzone cloud adapter for ioBroker",
3
+ "version":"2.0.1",
4
+ "description":"Airzone local api integration for ioBroker",
5
5
  "author":{
6
6
  "name":"Christian Schemmer",
7
7
  "email":"christian.silentphoenix11@gmail.com"