-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
32 lines (24 loc) · 825 Bytes
/
index.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
const hap = require("hap-nodejs")
const [Accessory, Service, Characteristic, Categories] = [
hap.Accessory,
hap.Service,
hap.Characteristic,
hap.Categories
]
const pluginSource = require("./plugin")
const accessoryId = hap.uuid.generate(pluginSource.mac)
const accessory = new Accessory("IPCamera", accessoryId)
const cameraSource = require("./camera")
cameraSource.configureController(accessory)
accessory
.getService(Service.AccessoryInformation)
.setCharacteristic(Characteristic.Manufacturer, "Manufacturer")
.setCharacteristic(Characteristic.Model, "Model")
.setCharacteristic(Characteristic.SerialNumber, "SerialNumber")
const configuration = {
username: pluginSource.mac,
pincode: pluginSource.pin,
category: Categories.IP_CAMERA
}
accessory.publish(configuration)
console.log("running")