Skip to content

Commit

Permalink
feat: pollInterval setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper-seinhorst committed Mar 3, 2024
1 parent 57a40fc commit 8f96bae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ To install the *Homebridge Homewizard Power Consumption* plugin follow these ste
```
{
"platform": "HomewizardPowerConsumption",
"ip": "<<IP of your P1>>"
"ip": "<<IP of your P1>>",
"pollInterval": 60
}
```
Expand Down
8 changes: 8 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"type": "string",
"required": true,
"default": ""
},
"pollInterval": {
"title": "Poll interval (in seconds)",
"type": "number",
"required": true,
"default": 60,
"minimum": 5,
"maximum": 3600
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge Homewizard Power Consumption",
"name": "homebridge-homewizard-power-consumption",
"version": "1.0.0",
"version": "1.1.0",
"description": "See current power consumption or power return in Homekit",
"license": "Apache-2.0",
"author": "Jasper Seinhorst",
Expand Down
3 changes: 2 additions & 1 deletion src/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export class HomewizardPowerConsumption implements DynamicPlatformPlugin {
public readonly Service: typeof Service = this.api.hap.Service;
public readonly Characteristic: typeof Characteristic = this.api.hap.Characteristic;
public readonly accessories: PlatformAccessory[] = [];
private readonly heartBeatInterval = 60 * 1000; // every minute
private heartBeatInterval: number;
private devices: HomewizardPowerConsumptionAccessory[] = [];


constructor(public readonly log: Logger, public readonly config: PlatformConfig, public readonly api: API) {
this.heartBeatInterval = (config.pollInterval || 60) * 1000;
this.api.on('didFinishLaunching', () => {
this.initialise();
});
Expand Down

0 comments on commit 8f96bae

Please sign in to comment.