iobroker.airzone 1.0.1 → 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.
@@ -0,0 +1,29 @@
1
+ * {
2
+ box-sizing: border-box
3
+ }
4
+ .m {
5
+ /* Don't cut off dropdowns! */
6
+ overflow: initial;
7
+ }
8
+ .m.adapter-container,
9
+ .m.adapter-container > div.App {
10
+ /* Fix layout/scrolling issues with tabs */
11
+ height: 100%;
12
+ width: 100%;
13
+ position: relative;
14
+ }
15
+ .m .select-wrapper + label {
16
+ /* The positioning for dropdown labels is messed up */
17
+ transform: none !important;
18
+ }
19
+
20
+ label > i[title] {
21
+ /* Display the help cursor for the tooltip icons and fix their positioning */
22
+ cursor: help;
23
+ margin-left: 0.25em;
24
+ }
25
+
26
+ .dropdown-content {
27
+ /* Don't wrap text in dropdowns */
28
+ white-space: nowrap;
29
+ }
package/admin/words.js ADDED
@@ -0,0 +1,53 @@
1
+ /*global systemDictionary:true */
2
+ 'use strict';
3
+
4
+ systemDictionary = {
5
+ "Adapter settings for airzone cloud": {
6
+ "en": "Adapter settings for airzone local api",
7
+ "de": "Adaptereinstellungen für airzone local api",
8
+ "ru": "Настройки адаптера для airzone local api",
9
+ "pt": "Ajustes do adaptador para api local de zona aérea",
10
+ "nl": "Adapter instellingen voor airzone local api",
11
+ "fr": "Paramètres de l'adaptateur pour l'api local d'airzone",
12
+ "it": "Impostazioni dell'adattatore per airzone local api",
13
+ "es": "Configuración del adaptador para la api local de airzone",
14
+ "pl": "Ustawienia adaptera dla airzone local api",
15
+ "zh-cn": "Airzone本地api的适配器设置"
16
+ },
17
+ "local_ip": {
18
+ "en": "Local IP address",
19
+ "de": "Lokale IP-Adresse",
20
+ "ru": "Локальный IP-адрес",
21
+ "pt": "Endereço IP local",
22
+ "nl": "Lokaal IP-adres",
23
+ "fr": "Adresse IP locale",
24
+ "it": "Indirizzo IP locale",
25
+ "es": "Dirección IP local",
26
+ "pl": "Lokalny adres IP",
27
+ "zh-cn": "本地IP地址"
28
+ },
29
+ "system_id": {
30
+ "en": "Unique ID of the airzone system.",
31
+ "de": "Eindeutige ID des airzone systems.",
32
+ "ru": "Уникальный идентификатор системы воздушной зоны.",
33
+ "pt": "Identificação única do sistema de zonas aéreas.",
34
+ "nl": "Unieke ID van het airzone-systeem.",
35
+ "fr": "ID unique du système airzone.",
36
+ "it": "ID unico del sistema airzone.",
37
+ "es": "ID único del sistema de zonas aéreas.",
38
+ "pl": "Unikalny identyfikator systemu stref powietrza.",
39
+ "zh-cn": "气区系统的唯一ID。"
40
+ },
41
+ "sync_time": {
42
+ "en": "Sync time",
43
+ "de": "Synchronisierungszeit",
44
+ "ru": "Время синхронизации",
45
+ "pt": "Tempo de sincronização",
46
+ "nl": "Synchroniseer tijd",
47
+ "fr": "Heure de synchronisation",
48
+ "it": "Sincronizza l'ora",
49
+ "es": "Tiempo de sincronización",
50
+ "pl": "Synchronizuj czas",
51
+ "zh-cn": "同步时间"
52
+ }
53
+ };
package/io-package.json CHANGED
@@ -1,69 +1,142 @@
1
- {
2
- "common":{
3
- "name":"airzone",
4
- "version":"1.0.1",
5
- "news":{
6
- "1.0.0":{
7
- "en":"initial release",
8
- "de":"Erstveröffentlichung"
9
- },
10
- "1.0.1":{
11
- "en":"Various corrections in the project structure",
12
- "de":"Diverse Korrekturen in Projektstruktur"
13
- }
14
- },
15
- "title":"Airzone Cloud",
16
- "titleLang":{
17
- "en":"Airzone Cloud",
18
- "de":"Airzone Cloud"
19
- },
20
- "desc":{
21
- "en":"Adapter for connecting the Airzone Cloud.",
22
- "de":"Adapter zur Anbindung der Airzone Cloud."
23
- },
24
- "authors":[
25
- "Christian Schemmer <christian.silentphoenix11@gmail.com>"
26
- ],
27
- "keywords":[
28
- "ioBroker",
29
- "airzone",
30
- "Smart Home",
31
- "home automation"
32
- ],
33
- "license":"MIT",
34
- "platform":"Javascript/Node.js",
35
- "main":"main.js",
36
- "icon":"AirzoneSmall.png",
37
- "extIcon":"https://raw.githubusercontent.com/SilentPhoenix11/ioBroker.airzone/master/admin/AirzoneSmall.png",
38
- "enabled":true,
39
- "readme":"https://github.com/SilentPhoenix11/ioBroker.airzone/blob/master/README.md",
40
- "loglevel":"info",
41
- "mode":"daemon",
42
- "type":"climate-control",
43
- "compact":true,
44
- "connectionType":"cloud",
45
- "dataSource":"poll",
46
- "materialize":true,
47
- "adminTab":{
48
- "singleton":true,
49
- "name":{
50
- "en":"Airzone Cloud",
51
- "de":"Airzone Cloud"
52
- },
53
- "link":"www.airzone.es/en/",
54
- "fa-icon":"info"
55
- },
56
- "supportCustoms":true,
57
- "dependencies":[
58
- {
59
- "js-controller":">=2.0.0"
60
- }
61
- ]
62
- },
63
- "native":{
64
- "base_url":"https://airzonecloud.com",
65
- "sync_time":12
66
- },
67
- "objects":[],
68
- "instanceObjects":[]
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":[]
69
142
  }
package/main.js CHANGED
@@ -1,136 +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
-
35
- if(this.config.sync_time > 0) {
36
- this.callReadAirzone = setInterval(
37
- (function(self) { //Self-executing func which takes 'this' as self
38
- return async function() { //Return a function in the context of 'self'
39
- await self.session.update();
40
- }
41
- })(this),
42
- this.config.sync_time * 1000);
43
- }
44
- }
45
-
46
- /**
47
- * Is called when adapter shuts down - callback has to be called under any circumstances!
48
- * @param {() => void} callback
49
- */
50
- onUnload(callback) {
51
- try {
52
- if (this.callReadAirzone !== null) {
53
- clearInterval(this.callReadActuator);
54
- adapter.log.debug('update timer cleared');
55
- }
56
-
57
- callback();
58
- } catch (e) {
59
- callback();
60
- }
61
- }
62
-
63
- /**
64
- * Is called if a subscribed state changes
65
- * @param {string} id
66
- * @param {ioBroker.State | null | undefined} state
67
- */
68
- async onStateChange(id, state) {
69
-
70
- if (state.from.search (adaptername) != -1) {return;} // do not process self generated state changes
71
-
72
- if (state) {
73
- var callback = this.stateChangeCallbacks[id];
74
- if(callback != undefined) {
75
- var method = callback['method'];
76
- var target = callback['target'];
77
- await method(target, id, state);
78
- }
79
- }
80
- }
81
-
82
- async createProperty(_path, _name, _type, _read, _write){
83
- await this.setObjectNotExistsAsync(_path+"."+_name, {
84
- type: 'state',
85
- common: {
86
- name: _name,
87
- type: _type,
88
- read: _read,
89
- write: _write,
90
- },
91
- native: {},
92
- });
93
- }
94
-
95
- async createProperty(_path, _name, _type, _min, _max, _unit, _read, _write){
96
- await this.setObjectNotExistsAsync(_path+"."+_name, {
97
- type: 'state',
98
- common: {
99
- name: _name,
100
- type: _type,
101
- read: _read,
102
- write: _write,
103
- min : _min,
104
- max : _max,
105
- unit : _unit
106
- },
107
- native: {},
108
- });
109
- }
110
-
111
- async updatePropertyValue(_path, _name, _value) {
112
- await this.setStateAsync(_path+"."+_name, { val: _value, ack: true } );
113
- }
114
-
115
- async createPropertyAndInit(_path, _name, _type, _read, _write, _value){
116
- await this.createProperty(_path, _name, _type, _read, _write);
117
- await this.updatePropertyValue(_path, _name, _value);
118
- }
119
-
120
- subscribeState(path, obj, callback) {
121
- this.subscribeStates(path);
122
- var id = this.namespace+'.'+path;
123
- this.stateChangeCallbacks[id] = {target: obj, method : callback};
124
- }
125
- }
126
-
127
- if (require.main !== module) {
128
- // Export the constructor in compact mode
129
- /**
130
- * @param {Partial<utils.AdapterOptions>} [options={}]
131
- */
132
- module.exports = (options) => new Template(options);
133
- } else {
134
- // otherwise start the instance directly
135
- 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();
136
154
  }