Skip to content

Commit

Permalink
Merge pull request #21 from danieljtribe/hotfix/custom-device-validation
Browse files Browse the repository at this point in the history
Hotfix/custom device validation
  • Loading branch information
danieljtribe authored Sep 12, 2024
2 parents 3e36814 + f6d4a2f commit bf6e69b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": false,
"displayName": "Homebridge Agile Octopus Rates",
"name": "homebridge-agile-octopus-rates",
"version": "1.2.4",
"version": "1.2.5",
"description": "A simple plugin to publish switches to Homebridge, which can toggle on during the cleapest 30 minute, 60 minute etc... time periods.",
"license": "Apache-2.0",
"homepage": "https://github.com/danieljtribe/homebridge-agile-octopus",
Expand Down
4 changes: 4 additions & 0 deletions src/platformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class AgileOctopusAccessory {
if(!this.config.disableSwitches) {
if(this.config.customDevices) {
this.config.customDevices.forEach((customDevice: CustomDevice) => {
if(!customDevice.name || !customDevice.startTime || !customDevice.endTime || !customDevice.hours) {
this.platform.log.warn("Custom device not added, please check that a name, start time and end time have been defined");
return;
}
this.customDevices.push(customDevice);
const startTime = Number(customDevice.startTime?.substring(0, 2) || 0);
const endTime = Number(customDevice.endTime?.substring(0, 2) || 0);
Expand Down

0 comments on commit bf6e69b

Please sign in to comment.