Skip to content

Commit

Permalink
Fix history
Browse files Browse the repository at this point in the history
  • Loading branch information
stickpin committed Dec 21, 2019
1 parent 9182a97 commit 2239f5f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,65 @@ function PeopleAccessory(log, config, platform) {
}
}

class TimesOpenedCharacteristic extends Characteristic {
constructor(accessory) {
super('TimesOpened', 'E863F129-079E-48FF-8F27-9C2605A29F52');
this.setProps({
format: Characteristic.Formats.UINT32,
unit: Characteristic.Units.SECONDS,
perms: [
Characteristic.Perms.READ,
Characteristic.Perms.NOTIFY
]
});
}
}

class ResetTotalCharacteristic extends Characteristic {
constructor(accessory) {
super('ResetTotal', 'E863F112-079E-48FF-8F27-9C2605A29F52');
this.setProps({
format: Characteristic.Formats.UINT32,
unit: Characteristic.Units.SECONDS,
perms: [
Characteristic.Perms.READ,
Characteristic.Perms.NOTIFY,
Characteristic.Perms.WRITE
]
});
}
}

class Char118Characteristic extends Characteristic {
constructor(accessory) {
super('Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52');
this.setProps({
format: Characteristic.Formats.UINT32,
unit: Characteristic.Units.SECONDS,
perms: [
Characteristic.Perms.READ,
Characteristic.Perms.NOTIFY,
Characteristic.Perms.WRITE
]
});
}
}

class Char119Characteristic extends Characteristic {
constructor(accessory) {
super('Char119', 'E863F119-079E-48FF-8F27-9C2605A29F52');
this.setProps({
format: Characteristic.Formats.UINT32,
unit: Characteristic.Units.SECONDS,
perms: [
Characteristic.Perms.READ,
Characteristic.Perms.NOTIFY,
Characteristic.Perms.WRITE
]
});
}
}

this.service = new Service.ContactSensor(this.name);
this.service
.getCharacteristic(Characteristic.ContactSensorState)
Expand All @@ -81,6 +140,10 @@ function PeopleAccessory(log, config, platform) {
.getCharacteristic(LastActivationCharacteristic)
.on('get', this.getLastActivation.bind(this));

this.service.addOptionalCharacteristic(TimesOpenedCharacteristic);
this.service.addCharacteristic(Char118Characteristic);
this.service.addCharacteristic(Char119Characteristic);

this.accessoryService = new Service.AccessoryInformation;
this.accessoryService
.setCharacteristic(Characteristic.Name, this.name)
Expand All @@ -96,6 +159,8 @@ function PeopleAccessory(log, config, platform) {
disableTimer: true
});

this.historyService.addCharacteristic(ResetTotalCharacteristic);

this.setDefaults();

if(this.checkInterval >= 10000) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-people-arp",
"version": "0.1.0",
"version": "0.1.1",
"description": "Homebridge plugin that provides details of who is in a Home + History (powered by fakegato) based on IP and MAC Address",
"keywords": [
"homebridge-plugin"
Expand Down

0 comments on commit 2239f5f

Please sign in to comment.