|
1 | | -import { inherits } from 'node:util' |
2 | | - |
3 | 1 | export default class { |
4 | 2 | constructor(api) { |
5 | | - this.hapServ = api.hap.Service |
6 | | - this.hapChar = api.hap.Characteristic |
7 | 3 | this.uuids = { |
8 | 4 | invertSwitch: 'E965F001-079E-48FF-8F27-9C2605A29F52', |
9 | 5 | festiveScene: 'E965F002-079E-48FF-8F27-9C2605A29F52', |
10 | 6 | } |
11 | | - const self = this |
12 | | - this.InvertSwitch = function InvertSwitch() { |
13 | | - self.hapChar.call(this, 'Invert Switch', self.uuids.invertSwitch) |
14 | | - this.setProps({ |
15 | | - format: api.hap.Formats.BOOL, |
16 | | - perms: [api.hap.Perms.PAIRED_READ, api.hap.Perms.PAIRED_WRITE, api.hap.Perms.NOTIFY], |
17 | | - }) |
18 | | - this.value = this.getDefaultValue() |
| 7 | + |
| 8 | + const uuids = this.uuids |
| 9 | + |
| 10 | + this.InvertSwitch = class extends api.hap.Characteristic { |
| 11 | + constructor() { |
| 12 | + super('Invert Switch', uuids.invertSwitch) |
| 13 | + this.setProps({ |
| 14 | + format: api.hap.Formats.BOOL, |
| 15 | + perms: [api.hap.Perms.PAIRED_READ, api.hap.Perms.PAIRED_WRITE, api.hap.Perms.NOTIFY], |
| 16 | + }) |
| 17 | + this.value = this.getDefaultValue() |
| 18 | + } |
19 | 19 | } |
20 | | - this.FestiveScene = function FestiveScene() { |
21 | | - self.hapChar.call(this, 'Festive Scene', self.uuids.festiveScene) |
22 | | - this.setProps({ |
23 | | - format: api.hap.Formats.BOOL, |
24 | | - perms: [api.hap.Perms.PAIRED_READ, api.hap.Perms.PAIRED_WRITE, api.hap.Perms.NOTIFY], |
25 | | - }) |
26 | | - this.value = this.getDefaultValue() |
| 20 | + |
| 21 | + this.FestiveScene = class extends api.hap.Characteristic { |
| 22 | + constructor() { |
| 23 | + super('Festive Scene', uuids.festiveScene) |
| 24 | + this.setProps({ |
| 25 | + format: api.hap.Formats.BOOL, |
| 26 | + perms: [api.hap.Perms.PAIRED_READ, api.hap.Perms.PAIRED_WRITE, api.hap.Perms.NOTIFY], |
| 27 | + }) |
| 28 | + this.value = this.getDefaultValue() |
| 29 | + } |
27 | 30 | } |
28 | | - inherits(this.InvertSwitch, this.hapChar) |
29 | | - inherits(this.FestiveScene, this.hapChar) |
| 31 | + |
30 | 32 | this.InvertSwitch.UUID = this.uuids.invertSwitch |
31 | 33 | this.FestiveScene.UUID = this.uuids.festiveScene |
32 | 34 | } |
|
0 commit comments