-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.js
75 lines (66 loc) · 2.41 KB
/
types.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
72
73
74
75
var inherits = require('util').inherits;
var Service, Characteristic;
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
UUID = homebridge.hap.uuid;
var EnterpriseTypes = {};
// Characteristics
EnterpriseTypes.InputVoltageAC = function() {
var serviceUUID = UUID.generate('EnterpriseTypes:usagedevice:InputVoltageAC');
Characteristic.call(this, 'Input Voltage AC', serviceUUID);
this.setProps({
format: Characteristic.Formats.Float,
unit: "V",
minValue: 0,
maxValue: 65535,
minStep: .01,
perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY ]
});
this.value = this.getDefaultValue();
};
inherits(EnterpriseTypes.InputVoltageAC, Characteristic);
EnterpriseTypes.OutputVoltageAC = function() {
var serviceUUID = UUID.generate('EnterpriseTypes:usagedevice:OutputVoltageAC');
Characteristic.call(this, 'Output Voltage AC', serviceUUID);
this.setProps({
format: Characteristic.Formats.Float,
unit: "V",
minValue: 0,
maxValue: 65535,
minStep: .01,
perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY ]
});
this.value = this.getDefaultValue();
};
inherits(EnterpriseTypes.OutputVoltageAC, Characteristic);
EnterpriseTypes.BatteryVoltageDC = function() {
var serviceUUID = UUID.generate('EnterpriseTypes:usagedevice:BatteryVoltageDC');
Characteristic.call(this, 'Battery Voltage DC', serviceUUID);
this.setProps({
format: Characteristic.Formats.Float,
unit: "V",
minValue: 0,
maxValue: 65535,
minStep: .01,
perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY ]
});
this.value = this.getDefaultValue();
};
inherits(EnterpriseTypes.BatteryVoltageDC, Characteristic);
EnterpriseTypes.UPSLoadPercent = function() {
var serviceUUID = UUID.generate('EnterpriseTypes:usagedevice:UPSLoadPercent');
Characteristic.call(this, 'UPS Load', serviceUUID);
this.setProps({
format: Characteristic.Formats.UINT8,
unit: Characteristic.Units.PERCENTAGE,
minValue: 0,
maxValue: 100,
minStep: 1,
perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY ]
});
this.value = this.getDefaultValue();
};
inherits(EnterpriseTypes.UPSLoadPercent, Characteristic);
return EnterpriseTypes;
};