-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathHomeKitTVTypes.js
41 lines (33 loc) · 1.3 KB
/
HomeKitTVTypes.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
var inherits = require('util').inherits;
var Service, Characteristic;
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
var HomeKitTVTypes = {};
// Characteristics
HomeKitTVTypes.ChannelState = function() {
Characteristic.call(this, 'Channel', HomeKitTVTypes.ChannelState.UUID);
this.setProps({
format: Characteristic.Formats.UINT8,
//unit: Characteristic.Units.PERCENTAGE,
maxValue: 9,
minValue: 1,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
});
this.value = this.getDefaultValue();
};
HomeKitTVTypes.ChannelState.UUID = '00001001-0000-1000-8000-12B419A49076';
inherits(HomeKitTVTypes.ChannelState, Characteristic);
// Services
HomeKitTVTypes.ChannelService = function(displayName, subtype) {
Service.call(this, displayName, HomeKitTVTypes.ChannelService.UUID, subtype);
// Required Characteristics
this.addCharacteristic(HomeKitTVTypes.ChannelState);
// Optional Characteristics
this.addOptionalCharacteristic(Characteristic.Name);
};
HomeKitTVTypes.ChannelService.UUID = '00000001-0000-1000-8000-125B69CC4301';
inherits(HomeKitTVTypes.ChannelService, Service);
return HomeKitTVTypes;
};