Skip to content

Commit

Permalink
Update P1Accessory.js
Browse files Browse the repository at this point in the history
- Add accessory for Capacity tariff, see #69.
  • Loading branch information
ebaauw committed Feb 12, 2023
1 parent 66cb7ca commit f923ec1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/P1Accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class P1Accessory extends homebridgeLib.AccessoryDelegate {
}

static get Electricity () { return Electricity }
static get ElectricityCapacity () { return ElectricityCapacity }
static get Gas () { return Gas }
static get Water () { return Water }
}
Expand Down Expand Up @@ -60,6 +61,22 @@ class Electricity extends P1Accessory {
}
}

class ElectricityCapacity extends P1Accessory {
constructor (platform, data, name = 'Electricity Capacity') {
data.id += 'C'
super(platform, name, data)
this.service = new P1Service.ElectricityCapacity(this, data)
this.historyService = new homebridgeLib.ServiceDelegate.History(
this, {
averagePowerDelegate: this.service.characteristicDelegate('power')
}
)
if (!this.platform.config.outlet) {
this.dummyService = new homebridgeLib.ServiceDelegate.Dummy(this)
}
}
}

class Gas extends P1Accessory {
constructor (platform, data) {
super(platform, 'Gas', data)
Expand Down

0 comments on commit f923ec1

Please sign in to comment.