generated from homebridge/homebridge-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor WIP
- Loading branch information
Showing
12 changed files
with
551 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/custom-characteristics/resetConsumptionCharacteristic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Characteristic, Units, Formats, WithUUID, Perms} from 'homebridge'; | ||
|
||
export default function resetConsumption( | ||
DefaultCharacteristic: typeof Characteristic, | ||
): WithUUID<new () => Characteristic> { | ||
return class ResetConsumptionCharacteristic extends DefaultCharacteristic { | ||
static readonly UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; | ||
|
||
constructor() { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: unable to override class constructor parameters as its a type and not a value | ||
super('Reset Total', ResetConsumptionCharacteristic.UUID, { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: custom unit | ||
format: Formats.UINT32, | ||
unit: Units.SECONDS, | ||
perms: [Perms.PAIRED_READ, Perms.NOTIFY, Perms.PAIRED_WRITE], | ||
}); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.