homebridge-edomoticz 2.1.38 → 2.1.40
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/.npmignore +3 -0
- package/CHANGELOG +0 -0
- package/InstallGuide +0 -0
- package/LICENSE +0 -0
- package/README.md +1 -0
- package/config.schema.json +14 -0
- package/index.js +63 -73
- package/lib/constants.js +3 -1
- package/lib/domoticz.js +2 -0
- package/lib/domoticz_accessory.js +137 -100
- package/lib/helper.js +0 -0
- package/lib/mqtt.js +0 -0
- package/lib/services.js +20 -0
- package/package.json +1 -1
package/.npmignore
ADDED
package/CHANGELOG
CHANGED
|
File without changes
|
package/InstallGuide
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
package/config.schema.json
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
"default": "8080",
|
|
27
27
|
"required": true
|
|
28
28
|
},
|
|
29
|
+
"webroot": {
|
|
30
|
+
"title": "Webroot",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": "",
|
|
33
|
+
"required": false
|
|
34
|
+
},
|
|
29
35
|
"roomid": {
|
|
30
36
|
"title": "Room ID",
|
|
31
37
|
"type": "integer",
|
|
@@ -51,6 +57,12 @@
|
|
|
51
57
|
"default": 0,
|
|
52
58
|
"description": "The dimFix variable relates to an early issue between HomeKit and Domoticz regarding scaling of dimmer values. If you find that you can never set your dimmers to 100%, then set this variable to 1. If you find that, when you set your dimmers, this starts a never ending loop of brightness increasing by 1%, then you MUST omit this variable or set it to 0."
|
|
53
59
|
},
|
|
60
|
+
"legacyBlinds": {
|
|
61
|
+
"title": "Use legacy blind support",
|
|
62
|
+
"type": "integer",
|
|
63
|
+
"default": 0,
|
|
64
|
+
"description": "If you use blinds, set this option to 1 if you use an older version of domoticz (until 2022-beta.14535). If using a more recent version, set to 0. When set to 0, the new reverse state and position will be used"
|
|
65
|
+
},
|
|
54
66
|
"excludedDevices": {
|
|
55
67
|
"title": "Exluded Devices",
|
|
56
68
|
"type": "array",
|
|
@@ -68,6 +80,7 @@
|
|
|
68
80
|
"items": [
|
|
69
81
|
"server",
|
|
70
82
|
"port",
|
|
83
|
+
"webroot",
|
|
71
84
|
"roomid"
|
|
72
85
|
]
|
|
73
86
|
}, {
|
|
@@ -105,6 +118,7 @@
|
|
|
105
118
|
"items": [
|
|
106
119
|
|
|
107
120
|
"dimFix",
|
|
121
|
+
"legacyBlinds",
|
|
108
122
|
"mqtt",
|
|
109
123
|
"ssl"
|
|
110
124
|
]
|
package/index.js
CHANGED
|
@@ -9,31 +9,6 @@
|
|
|
9
9
|
// [http://twitter.com/marcisshadow]
|
|
10
10
|
// [http://domoticz.com/forum/memberlist.php?mode=viewprofile&u=10884]
|
|
11
11
|
//
|
|
12
|
-
// ** Remember to add platform to config.json **
|
|
13
|
-
//
|
|
14
|
-
// Example ~/.homebridge/config.json content:
|
|
15
|
-
//
|
|
16
|
-
// {
|
|
17
|
-
// "bridge": {
|
|
18
|
-
// "name": "Homebridge",
|
|
19
|
-
// "username": "CC:21:3E:E4:DE:33", // << Randomize this...
|
|
20
|
-
// "port": 51826,
|
|
21
|
-
// "pin": "031-45-154",
|
|
22
|
-
// },
|
|
23
|
-
//
|
|
24
|
-
// "platforms": [{
|
|
25
|
-
// "platform": "eDomoticz",
|
|
26
|
-
// "name": "eDomoticz",
|
|
27
|
-
// "server": "127.0.0.1", // or "user:pass@ip"
|
|
28
|
-
// "port": "8080",
|
|
29
|
-
// "roomid": 0 , // 0 = all sensors, otherwise, room idx as shown at http://server:port/#/Roomplan
|
|
30
|
-
// "ssl": 0,
|
|
31
|
-
// "mqtt": true
|
|
32
|
-
// }],
|
|
33
|
-
//
|
|
34
|
-
// "accessories":[]
|
|
35
|
-
// }
|
|
36
|
-
//
|
|
37
12
|
var Domoticz = require('./lib/domoticz.js').Domoticz;
|
|
38
13
|
var Mqtt = require('./lib/mqtt.js').Mqtt;
|
|
39
14
|
var eDomoticzAccessory = require('./lib/domoticz_accessory.js');
|
|
@@ -45,43 +20,44 @@ const util = require('util');
|
|
|
45
20
|
module.exports = function(homebridge) {
|
|
46
21
|
Service = homebridge.hap.Service;
|
|
47
22
|
Characteristic = homebridge.hap.Characteristic;
|
|
23
|
+
Categories = homebridge.hap.Accessory.Categories;
|
|
48
24
|
Types = homebridge.hapLegacyTypes;
|
|
49
25
|
UUID = homebridge.hap.uuid;
|
|
50
26
|
|
|
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
|
-
|
|
27
|
+
util.inherits(eDomoticzServices.TotalConsumption, Characteristic);
|
|
28
|
+
util.inherits(eDomoticzServices.CurrentConsumption, Characteristic);
|
|
29
|
+
util.inherits(eDomoticzServices.GasConsumption, Characteristic);
|
|
30
|
+
util.inherits(eDomoticzServices.TempOverride, Characteristic);
|
|
31
|
+
util.inherits(eDomoticzServices.MeterDeviceService, Service);
|
|
32
|
+
util.inherits(eDomoticzServices.GasDeviceService, Service);
|
|
33
|
+
util.inherits(eDomoticzServices.Ampere, Characteristic);
|
|
34
|
+
util.inherits(eDomoticzServices.AMPDeviceService, Service);
|
|
35
|
+
util.inherits(eDomoticzServices.Volt, Characteristic);
|
|
36
|
+
util.inherits(eDomoticzServices.VOLTDeviceService, Service);
|
|
37
|
+
util.inherits(eDomoticzServices.CurrentUsage, Characteristic);
|
|
38
|
+
util.inherits(eDomoticzServices.UsageDeviceService, Service);
|
|
39
|
+
util.inherits(eDomoticzServices.TodayConsumption, Characteristic);
|
|
40
|
+
util.inherits(eDomoticzServices.Barometer, Characteristic);
|
|
41
|
+
util.inherits(eDomoticzServices.WaterFlow, Characteristic);
|
|
42
|
+
util.inherits(eDomoticzServices.TotalWaterFlow, Characteristic);
|
|
43
|
+
util.inherits(eDomoticzServices.WaterDeviceService, Service);
|
|
44
|
+
util.inherits(eDomoticzServices.WeatherService, Service);
|
|
45
|
+
util.inherits(eDomoticzServices.WindSpeed, Characteristic);
|
|
46
|
+
util.inherits(eDomoticzServices.WindChill, Characteristic);
|
|
47
|
+
util.inherits(eDomoticzServices.WindDirection, Characteristic);
|
|
48
|
+
util.inherits(eDomoticzServices.WindDeviceService, Service);
|
|
49
|
+
util.inherits(eDomoticzServices.Rainfall, Characteristic);
|
|
50
|
+
util.inherits(eDomoticzServices.RainDeviceService, Service);
|
|
51
|
+
util.inherits(eDomoticzServices.Visibility, Characteristic);
|
|
52
|
+
util.inherits(eDomoticzServices.VisibilityDeviceService, Service);
|
|
53
|
+
util.inherits(eDomoticzServices.SolRad, Characteristic);
|
|
54
|
+
util.inherits(eDomoticzServices.SolRadDeviceService, Service);
|
|
55
|
+
util.inherits(eDomoticzServices.LocationService, Service);
|
|
56
|
+
util.inherits(eDomoticzServices.Location, Characteristic);
|
|
57
|
+
util.inherits(eDomoticzServices.InfotextDeviceService, Service);
|
|
58
|
+
util.inherits(eDomoticzServices.Infotext, Characteristic);
|
|
59
|
+
util.inherits(eDomoticzServices.UVDeviceService, Service);
|
|
60
|
+
util.inherits(eDomoticzServices.UVIndex, Characteristic);
|
|
85
61
|
|
|
86
62
|
//homebridge.registerAccessory("homebridge-edomoticz", "eDomoticz", eDomoticzAccessory);
|
|
87
63
|
homebridge.registerPlatform("homebridge-edomoticz", "eDomoticz", eDomoticzPlatform, true);
|
|
@@ -109,9 +85,10 @@ function eDomoticzPlatform(log, config, api) {
|
|
|
109
85
|
|
|
110
86
|
this.ssl = (config.ssl == 1);
|
|
111
87
|
this.port = config.port;
|
|
88
|
+
this.webroot = config.webroot;
|
|
112
89
|
this.room = config.roomid;
|
|
113
90
|
this.api = api;
|
|
114
|
-
this.apiBaseURL = "http" + (this.ssl ? "s" : "") + "://" + this.server + ":" + this.port + "/json.htm?";
|
|
91
|
+
this.apiBaseURL = "http" + (this.ssl ? "s" : "") + "://" + this.server + ":" + this.port + ((this.webroot === undefined) ? "" : "/" + this.webroot ) + "/json.htm?";
|
|
115
92
|
this.mqtt = false;
|
|
116
93
|
} catch (e) {
|
|
117
94
|
this.forceLog(e);
|
|
@@ -149,20 +126,19 @@ eDomoticzPlatform.prototype = {
|
|
|
149
126
|
var excludedDevices = (typeof this.config.excludedDevices !== 'undefined') ? this.config.excludedDevices : [];
|
|
150
127
|
|
|
151
128
|
Domoticz.devices(this.apiBaseURL, this.room, function(devices) {
|
|
152
|
-
var removedAccessories = []
|
|
129
|
+
var removedAccessories = [],
|
|
130
|
+
externalAccessories = [];
|
|
153
131
|
|
|
154
132
|
|
|
155
133
|
for (var i = 0; i < devices.length; i++) {
|
|
156
134
|
var device = devices[i], exclude = !1;
|
|
157
135
|
if (!(excludedDevices.indexOf(device.idx) <= -1)) {
|
|
158
136
|
exclude = !0;
|
|
159
|
-
this.
|
|
160
|
-
//continue;
|
|
137
|
+
this.log(device.Name + ' (idx:' + device.idx + ') excluded via config array');
|
|
161
138
|
}
|
|
162
139
|
|
|
163
140
|
if (device.Image == undefined) {
|
|
164
141
|
device.Image = 'Switch';
|
|
165
|
-
//this.forceLog(device.Name);
|
|
166
142
|
}
|
|
167
143
|
|
|
168
144
|
var existingAccessory = this.accessories.find(function(existingAccessory) {
|
|
@@ -191,20 +167,35 @@ eDomoticzPlatform.prototype = {
|
|
|
191
167
|
// Generate a new accessory
|
|
192
168
|
var uuid = UUID.generate(device.idx + "_" + device.Name);
|
|
193
169
|
this.forceLog("Device: " + device.Name + " (" + device.idx + ")");
|
|
194
|
-
var accessory = new eDomoticzAccessory(this, false, false, device.Used, device.idx, device.Name, uuid, device.HaveDimmer, device.MaxDimLevel, device.SubType, device.Type, device.BatteryLevel, device.SwitchType, device.SwitchTypeVal, device.HardwareID, device.HardwareTypeVal, device.Image, this.eve, device.HaveTimeout);
|
|
170
|
+
var accessory = new eDomoticzAccessory(this, false, false, device.Used, device.idx, device.Name, uuid, device.HaveDimmer, device.MaxDimLevel, device.SubType, device.Type, device.BatteryLevel, device.SwitchType, device.SwitchTypeVal, device.HardwareID, device.HardwareTypeVal, device.Image, this.eve, device.HaveTimeout, device.Description);
|
|
195
171
|
this.accessories.push(accessory);
|
|
196
172
|
|
|
197
173
|
// Register the accessories
|
|
198
174
|
try {
|
|
199
|
-
|
|
175
|
+
accessory.platformAccessory.context = {
|
|
176
|
+
device: device,
|
|
177
|
+
uuid: uuid,
|
|
178
|
+
eve: this.eve
|
|
179
|
+
};
|
|
180
|
+
if ((device.SwitchTypeVal == Constants.DeviceTypeMedia) || (device.SwitchTypeVal == Constants.DeviceTypeSelector && device.Image == "TV")) {
|
|
181
|
+
externalAccessories.push(accessory);
|
|
182
|
+
} else {
|
|
183
|
+
this.api.registerPlatformAccessories("homebridge-edomoticz", "eDomoticz", [accessory.platformAccessory]);
|
|
184
|
+
}
|
|
185
|
+
|
|
200
186
|
} catch (e) {
|
|
201
187
|
this.forceLog("Could not register platform accessory! (" + accessory.name + ")\n" + e);
|
|
202
188
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
189
|
+
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Publish external (ie: TV) accessories now that they're fully assembled
|
|
193
|
+
for (var ei = 0; ei < externalAccessories.length; ei++) {
|
|
194
|
+
var externalAccessory = externalAccessories[ei];
|
|
195
|
+
if (externalAccessory.subType !== 'Selector Switch')
|
|
196
|
+
{
|
|
197
|
+
this.api.publishExternalAccessories("homebridge-edomoticz", [externalAccessory.platformAccessory]);
|
|
198
|
+
this.forceLog("External Device: " + externalAccessory.platformAccessory.context.device.Name + " (" + externalAccessory.platformAccessory.context.device.idx + ")");
|
|
208
199
|
}
|
|
209
200
|
}
|
|
210
201
|
|
|
@@ -231,7 +222,6 @@ eDomoticzPlatform.prototype = {
|
|
|
231
222
|
var index = this.accessories.indexOf(removedAccessory);
|
|
232
223
|
this.accessories.splice(index, 1);
|
|
233
224
|
}
|
|
234
|
-
|
|
235
225
|
this.isSynchronizingAccessories = false;
|
|
236
226
|
}.bind(this), function(response, err) {
|
|
237
227
|
Helper.LogConnectionError(this, response, err);
|
|
@@ -254,7 +244,7 @@ eDomoticzPlatform.prototype = {
|
|
|
254
244
|
var eve = platformAccessory.context.eve;
|
|
255
245
|
|
|
256
246
|
// Generate the already cached accessory again
|
|
257
|
-
var accessory = new eDomoticzAccessory(this, platformAccessory, false, device.Used, device.idx, device.Name, uuid, device.HaveDimmer, device.MaxDimLevel, device.SubType, device.Type, device.BatteryLevel, device.SwitchType, device.SwitchTypeVal, device.HardwareID, device.HardwareTypeVal, device.Image, eve);
|
|
247
|
+
var accessory = new eDomoticzAccessory(this, platformAccessory, false, device.Used, device.idx, device.Name, uuid, device.HaveDimmer, device.MaxDimLevel, device.SubType, device.Type, device.BatteryLevel, device.SwitchType, device.SwitchTypeVal, device.HardwareID, device.HardwareTypeVal, device.Image, eve, device.HaveTimeout, device.Description);
|
|
258
248
|
this.accessories.push(accessory);
|
|
259
249
|
}
|
|
260
250
|
};
|
package/lib/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
global.Service;
|
|
2
2
|
global.Characteristic;
|
|
3
|
+
global.Categories;
|
|
3
4
|
global.Types;
|
|
4
5
|
global.UUID;
|
|
5
6
|
|
|
@@ -18,10 +19,11 @@ module.exports = {
|
|
|
18
19
|
DeviceTypeBlindsVenetianUS: 14,
|
|
19
20
|
DeviceTypeBlindsVenetianEU: 15,
|
|
20
21
|
DeviceTypeBlindsPercentageInverted: 16,
|
|
21
|
-
DeviceTypeMedia: 17,
|
|
22
|
+
DeviceTypeMedia: 17,
|
|
22
23
|
DeviceTypeSelector: 18,
|
|
23
24
|
DeviceTypeDoorLock: 19,
|
|
24
25
|
DeviceTypeDoorLockInverted: 20,
|
|
26
|
+
DeviceTypeBlindsPlusStop: 21,
|
|
25
27
|
|
|
26
28
|
/* Made up, internal types */
|
|
27
29
|
DeviceTypeSecuritySystem: 254, // Has HardwareTypeVal 67 w/o any SwitchTypeVal
|
package/lib/domoticz.js
CHANGED
|
@@ -48,6 +48,7 @@ Domoticz.settings = function(accessory, completion, error) {
|
|
|
48
48
|
Helper.LogConnectionError(this.platform, response, err);
|
|
49
49
|
if (typeof error !== 'undefined' && error !== false) {
|
|
50
50
|
error();
|
|
51
|
+
callback();
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}.bind(accessory));
|
|
@@ -207,6 +208,7 @@ Domoticz.updateWithURL = function(accessory, url, completion) {
|
|
|
207
208
|
}
|
|
208
209
|
else {
|
|
209
210
|
Helper.LogConnectionError(this.platform, response, err);
|
|
211
|
+
callback();
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
if (typeof completion !== 'undefined' && completion !== false) {
|
|
@@ -9,7 +9,7 @@ module.exports = eDomoticzAccessory;
|
|
|
9
9
|
var tvAccessories = {};
|
|
10
10
|
var tvInputAccessories = {};
|
|
11
11
|
|
|
12
|
-
function eDomoticzAccessory(platform, platformAccessory, IsScene, status, idx, name, uuid, haveDimmer, maxDimLevel, subType, Type, batteryRef, swType, swTypeVal, hwId, hwType, image, eve, hwtimeout) {
|
|
12
|
+
function eDomoticzAccessory(platform, platformAccessory, IsScene, status, idx, name, uuid, haveDimmer, maxDimLevel, subType, Type, batteryRef, swType, swTypeVal, hwId, hwType, image, eve, hwtimeout, descript) {
|
|
13
13
|
|
|
14
14
|
if ((haveDimmer) || (swType == "Dimmer")) {
|
|
15
15
|
if ((hwType !== 51) && (swType !== "On/Off")) {
|
|
@@ -53,6 +53,7 @@ function eDomoticzAccessory(platform, platformAccessory, IsScene, status, idx, n
|
|
|
53
53
|
this.cachedValues = {};
|
|
54
54
|
this.hwId = hwId;
|
|
55
55
|
this.hwType = hwType;
|
|
56
|
+
this.descript = descript;
|
|
56
57
|
this.powerOnBySetLevelTime = 0;
|
|
57
58
|
|
|
58
59
|
// Initialize default values, e.g. to get the "factor"
|
|
@@ -61,10 +62,14 @@ function eDomoticzAccessory(platform, platformAccessory, IsScene, status, idx, n
|
|
|
61
62
|
case this.swTypeVal == Constants.DeviceTypeDimmer:
|
|
62
63
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentage:
|
|
63
64
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted:
|
|
65
|
+
case this.swTypeVal == Constants.DeviceTypeBlindsPlusStop:
|
|
64
66
|
{
|
|
65
67
|
if (this.swTypeVal == Constants.DeviceTypeBlindsPercentage) {
|
|
66
68
|
this.isPercentageBlind = Constants.DeviceTypeBlindsPercentage;
|
|
67
69
|
}
|
|
70
|
+
if (this.swTypeVal == Constants.DeviceTypeBlindsPlusStop) {
|
|
71
|
+
this.isPercentageBlind = Constants.DeviceTypeBlindsPlusStop;
|
|
72
|
+
}
|
|
68
73
|
if (this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted) {
|
|
69
74
|
this.isInvertedBlind = Constants.DeviceTypeBlindsPercentageInverted;
|
|
70
75
|
}
|
|
@@ -80,6 +85,9 @@ function eDomoticzAccessory(platform, platformAccessory, IsScene, status, idx, n
|
|
|
80
85
|
this.platformAccessory = new platform.api.platformAccessory(this.name, uuid);
|
|
81
86
|
}
|
|
82
87
|
this.platformAccessory.reachable = true;
|
|
88
|
+
if (this.swTypeVal == Constants.DeviceTypeMedia) {
|
|
89
|
+
this.platformAccessory.category = Categories.TELEVISION;
|
|
90
|
+
}
|
|
83
91
|
this.publishServices();
|
|
84
92
|
}
|
|
85
93
|
|
|
@@ -150,7 +158,7 @@ eDomoticzAccessory.prototype = {
|
|
|
150
158
|
|
|
151
159
|
return service.addCharacteristic(new characteristicType());
|
|
152
160
|
},
|
|
153
|
-
setPowerState: function (powerOn, callback, context) {
|
|
161
|
+
setPowerState: function (powerOn, callback, context) {
|
|
154
162
|
if (context && context == "eDomoticz-MQTT"
|
|
155
163
|
|| (this.cachedValues[Characteristic.On.UUID] == powerOn && powerOn) // Prevents message loop while dimming lights.
|
|
156
164
|
|| (this.powerOnBySetLevelTime > 0 && (performance.now() - this.powerOnBySetLevelTime) < 500 && powerOn) // Ignore a power ON right after a setlevel to allow turning ON a light using a dimmer.
|
|
@@ -168,7 +176,7 @@ eDomoticzAccessory.prototype = {
|
|
|
168
176
|
callback();
|
|
169
177
|
}.bind(this));
|
|
170
178
|
},
|
|
171
|
-
getPowerState: function (callback) {
|
|
179
|
+
getPowerState: function (callback) {
|
|
172
180
|
var cachedValue = this.cachedValues[Characteristic.On.UUID];
|
|
173
181
|
if (typeof cachedValue !== 'undefined') {
|
|
174
182
|
callback(null, cachedValue);
|
|
@@ -184,7 +192,7 @@ eDomoticzAccessory.prototype = {
|
|
|
184
192
|
value = (s.Status == "Off") ? false : true;
|
|
185
193
|
}
|
|
186
194
|
}.bind(this));
|
|
187
|
-
|
|
195
|
+
|
|
188
196
|
if (typeof cachedValue === 'undefined') {
|
|
189
197
|
callback(null, value);
|
|
190
198
|
}
|
|
@@ -217,7 +225,7 @@ eDomoticzAccessory.prototype = {
|
|
|
217
225
|
sArray.map(function (s) {
|
|
218
226
|
value = (s.Status == "Off") ? false : true;
|
|
219
227
|
}.bind(this));
|
|
220
|
-
|
|
228
|
+
|
|
221
229
|
if (typeof cachedValue === 'undefined') {
|
|
222
230
|
callback(null, value);
|
|
223
231
|
}
|
|
@@ -447,7 +455,7 @@ eDomoticzAccessory.prototype = {
|
|
|
447
455
|
value = (value == 0) ? 0.0001 : value;
|
|
448
456
|
} else if (this.subType == "Waterflow" || (this.name.indexOf("Gas") > -1 && this.Type == "General" && this.subType == "kWh")) {
|
|
449
457
|
value = Helper.cleanFloat(s.Data);
|
|
450
|
-
} else if (this.subType == "RFXMeter counter" || this.subType == "Percentage" || this.subType == "kWh" || this.subType == "Energy" || this.subType == "Solar Radiation" || this.subType == "UVN800" || this.subType == "UVN128,UV138" || this.subType == "Visibility") {
|
|
458
|
+
} else if (this.subType == "RFXMeter counter" || this.subType == "Percentage" || this.subType == "kWh" || this.subType == "Energy" || this.subType == "Solar Radiation" || this.subType == "UVN800" || this.subType == "UVN128,UV138" || this.subType == "Visibility") {
|
|
451
459
|
value = (s.Counter !== undefined) ? Helper.cleanFloat(s.Counter) : Helper.cleanFloat(s.Data);
|
|
452
460
|
} else if (this.subType == "Text") {
|
|
453
461
|
value = s.Data.toString();
|
|
@@ -979,9 +987,9 @@ eDomoticzAccessory.prototype = {
|
|
|
979
987
|
callback();
|
|
980
988
|
return;
|
|
981
989
|
}
|
|
982
|
-
|
|
983
|
-
if (this.
|
|
984
|
-
Domoticz.updateDeviceStatus(tvInputAccessories[this.
|
|
990
|
+
|
|
991
|
+
if (this.descript in tvInputAccessories) {
|
|
992
|
+
Domoticz.updateDeviceStatus(tvInputAccessories[this.descript], "switchlight", {
|
|
985
993
|
"switchcmd": "Set Level",
|
|
986
994
|
"level": identifier * 10
|
|
987
995
|
}, function (success) {
|
|
@@ -996,8 +1004,8 @@ eDomoticzAccessory.prototype = {
|
|
|
996
1004
|
callback(null, cachedValue);
|
|
997
1005
|
}
|
|
998
1006
|
|
|
999
|
-
if (this.
|
|
1000
|
-
Domoticz.deviceStatus(tvInputAccessories[this.
|
|
1007
|
+
if (this.descript in tvInputAccessories) {
|
|
1008
|
+
Domoticz.deviceStatus(tvInputAccessories[this.descript], function (json) {
|
|
1001
1009
|
var value = 0;
|
|
1002
1010
|
var sArray = Helper.sortByKey(json.result, "Name");
|
|
1003
1011
|
sArray.map(function (s) {
|
|
@@ -1013,7 +1021,7 @@ eDomoticzAccessory.prototype = {
|
|
|
1013
1021
|
} else if (typeof cachedValue === 'undefined') {
|
|
1014
1022
|
this.cachedValues[Characteristic.ActiveIdentifier.UUID] = 0;
|
|
1015
1023
|
callback(null, 0);
|
|
1016
|
-
}
|
|
1024
|
+
}
|
|
1017
1025
|
},
|
|
1018
1026
|
handleMQTTMessage: function (message, callback) {
|
|
1019
1027
|
this.platform.log("MQTT Message received for %s.\nName:\t\t%s\nDevice:\t\t%s,%s\nIs Switch:\t%s\nSwitchTypeVal:\t%s\nMQTT Message:\n%s", this.name, this.name, this.Type, this.subType, this.isSwitch, this.swTypeVal, JSON.stringify(message, null, 4));
|
|
@@ -1027,7 +1035,7 @@ eDomoticzAccessory.prototype = {
|
|
|
1027
1035
|
if (this.isSwitch) {
|
|
1028
1036
|
switch (true) {
|
|
1029
1037
|
case this.swTypeVal == Constants.DeviceTypeSwitch || this.swTypeVal == Constants.DeviceTypePushOn:
|
|
1030
|
-
{
|
|
1038
|
+
{
|
|
1031
1039
|
var service = false;
|
|
1032
1040
|
if (this.image !== undefined && this.swTypeVal !== Constants.DeviceTypePushOn) {
|
|
1033
1041
|
if (this.image.indexOf("Fan") > -1) {
|
|
@@ -1160,7 +1168,7 @@ eDomoticzAccessory.prototype = {
|
|
|
1160
1168
|
callback(characteristic, Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
1161
1169
|
break;
|
|
1162
1170
|
}
|
|
1163
|
-
case this.swTypeVal == Constants.DeviceTypeSelector && this.image
|
|
1171
|
+
case this.swTypeVal == Constants.DeviceTypeSelector && this.image !== "TV":
|
|
1164
1172
|
{
|
|
1165
1173
|
var service = this.getService(Service.StatelessProgrammableSwitch);
|
|
1166
1174
|
var characteristic = this.getCharacteristic(service, Characteristic.ProgrammableSwitchEvent);
|
|
@@ -1181,16 +1189,21 @@ eDomoticzAccessory.prototype = {
|
|
|
1181
1189
|
}
|
|
1182
1190
|
case this.swTypeVal == Constants.DeviceTypeSelector && this.image == "TV":
|
|
1183
1191
|
{
|
|
1184
|
-
var tvAccessory = tvAccessories[this.
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1192
|
+
var tvAccessory = tvAccessories[this.descript];
|
|
1193
|
+
if (typeof tvAccessory !== undefined) {
|
|
1194
|
+
var tvService = tvAccessory.getService(Service.Television);
|
|
1195
|
+
var characteristic = tvAccessory.getCharacteristic(tvService, Characteristic.ActiveIdentifier);
|
|
1196
|
+
var identifier = parseInt(message.svalue1) / 10;
|
|
1197
|
+
var oldIdentifier = tvAccessory.cachedValues[Characteristic.ActiveIdentifier.UUID];
|
|
1198
|
+
|
|
1199
|
+
if (identifier != oldIdentifier) {
|
|
1200
|
+
tvAccessory.cachedValues[Characteristic.ActiveIdentifier.UUID] = identifier;
|
|
1201
|
+
callback(characteristic, identifier);
|
|
1202
|
+
}
|
|
1203
|
+
} else {
|
|
1204
|
+
callback();
|
|
1193
1205
|
}
|
|
1206
|
+
|
|
1194
1207
|
}
|
|
1195
1208
|
break;
|
|
1196
1209
|
case this.swTypeVal == Constants.DeviceTypeDoorLock:
|
|
@@ -1275,21 +1288,41 @@ eDomoticzAccessory.prototype = {
|
|
|
1275
1288
|
case this.swTypeVal == Constants.DeviceTypeBlindsVenetianEU:
|
|
1276
1289
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentage:
|
|
1277
1290
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted:
|
|
1291
|
+
case this.swTypeVal == Constants.DeviceTypeBlindsPlusStop:
|
|
1278
1292
|
{
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1293
|
+
if (this.platform.config.legacyBlinds == 1) {
|
|
1294
|
+
var position = 0;
|
|
1295
|
+
if (this.isPercentageBlind && message.nvalue > 1) {
|
|
1296
|
+
position = message.svalue1 * this.factor;
|
|
1297
|
+
} else if ((this.swTypeVal == Constants.DeviceTypeBlindsVenetianUS || this.swTypeVal == Constants.DeviceTypeBlindsVenetianEU) && message.nvalue > 1) {
|
|
1298
|
+
position = (message.nvalue == 15 ? 100 : 0);
|
|
1299
|
+
} else {
|
|
1300
|
+
position = (message.nvalue == 1 ? 0 : 100);
|
|
1301
|
+
if (message.stype == 'RFY') {
|
|
1302
|
+
position = 100 - position;
|
|
1303
|
+
}
|
|
1289
1304
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1305
|
+
if (this.isInvertedBlind) {
|
|
1306
|
+
position = 100 - position;
|
|
1307
|
+
}
|
|
1292
1308
|
}
|
|
1309
|
+
} else {
|
|
1310
|
+
var position = 0;
|
|
1311
|
+
if (this.isPercentageBlind && message.nvalue > 1) {
|
|
1312
|
+
if (message.ReversePosition == 'true') {
|
|
1313
|
+
position = (100 - message.svalue1) * this.factor;
|
|
1314
|
+
} else {
|
|
1315
|
+
position = message.svalue1 * this.factor;
|
|
1316
|
+
}
|
|
1317
|
+
} else if ((this.swTypeVal == Constants.DeviceTypeBlindsVenetianUS || this.swTypeVal == Constants.DeviceTypeBlindsVenetianEU) && message.nvalue > 1) {
|
|
1318
|
+
position = (message.nvalue == 15 ? 100 : 0);
|
|
1319
|
+
} else {
|
|
1320
|
+
if (message.ReverseState == 'true') {
|
|
1321
|
+
position = (message.nvalue == 0 ? 100 : 0);
|
|
1322
|
+
} else {
|
|
1323
|
+
position = (message.nvalue == 1 ? 100 : 0);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1293
1326
|
}
|
|
1294
1327
|
|
|
1295
1328
|
var lastActivity = false;
|
|
@@ -1328,29 +1361,36 @@ eDomoticzAccessory.prototype = {
|
|
|
1328
1361
|
case this.swTypeVal == Constants.DeviceTypeSecuritySystem:
|
|
1329
1362
|
{
|
|
1330
1363
|
var systemState = Characteristic.SecuritySystemCurrentState.STAY_ARM;
|
|
1364
|
+
var targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1331
1365
|
switch (message.nvalue) {
|
|
1332
1366
|
case 0: //Disarm
|
|
1333
1367
|
case 1: //Normal Delay
|
|
1334
1368
|
case 13: //Disarm
|
|
1335
1369
|
systemState = Characteristic.SecuritySystemCurrentState.DISARMED;
|
|
1370
|
+
targetState = Characteristic.SecuritySystemTargetState.DISARM;
|
|
1336
1371
|
break;
|
|
1337
1372
|
case 9: //Arm Away
|
|
1338
1373
|
case 10: //Arm Away Delayed
|
|
1339
1374
|
systemState = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
|
|
1375
|
+
targetState = Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
1340
1376
|
break;
|
|
1341
1377
|
case 11: //Arm Home
|
|
1342
1378
|
case 12: //Arm Home Delayed
|
|
1343
1379
|
systemState = Characteristic.SecuritySystemCurrentState.STAY_ARM;
|
|
1380
|
+
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1344
1381
|
break;
|
|
1345
1382
|
case 6:
|
|
1346
1383
|
systemState = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
|
|
1384
|
+
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1347
1385
|
break;
|
|
1348
1386
|
default:
|
|
1349
|
-
case 2:
|
|
1387
|
+
case 2:
|
|
1388
|
+
systemState = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
|
|
1389
|
+
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1390
|
+
break;
|
|
1350
1391
|
case 3: //Alarm Delayed
|
|
1351
1392
|
case 4: //Motion
|
|
1352
1393
|
case 5: //No Motion
|
|
1353
|
-
case 6: //Panic
|
|
1354
1394
|
case 7: //Panic End
|
|
1355
1395
|
case 8:
|
|
1356
1396
|
}
|
|
@@ -1360,7 +1400,7 @@ eDomoticzAccessory.prototype = {
|
|
|
1360
1400
|
var currentStateCharacteristic = this.getCharacteristic(service, Characteristic.SecuritySystemCurrentState);
|
|
1361
1401
|
var targetStateCharacteristic = this.getCharacteristic(service, Characteristic.SecuritySystemTargetState);
|
|
1362
1402
|
callback(currentStateCharacteristic, systemState);
|
|
1363
|
-
callback(targetStateCharacteristic,
|
|
1403
|
+
callback(targetStateCharacteristic, targetState);
|
|
1364
1404
|
break;
|
|
1365
1405
|
}
|
|
1366
1406
|
|
|
@@ -1734,12 +1774,7 @@ eDomoticzAccessory.prototype = {
|
|
|
1734
1774
|
this.gracefullyAddCharacteristic(service, Characteristic.Hue).on('set', this.setHueValue.bind(this, 'Hue')).on('get', this.getHueValue.bind(this, 'Hue'));
|
|
1735
1775
|
this.gracefullyAddCharacteristic(service, Characteristic.Saturation).on('set', this.setHueValue.bind(this, 'Saturation')).on('get', this.getHueValue.bind(this, 'Saturation'));
|
|
1736
1776
|
} else if (this.subType == 'WW') {
|
|
1737
|
-
|
|
1738
|
-
//if (col == !0) {
|
|
1739
|
-
this.gracefullyAddCharacteristic(service, Characteristic.ColorTemperature).on('set', this.setColorTempValue.bind(this, 'ColorTemperature')).on('get', this.getColorTempValue.bind(this, 'ColorTemperature'));
|
|
1740
|
-
//} else {
|
|
1741
|
-
// this.platform.forceLog(this.name +' claims to be a WW light but provides no Color object. Treating as plain old Dimmer.');
|
|
1742
|
-
//}
|
|
1777
|
+
this.gracefullyAddCharacteristic(service, Characteristic.ColorTemperature).on('set', this.setColorTempValue.bind(this, 'ColorTemperature')).on('get', this.getColorTempValue.bind(this, 'ColorTemperature'));
|
|
1743
1778
|
}
|
|
1744
1779
|
}
|
|
1745
1780
|
this.services.push(service);
|
|
@@ -1781,8 +1816,8 @@ eDomoticzAccessory.prototype = {
|
|
|
1781
1816
|
this.getCharacteristic(tvService, Characteristic.RemoteKey)
|
|
1782
1817
|
.on('set', this.sendTelevisionRemoteKey.bind(this));
|
|
1783
1818
|
this.services.push(tvService);
|
|
1784
|
-
tvAccessories[this.
|
|
1785
|
-
|
|
1819
|
+
tvAccessories[this.descript] = this;
|
|
1820
|
+
|
|
1786
1821
|
// TV volume.
|
|
1787
1822
|
var tvSpeakerService = this.getService(Service.TelevisionSpeaker);
|
|
1788
1823
|
if (!tvSpeakerService) {
|
|
@@ -1797,19 +1832,19 @@ eDomoticzAccessory.prototype = {
|
|
|
1797
1832
|
.on('get', this.getTelevisionMuteState.bind(this));
|
|
1798
1833
|
tvService.addLinkedService(tvSpeakerService);
|
|
1799
1834
|
this.services.push(tvSpeakerService);
|
|
1800
|
-
|
|
1801
|
-
if (this.
|
|
1802
|
-
this.createTvInputService(tvInputAccessories[this.
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1835
|
+
|
|
1836
|
+
if (this.descript in tvInputAccessories) {
|
|
1837
|
+
this.createTvInputService(tvInputAccessories[this.descript]);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1805
1840
|
break;
|
|
1806
1841
|
}
|
|
1807
1842
|
case this.swTypeVal == Constants.DeviceTypeSelector && this.image == "TV":
|
|
1808
1843
|
{
|
|
1809
|
-
tvInputAccessories[this.
|
|
1844
|
+
tvInputAccessories[this.descript] = this;
|
|
1810
1845
|
|
|
1811
|
-
if (this.
|
|
1812
|
-
tvAccessories[this.
|
|
1846
|
+
if (this.descript in tvAccessories) {
|
|
1847
|
+
tvAccessories[this.descript].createTvInputService(this);
|
|
1813
1848
|
}
|
|
1814
1849
|
|
|
1815
1850
|
break;
|
|
@@ -1918,9 +1953,10 @@ eDomoticzAccessory.prototype = {
|
|
|
1918
1953
|
case this.swTypeVal == Constants.DeviceTypeBlindsVenetianEU:
|
|
1919
1954
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentage:
|
|
1920
1955
|
case this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted:
|
|
1956
|
+
case this.swTypeVal == Constants.DeviceTypeBlindsPlusStop:
|
|
1921
1957
|
{
|
|
1922
1958
|
this.isInvertedBlind = (this.swTypeVal == Constants.DeviceTypeBlindsInverted || this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted);
|
|
1923
|
-
this.isPercentageBlind = (this.swTypeVal == Constants.DeviceTypeBlindsPercentage || this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted);
|
|
1959
|
+
this.isPercentageBlind = (this.swTypeVal == Constants.DeviceTypeBlindsPercentage || this.swTypeVal == Constants.DeviceTypeBlindsPercentageInverted || this.swTypeVal == Constants.DeviceTypeBlindsPlusStop);
|
|
1924
1960
|
|
|
1925
1961
|
var blindService = this.getService(Service.WindowCovering);
|
|
1926
1962
|
if (!blindService) {
|
|
@@ -2242,58 +2278,59 @@ eDomoticzAccessory.prototype = {
|
|
|
2242
2278
|
},
|
|
2243
2279
|
createTvInputService: function (domoticzInputSourceAccessory) {
|
|
2244
2280
|
var tvService = this.services[1];
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
inputs.forEach((input, index) => {
|
|
2255
|
-
var inputType;
|
|
2256
|
-
switch (true) {
|
|
2257
|
-
case input.match(/^TV|Live$/i):
|
|
2258
|
-
inputType = Characteristic.InputSourceType.TUNER;
|
|
2259
|
-
break;
|
|
2260
|
-
case input.match(/hdmi/i):
|
|
2261
|
-
inputType = Characteristic.InputSourceType.HDMI;
|
|
2262
|
-
break;
|
|
2263
|
-
case input.match(/ypbpr/i):
|
|
2264
|
-
inputType = Characteristic.InputSourceType.COMPONENT_VIDEO;
|
|
2265
|
-
break;
|
|
2266
|
-
default:
|
|
2267
|
-
inputType = Characteristic.InputSourceType.APPLICATION;
|
|
2268
|
-
break;
|
|
2281
|
+
if (typeof tvService !== undefined) {
|
|
2282
|
+
Domoticz.deviceStatus(domoticzInputSourceAccessory, function (json) {
|
|
2283
|
+
var sArray = Helper.sortByKey(json.result, "Name");
|
|
2284
|
+
sArray.map(function (s) {
|
|
2285
|
+
var inputs = new Buffer(s.LevelNames, 'base64').toString("utf8").split("|");
|
|
2286
|
+
if (inputs.length > 0 && inputs[0] == "Off") {
|
|
2287
|
+
inputs.shift();
|
|
2269
2288
|
}
|
|
2270
2289
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2290
|
+
inputs.forEach((input, index) => {
|
|
2291
|
+
var inputType;
|
|
2292
|
+
switch (true) {
|
|
2293
|
+
case input.match(/^TV|Live$/i):
|
|
2294
|
+
inputType = Characteristic.InputSourceType.TUNER;
|
|
2295
|
+
break;
|
|
2296
|
+
case input.match(/hdmi/i):
|
|
2297
|
+
inputType = Characteristic.InputSourceType.HDMI;
|
|
2298
|
+
break;
|
|
2299
|
+
case input.match(/ypbpr/i):
|
|
2300
|
+
inputType = Characteristic.InputSourceType.COMPONENT_VIDEO;
|
|
2301
|
+
break;
|
|
2302
|
+
default:
|
|
2303
|
+
inputType = Characteristic.InputSourceType.APPLICATION;
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2283
2306
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2307
|
+
var inputService = this.getService(Service.InputSource, input);
|
|
2308
|
+
if (!inputService) {
|
|
2309
|
+
inputService = new Service.InputSource(input.replace(/\s/g, '').toLowerCase(), input);
|
|
2310
|
+
}
|
|
2311
|
+
inputService
|
|
2312
|
+
.setCharacteristic(Characteristic.Identifier, index + 1)
|
|
2313
|
+
.setCharacteristic(Characteristic.ConfiguredName, input)
|
|
2314
|
+
.setCharacteristic(Characteristic.IsConfigured, Characteristic.IsConfigured.CONFIGURED)
|
|
2315
|
+
.setCharacteristic(Characteristic.InputSourceType, inputType)
|
|
2316
|
+
.setCharacteristic(Characteristic.CurrentVisibilityState, Characteristic.CurrentVisibilityState.SHOWN);
|
|
2317
|
+
tvService.addLinkedService(inputService);
|
|
2318
|
+
this.services.push(inputService);
|
|
2319
|
+
|
|
2320
|
+
if(this.published) {
|
|
2321
|
+
this.publishService(inputService);
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
}.bind(this));
|
|
2288
2325
|
}.bind(this));
|
|
2289
|
-
}
|
|
2326
|
+
}
|
|
2290
2327
|
},
|
|
2291
2328
|
removed: function() { // This accessory has been removed.
|
|
2292
|
-
if (this.
|
|
2293
|
-
delete tvAccessories[this.
|
|
2329
|
+
if (this.descript in tvAccessories) {
|
|
2330
|
+
delete tvAccessories[this.descript];
|
|
2294
2331
|
}
|
|
2295
|
-
if (this.
|
|
2296
|
-
delete tvInputAccessories[this.
|
|
2332
|
+
if (this.descript in tvInputAccessories) {
|
|
2333
|
+
delete tvInputAccessories[this.descript];
|
|
2297
2334
|
}
|
|
2298
2335
|
}
|
|
2299
2336
|
};
|
package/lib/helper.js
CHANGED
|
File without changes
|
package/lib/mqtt.js
CHANGED
|
File without changes
|
package/lib/services.js
CHANGED
|
@@ -20,6 +20,7 @@ eDomoticzServices.TotalConsumption = function() {
|
|
|
20
20
|
unit: 'kWh'
|
|
21
21
|
});
|
|
22
22
|
this.value = this.getDefaultValue();
|
|
23
|
+
this.UUID = charUUID;
|
|
23
24
|
};
|
|
24
25
|
eDomoticzServices.TodayConsumption = function() {
|
|
25
26
|
var charUUID = UUID.generate('eDomoticz:customchar:TodayConsumption');
|
|
@@ -30,6 +31,7 @@ eDomoticzServices.TodayConsumption = function() {
|
|
|
30
31
|
unit: 'kWh'
|
|
31
32
|
});
|
|
32
33
|
this.value = this.getDefaultValue();
|
|
34
|
+
this.UUID = charUUID;
|
|
33
35
|
};
|
|
34
36
|
eDomoticzServices.CurrentConsumption = function() {
|
|
35
37
|
var charUUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; //UUID.generate('eDomoticz:customchar:CurrentConsumption');
|
|
@@ -40,6 +42,7 @@ eDomoticzServices.CurrentConsumption = function() {
|
|
|
40
42
|
unit: 'W'
|
|
41
43
|
});
|
|
42
44
|
this.value = this.getDefaultValue();
|
|
45
|
+
this.UUID = charUUID;
|
|
43
46
|
};
|
|
44
47
|
eDomoticzServices.Ampere = function() {
|
|
45
48
|
var charUUID = 'E863F126-079E-48FF-8F27-9C2605A29F52'; //AMPERE
|
|
@@ -50,6 +53,7 @@ eDomoticzServices.Ampere = function() {
|
|
|
50
53
|
unit: 'A'
|
|
51
54
|
});
|
|
52
55
|
this.value = this.getDefaultValue();
|
|
56
|
+
this.UUID = charUUID;
|
|
53
57
|
};
|
|
54
58
|
eDomoticzServices.Volt = function() {
|
|
55
59
|
var charUUID = 'E863F10A-079E-48FF-8F27-9C2605A29F52'; //VOLT
|
|
@@ -60,6 +64,7 @@ eDomoticzServices.Volt = function() {
|
|
|
60
64
|
unit: 'V'
|
|
61
65
|
});
|
|
62
66
|
this.value = this.getDefaultValue();
|
|
67
|
+
this.UUID = charUUID;
|
|
63
68
|
};
|
|
64
69
|
eDomoticzServices.GasConsumption = function() {
|
|
65
70
|
var charUUID = UUID.generate('eDomoticz:customchar:CurrentConsumption');
|
|
@@ -69,6 +74,7 @@ eDomoticzServices.GasConsumption = function() {
|
|
|
69
74
|
perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
|
|
70
75
|
});
|
|
71
76
|
this.value = this.getDefaultValue();
|
|
77
|
+
this.UUID = charUUID;
|
|
72
78
|
};
|
|
73
79
|
eDomoticzServices.WaterFlow = function() {
|
|
74
80
|
var charUUID = UUID.generate('eDomoticz:customchar:WaterFlow');
|
|
@@ -79,6 +85,7 @@ eDomoticzServices.WaterFlow = function() {
|
|
|
79
85
|
unit: 'm3'
|
|
80
86
|
});
|
|
81
87
|
this.value = this.getDefaultValue();
|
|
88
|
+
this.UUID = charUUID;
|
|
82
89
|
};
|
|
83
90
|
eDomoticzServices.TotalWaterFlow = function() {
|
|
84
91
|
var charUUID = UUID.generate('eDomoticz:customchar:TotalWaterFlow');
|
|
@@ -89,6 +96,7 @@ eDomoticzServices.TotalWaterFlow = function() {
|
|
|
89
96
|
unit: 'l'
|
|
90
97
|
});
|
|
91
98
|
this.value = this.getDefaultValue();
|
|
99
|
+
this.UUID = charUUID;
|
|
92
100
|
};
|
|
93
101
|
// Custom SetPoint Minutes characteristic for TempOverride modes
|
|
94
102
|
eDomoticzServices.TempOverride = function() {
|
|
@@ -103,6 +111,7 @@ eDomoticzServices.TempOverride = function() {
|
|
|
103
111
|
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
|
|
104
112
|
});
|
|
105
113
|
this.value = this.getDefaultValue();
|
|
114
|
+
this.UUID = charUUID;
|
|
106
115
|
};
|
|
107
116
|
// Ampere Meter
|
|
108
117
|
eDomoticzServices.AMPDeviceService = function(displayName, subtype) {
|
|
@@ -152,6 +161,7 @@ eDomoticzServices.CurrentUsage = function() {
|
|
|
152
161
|
minStep:0.1
|
|
153
162
|
});
|
|
154
163
|
this.value = this.getDefaultValue();
|
|
164
|
+
this.UUID = charUUID;
|
|
155
165
|
};
|
|
156
166
|
// The Usage Meter itself
|
|
157
167
|
eDomoticzServices.UsageDeviceService = function(displayName, subtype) {
|
|
@@ -168,6 +178,7 @@ eDomoticzServices.Location = function() {
|
|
|
168
178
|
perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
|
|
169
179
|
});
|
|
170
180
|
this.value = this.getDefaultValue();
|
|
181
|
+
this.UUID = charUUID;
|
|
171
182
|
};
|
|
172
183
|
eDomoticzServices.LocationService = function(displayName, subtype) {
|
|
173
184
|
var serviceUUID = UUID.generate('eDomoticz:location:customservice');
|
|
@@ -187,6 +198,7 @@ eDomoticzServices.WindSpeed = function() {
|
|
|
187
198
|
minStep:0.1
|
|
188
199
|
});
|
|
189
200
|
this.value = this.getDefaultValue();
|
|
201
|
+
this.UUID = charUUID;
|
|
190
202
|
};
|
|
191
203
|
// DarkSkies WindChill Characteristic
|
|
192
204
|
eDomoticzServices.WindChill = function() {
|
|
@@ -201,6 +213,7 @@ eDomoticzServices.WindChill = function() {
|
|
|
201
213
|
minStep:0.1
|
|
202
214
|
});
|
|
203
215
|
this.value = this.getDefaultValue();
|
|
216
|
+
this.UUID = charUUID;
|
|
204
217
|
};
|
|
205
218
|
// DarkSkies WindDirection Characteristic
|
|
206
219
|
eDomoticzServices.WindDirection = function() {
|
|
@@ -215,6 +228,7 @@ eDomoticzServices.WindDirection = function() {
|
|
|
215
228
|
minStep:1
|
|
216
229
|
});
|
|
217
230
|
this.value = this.getDefaultValue();
|
|
231
|
+
this.UUID = charUUID;
|
|
218
232
|
};
|
|
219
233
|
// DarkSkies Virtual Wind Sensor
|
|
220
234
|
eDomoticzServices.WindDeviceService = function(displayName, subtype) {
|
|
@@ -238,6 +252,7 @@ eDomoticzServices.Rainfall = function() {
|
|
|
238
252
|
minStep:0.1
|
|
239
253
|
});
|
|
240
254
|
this.value = this.getDefaultValue();
|
|
255
|
+
this.UUID = charUUID;
|
|
241
256
|
};
|
|
242
257
|
// DarkSkies Rain Meter itself
|
|
243
258
|
eDomoticzServices.RainDeviceService = function(displayName, subtype) {
|
|
@@ -258,6 +273,7 @@ eDomoticzServices.Visibility = function() {
|
|
|
258
273
|
minStep:0.1
|
|
259
274
|
});
|
|
260
275
|
this.value = this.getDefaultValue();
|
|
276
|
+
this.UUID = charUUID;
|
|
261
277
|
};
|
|
262
278
|
// DarkSkies Visibility Meter itself
|
|
263
279
|
eDomoticzServices.VisibilityDeviceService = function(displayName, subtype) {
|
|
@@ -278,6 +294,7 @@ eDomoticzServices.UVIndex = function() {
|
|
|
278
294
|
minStep:0.1
|
|
279
295
|
});
|
|
280
296
|
this.value = this.getDefaultValue();
|
|
297
|
+
this.UUID = charUUID;
|
|
281
298
|
};
|
|
282
299
|
|
|
283
300
|
// DarkSkies UV Index Meter itself
|
|
@@ -299,6 +316,7 @@ eDomoticzServices.SolRad = function() {
|
|
|
299
316
|
minStep:0.1
|
|
300
317
|
});
|
|
301
318
|
this.value = this.getDefaultValue();
|
|
319
|
+
this.UUID = charUUID;
|
|
302
320
|
};
|
|
303
321
|
// DarkSkies Solar Radiation Meter itself
|
|
304
322
|
eDomoticzServices.SolRadDeviceService = function(displayName, subtype) {
|
|
@@ -319,6 +337,7 @@ eDomoticzServices.Barometer = function() {
|
|
|
319
337
|
minStep: 0.1
|
|
320
338
|
});
|
|
321
339
|
this.value = this.getDefaultValue();
|
|
340
|
+
this.UUID = charUUID;
|
|
322
341
|
};
|
|
323
342
|
// Weather Service
|
|
324
343
|
eDomoticzServices.WeatherService = function(displayName, subtype) {
|
|
@@ -337,6 +356,7 @@ eDomoticzServices.Infotext = function() {
|
|
|
337
356
|
perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
|
|
338
357
|
});
|
|
339
358
|
this.value = this.getDefaultValue();
|
|
359
|
+
this.UUID = charUUID;
|
|
340
360
|
};
|
|
341
361
|
// DarkSkies Visibility Meter itself
|
|
342
362
|
eDomoticzServices.InfotextDeviceService = function(displayName, subtype) {
|