Skip to content

Commit

Permalink
Merge pull request #6 from jxg81/5-api-returned-bad-data-issues
Browse files Browse the repository at this point in the history
Adjust schema mandatory items
Allow configuration of max/min temp thresholds
  • Loading branch information
jxg81 committed Oct 24, 2022
2 parents c652980 + 7e7812f commit b8ea1dc
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 73 deletions.
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ This is an 'almost' feature complete implementation of the Que platfrom in HomeK
- Report battery level on zone sensors and get low battery alerts in the home app
- Support for homebridge config UI

Fixes/Improvements in version 1.2.4
- Improved support for variations in API data returned for differing models of Que systems
- Added option to override the defualt heating/cooling threshold temperatures via plugin configuration

Fixes/Improvements in version 1.2.3
- Resolve intermitent crash on device status refresh -> `https://github.com/jxg81/homebridge-actron-que/issues/3`
- Implemented JSON Typedef schema validation for all Que API responses, see [Schema Validation Errors](#schema-validation-errors)
Expand Down Expand Up @@ -96,7 +100,11 @@ If you are not using the Humbridge config UI you can add the following to your h
            "zonesFollowMaster": true | false,
            "zonesPushMaster": true | false,
"refreshInterval": 60,
"deviceSerial": ""
"deviceSerial": "",
"maxCoolingTemp": 32,
"minCoolingTemp": 20,
"maxHeatingTemp": 26,
"minHeatingTemp": 10,
        }]
```

Expand Down Expand Up @@ -162,13 +170,56 @@ default: true
Setting this to true will make it so that chnages to the zone temprature setting in homekit will push the master unit threshold temps for heat and cool if required. There is a +/- 2 degree variation permitted between the master temp and zone temps. Normally the Que native controls will restrict you to this temp range unless you manually adjust the master temp first. This option simply pushes the master temp to a new setting if you set the zone outside of the variance. Setting this to true has greatly increased my familys satisfaction with the controls.

#### `deviceSerial`

type: string (lowercase)

default: ""

In most cases you can exclude this option or leave it blank. If you only have a single air con system in your Que account the plugin will auto-discover the target device serial number. If you have multiple Que systems in your account you will need to specify which system you want to control by entering the serail number here. You can get your device serail numbers by logging in to que.actronair.com.au and looking at the list of authorised devices.

#### `maxCoolingTemp`

type: number

Unit: celsius

default: 32

Highest temp that the cooling mode can be set. Refer to you Que system settings for the correct value.
This setting is optional and only needs to be set if the defaults do not align with your system configuration.

#### `minCoolingTemp`

type: number

Unit: celsius

default: 20

Lowest temp that the cooling mode can be set. Refer to you Que system settings for the correct value.
This setting is optional and only needs to be set if the defaults do not align with your system configuration.

#### `maxHeatingTemp`

type: number

Unit: celsius

default: 26

Highest temp that the heating mode can be set. Refer to you Que system settings for the correct value.
This setting is optional and only needs to be set if the defaults do not align with your system configuration.

#### `minHeatingTemp`

type: number

Unit: celsius

default: 10

Lowest temp that the heating mode can be set. Refer to you Que system settings for the correct value.
This setting is optional and only needs to be set if the defaults do not align with your system configuration.
### HTTP Error Handling

The plugin has been designed to manage the following HTTP error states
Expand Down
163 changes: 104 additions & 59 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,108 @@
{
"pluginAlias": "ActronQue",
"pluginType": "platform",
"singular": true,
"schema": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string",
"required": true,
"default": "ActronQue"
},
"username": {
"title": "Que Account Username",
"type": "string",
"required": true,
"placeholder": "[email protected]"
},
"password": {
"title": "Que Account Password",
"type": "string",
"required": true,
"placeholder": "password"
},
"zonesFollowMaster": {
"title": " Set ALL Zones to Master Temp on Master Temp Change",
"description": "Sets 'Control All Zones' for master temp changes. Recommended to leave this setting on.",
"type": "boolean",
"required": false,
"default": true
},
"zonesPushMaster": {
"title": " Adjust Master Temp if Zone Set Outside of Permitted Thresholds",
"description": "If zone is set outside of allowed +/- 2 degree variance then push the master temp to allow setting",
"type": "boolean",
"required": false,
"default": true
},
"clientName": {
"title": "Client Name",
"description": "Used to register plugin on Que Cloud as an 'Authorised Device' & default HomeKit name.",
"type": "string",
"required": true,
"default": "homebridgeQue"
},
"refreshInterval": {
"title": "Periodic Refresh Interval",
"description": "Time in seconds to refresh device state information from Que API and in HomeKit.",
"type": "integer",
"required": false,
"default": 60
},
"deviceSerial": {
"title": "Que System Serial Number",
"description": "Only required if you have multiple systems in your Que cloud account.",
"type": "string",
"required": false,
"placeholder": "Leave Blank If You Have A Single Que System - Plugin Will Auto Discover"
"pluginAlias": "ActronQue",
"pluginType": "platform",
"singular": true,
"schema": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string",
"required": true,
"default": "ActronQue"
},
"username": {
"title": "Que Account Username",
"type": "string",
"required": true,
"placeholder": "[email protected]"
},
"password": {
"title": "Que Account Password",
"type": "string",
"required": true,
"placeholder": "password"
},
"zonesFollowMaster": {
"title": " Set ALL Zones to Master Temp on Master Temp Change",
"description": "Sets 'Control All Zones' for master temp changes. Recommended to leave this setting on.",
"type": "boolean",
"required": false,
"default": true
},
"zonesPushMaster": {
"title": " Adjust Master Temp if Zone Set Outside of Permitted Thresholds",
"description": "If zone is set outside of allowed +/- 2 degree variance then push the master temp to allow setting",
"type": "boolean",
"required": false,
"default": true
},
"clientName": {
"title": "Client Name",
"description": "Used to register plugin on Que Cloud as an 'Authorised Device' & default HomeKit name.",
"type": "string",
"required": true,
"default": "homebridgeQue"
},
"refreshInterval": {
"title": "Periodic Refresh Interval",
"description": "Time in seconds to refresh device state information from Que API and in HomeKit.",
"type": "integer",
"required": false,
"default": 60
},
"deviceSerial": {
"title": "Que System Serial Number",
"description": "Only required if you have multiple systems in your Que cloud account.",
"type": "string",
"required": false,
"placeholder": "Leave Blank If You Have A Single Que System - Plugin Will Auto Discover"
},
"adjustThresholds": {
"title": " Modify default heating cooling threshold temperatures",
"description": "Cooling default min/max = 20/32. Heating default min/max = 10/26",
"type": "boolean"
},
"maxCoolingTemp": {
"title": "Maximum Cooling Temp",
"description": "Maximum temp setting for cooling in degrees celsius",
"type": "integer",
"required": false,
"default": 32,
"condition": {
"functionBody": "return model.adjustThresholds === true;"
}
},
"minCoolingTemp": {
"title": "Minimum Cooling Temp",
"description": "Minimum temp setting for cooling in degrees celsius",
"type": "integer",
"required": false,
"default": 20,
"condition": {
"functionBody": "return model.adjustThresholds === true;"
}
},
"maxHeatingTemp": {
"title": "Maximum Heating Temp",
"description": "Maximum temp setting for heating in degrees celsius",
"type": "integer",
"required": false,
"default": 26,
"condition": {
"functionBody": "return model.adjustThresholds === true;"
}
},
"minHeatingTemp": {
"title": "Minimum Heating Temp",
"description": "Minimum temp setting for hetaing in degrees celsius",
"type": "integer",
"required": false,
"default": 10,
"condition": {
"functionBody": "return model.adjustThresholds === true;"
}
}
}
}
}
}
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
Expand Up @@ -2,7 +2,7 @@
"private": false,
"displayName": "Homebridge Actron Que",
"name": "homebridge-actron-que",
"version": "1.2.3",
"version": "1.2.4",
"description": "Homebridge plugin for controlling Actron Que controller systems",
"license": "Apache-2.0",
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions src/masterControllerAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class MasterControllerAccessory {
// The min/max values here are based on the hardcoded data taken from my unit
this.hvacService.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
.setProps({
minValue: 10,
maxValue: 26,
minValue: this.platform.minHeatingTemp,
maxValue: this.platform.maxHeatingTemp,
minStep: 0.5,
})
.onGet(this.getHeatingThresholdTemperature.bind(this))
Expand All @@ -60,8 +60,8 @@ export class MasterControllerAccessory {
// The min/max values here are based on the hardcoded data taken from my unit
this.hvacService.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
.setProps({
minValue: 20,
maxValue: 32,
minValue: this.platform.minCoolingTemp,
maxValue: this.platform.maxCoolingTemp,
minStep: 0.5,
})
.onGet(this.getCoolingThresholdTemperature.bind(this))
Expand Down
28 changes: 28 additions & 0 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class ActronQuePlatform implements DynamicPlatformPlugin {
readonly zonesPushMaster: boolean = true;
readonly hardRefreshInterval: number = 60000;
readonly softRefreshInterval: number = 5000;
readonly maxCoolingTemp: number = 32;
readonly minCoolingTemp: number = 20;
readonly maxHeatingTemp: number = 26;
readonly minHeatingTemp: number = 10;
hvacInstance!: HvacUnit;

constructor(
Expand Down Expand Up @@ -56,6 +60,30 @@ export class ActronQuePlatform implements DynamicPlatformPlugin {
} else {
this.hardRefreshInterval = 60000;
}
if (config['maxCoolingTemp']) {
this.maxCoolingTemp = config['maxCoolingTemp'];
this.log.debug('Cooling threshold max set to', this.maxCoolingTemp);
} else {
this.maxCoolingTemp = 32;
}
if (config['minCoolingTemp']) {
this.minCoolingTemp = config['minCoolingTemp'];
this.log.debug('Cooling threshold min set to', this.minCoolingTemp);
} else {
this.minCoolingTemp = 20;
}
if (config['maxHeatingTemp']) {
this.maxHeatingTemp = config['maxHeatingTemp'];
this.log.debug('Heating threshold max set to', this.maxHeatingTemp);
} else {
this.maxHeatingTemp = 26;
}
if (config['minHeatingTemp']) {
this.minHeatingTemp = config['minHeatingTemp'];
this.log.debug('Heating threshold min set to', this.minHeatingTemp);
} else {
this.minHeatingTemp = 10;
}

// Check Required Config Fields
if (!this.username) {
Expand Down
6 changes: 4 additions & 2 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const SystemStatusSchema: Schema = {
type: 'string',
},
OutdoorUnit: {
properties: {
optionalProperties: {
AmbTemp: {
type: 'float64',
},
Expand Down Expand Up @@ -114,10 +114,12 @@ export const SystemStatusSchema: Schema = {
},
RemoteZoneInfo: {
elements: {
properties: {
optionalProperties: {
CanOperate: {
type: 'boolean',
},
},
properties: {
LiveTemp_oC: {
type: 'float64',
},
Expand Down
8 changes: 4 additions & 4 deletions src/zoneControllerAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export class ZoneControllerAccessory {
// The min/max values here are based on the hardcoded data taken from my unit
this.hvacService.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
.setProps({
minValue: 10,
maxValue: 26,
minValue: this.platform.minHeatingTemp,
maxValue: this.platform.maxHeatingTemp,
minStep: 0.5,
})
.onGet(this.getHeatingThresholdTemperature.bind(this))
Expand All @@ -80,8 +80,8 @@ export class ZoneControllerAccessory {
// The min/max values here are based on the hardcoded data taken from my unit
this.hvacService.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
.setProps({
minValue: 20,
maxValue: 32,
minValue: this.platform.minCoolingTemp,
maxValue: this.platform.maxCoolingTemp,
minStep: 0.5,
})
.onGet(this.getCoolingThresholdTemperature.bind(this))
Expand Down

0 comments on commit b8ea1dc

Please sign in to comment.