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/Airzone.png +0 -0
- package/LocalApi/AirzoneLocalApi.js +85 -0
- package/LocalApi/Constants.js +14 -0
- package/LocalApi/System.js +150 -0
- package/LocalApi/Zone.js +116 -0
- package/README.md +9 -0
- package/Utils/asyncRequest.js +35 -2
- 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 +153 -110
- 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/Cloud/Zone.js +0 -139
- package/settings/secrets/AUTO_MERGE_TOKEN +0 -1
package/Cloud/Zone.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
const Constants = require('./Constants');
|
|
2
|
-
|
|
3
|
-
class Zone {
|
|
4
|
-
constructor(adapter, airzone)
|
|
5
|
-
{
|
|
6
|
-
this.adapter = adapter;
|
|
7
|
-
this.airzone = airzone;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Initialize the zone with the data from the airzone cloud
|
|
12
|
-
*/
|
|
13
|
-
async init(path, zoneData) {
|
|
14
|
-
this.id = zoneData['id'];
|
|
15
|
-
this.name = zoneData['name'];
|
|
16
|
-
|
|
17
|
-
this.device_id = zoneData['device_id'];
|
|
18
|
-
this.system_number = zoneData['system_number'];
|
|
19
|
-
this.zone_number = zoneData['zone_number'];
|
|
20
|
-
|
|
21
|
-
this.min_temp = zoneData['lower_conf_limit'];
|
|
22
|
-
this.max_temp = zoneData['upper_conf_limit'];
|
|
23
|
-
|
|
24
|
-
this.path = path+'.'+this.name;
|
|
25
|
-
await this.adapter.setObjectNotExistsAsync(this.path, {
|
|
26
|
-
type: 'device',
|
|
27
|
-
common: {
|
|
28
|
-
name: 'Zone_'+this.name,
|
|
29
|
-
type: 'object',
|
|
30
|
-
read: true,
|
|
31
|
-
write: false,
|
|
32
|
-
},
|
|
33
|
-
native: {},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
await this.adapter.createPropertyAndInit(this.path, 'id', 'string', true, false, this.id, 'text');
|
|
37
|
-
await this.adapter.createPropertyAndInit(this.path, 'name', 'string', true, false, this.name, 'text');
|
|
38
|
-
await this.adapter.createPropertyAndInit(this.path, 'min_temp', 'number', true, false, this.min_temp, 'value.min');
|
|
39
|
-
await this.adapter.createPropertyAndInit(this.path, 'max_temp', 'number', true, false, this.max_temp, 'value.max');
|
|
40
|
-
await this.adapter.createProperty(this.path, 'current_temperature', 'number', 0, 100, '°C', true, false, 'value.temperature');
|
|
41
|
-
await this.adapter.createProperty(this.path, 'current_humidity', 'number', 0, 100, '%', true, false, 'value.humidity');
|
|
42
|
-
await this.adapter.createProperty(this.path, 'target_temperature', 'number', this.min_temp, this.max_temp, '°C', true, true, 'state');
|
|
43
|
-
await this.adapter.createProperty(this.path, 'is_on', 'boolean', true, false, 'switch.power');
|
|
44
|
-
await this.adapter.createProperty(this.path, 'mode_raw', 'number', true, false, 'value');
|
|
45
|
-
await this.adapter.createProperty(this.path, 'mode', 'string', true, false, 'text');
|
|
46
|
-
await this.adapter.createProperty(this.path, 'mode_description', 'string', true, false, 'text');
|
|
47
|
-
|
|
48
|
-
// Register callbacks to react on value changes
|
|
49
|
-
this.adapter.subscribeState(this.path+'.target_temperature', this, this.reactToTargetTemperatureChange);
|
|
50
|
-
this.adapter.subscribeState(this.path+'.is_on', this, this.reactToIsOnChange);
|
|
51
|
-
|
|
52
|
-
await this.updateData(zoneData);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Synchronized the zone data from airzone into the iobroker data points
|
|
57
|
-
*/
|
|
58
|
-
async updateData(zoneData)
|
|
59
|
-
{
|
|
60
|
-
this.current_temperature = zoneData['temp'];
|
|
61
|
-
await this.adapter.updatePropertyValue(this.path, 'current_temperature', this.current_temperature);
|
|
62
|
-
|
|
63
|
-
this.current_humidity = zoneData['humidity'];
|
|
64
|
-
await this.adapter.updatePropertyValue(this.path, 'current_humidity', this.current_humidity);
|
|
65
|
-
|
|
66
|
-
this.target_temperature = zoneData['consign'];
|
|
67
|
-
await this.adapter.updatePropertyValue(this.path, 'target_temperature', this.target_temperature);
|
|
68
|
-
|
|
69
|
-
this.mode_raw = zoneData['mode'];
|
|
70
|
-
await this.adapter.updatePropertyValue(this.path, 'mode_raw', this.mode_raw);
|
|
71
|
-
|
|
72
|
-
this.mode = Constants.MODES_CONVERTER[this.mode_raw]['name'];
|
|
73
|
-
await this.adapter.updatePropertyValue(this.path, 'mode', this.mode);
|
|
74
|
-
|
|
75
|
-
this.mode_description = Constants.MODES_CONVERTER[this.mode_raw]['description'];
|
|
76
|
-
await this.adapter.updatePropertyValue(this.path, 'mode_description', this.mode_description);
|
|
77
|
-
|
|
78
|
-
this.is_on = zoneData['state'] == '1' && this.mode_raw > 0;
|
|
79
|
-
await this.adapter.updatePropertyValue(this.path, 'is_on', this.is_on);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Is called when the state of target_temperature was changed
|
|
84
|
-
*/
|
|
85
|
-
async reactToTargetTemperatureChange(self, id, state) {
|
|
86
|
-
var temperature = state.val;
|
|
87
|
-
if(self.min_temp != undefined && temperature < self.min_temp)
|
|
88
|
-
temperature = self.min_temp;
|
|
89
|
-
if(self.max_temp != undefined && temperature > self.max_temp)
|
|
90
|
-
temperature = self.max_temp;
|
|
91
|
-
|
|
92
|
-
await self.sendEvent('consign', temperature);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Is called when the state of is_on was changed
|
|
97
|
-
*/
|
|
98
|
-
async reactToIsOnChange(self, id, state) {
|
|
99
|
-
if(self.mode_raw < 1)
|
|
100
|
-
return;
|
|
101
|
-
|
|
102
|
-
if(state.val)
|
|
103
|
-
await self.turn_on();
|
|
104
|
-
else
|
|
105
|
-
await self.turn_off();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Send event to the airzone cloud
|
|
110
|
-
*/
|
|
111
|
-
async sendEvent(option, value) {
|
|
112
|
-
var payload = {
|
|
113
|
-
'event': {
|
|
114
|
-
'cgi': 'modzona',
|
|
115
|
-
'device_id': this.device_id,
|
|
116
|
-
'system_number': this.system_number,
|
|
117
|
-
'zone_number': this.zone_number,
|
|
118
|
-
'option': option,
|
|
119
|
-
'value': value,
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
await this.airzone.sendEvent(payload);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Turn zone on
|
|
127
|
-
*/
|
|
128
|
-
async turn_on() {
|
|
129
|
-
await this.sendEvent('state', 1);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Turn zone off
|
|
134
|
-
*/
|
|
135
|
-
async turn_off() {
|
|
136
|
-
await this.sendEvent('state', 0);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
module.exports = Zone;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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
|