forked from christian-fei/homebridge-image-to-camera
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CameraAccessory.js
30 lines (24 loc) · 1.14 KB
/
CameraAccessory.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
const packageJSON = require('./package.json')
const CameraSource = require('./CameraSource')
module.exports = (hap, Accessory, log) => class CameraAccessory extends Accessory {
constructor(conf) {
conf = conf || {}
var name = conf.name || 'Image to Camera'
var id = conf.id || name
var uuid = hap.uuid.generate('homebridge-image-to-camera:' + id)
//log('setup camera accessory', JSON.stringify(hap.Accessory.Categories))
super(name, uuid, hap.Accessory.Categories.CAMERA)
log('setup camera accessory')
this.getService(hap.Service.AccessoryInformation)
.setCharacteristic(hap.Characteristic.Manufacturer, 'Christian')
.setCharacteristic(hap.Characteristic.Model, 'Camera')
.setCharacteristic(hap.Characteristic.SerialNumber, '42')
.setCharacteristic(hap.Characteristic.FirmwareRevision, packageJSON.version)
this.on('identify', function (paired, callback) {
log('identify')
callback()
})
log('configure camera source')
this.configureCameraSource(new CameraSource(hap, conf, log))
}
}