Skip to content

Commit

Permalink
Fix for managing thermostat
Browse files Browse the repository at this point in the history
  • Loading branch information
hpruszyn committed Nov 12, 2022
1 parent 1570c81 commit 3e8dd6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/accessories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ accessoriesConfiguration:
coolOffsetParamId: 48739
temperatureParamId: 40008
heatPompParamId: 43437
calculatedCoolingTemperatureParamId: 44270
calculatedHeatingTemperatureParamId: 43009
type: heatingcooling
outdoorTemperatureParamId: 40004
coolingStartTemperatureParamId: 47374
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-nibe",
"displayName": "Homebridge Nibe",
"version": "1.2.1",
"version": "1.2.2",
"description": "Homebridge plugin for Nibe services",
"author": "Hubert Pruszynski <[email protected]>",
"license": "MIT",
Expand Down
8 changes: 6 additions & 2 deletions src/nibe/provider/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class ThermostatProps extends HeatMediumFlowMapper {
const temp = parameters.get(isCooling ? providerParameters.calculatedCoolingTemperatureParamId : providerParameters.calculatedHeatingTemperatureParamId);

if (temp && temp.value !== undefined && offset && offset.value !== undefined) {
const x = Math.round(offset.value + temp.value);
const x = Math.round(temp.value - offset.value);
this.thermostatPropsOption = !this.thermostatPropsOption; // workaround for refresh props
return this.thermostatPropsOption ?
{
Expand All @@ -191,10 +191,14 @@ class ThermostatOffset extends HeatMediumFlowMapper {
const outdoorTemp = parameters.get(providerParameters.outdoorTemperatureParamId);
const coolingStartTemp = parameters.get(providerParameters.coolingStartTemperatureParamId);
const isCooling = value === 2 || (outdoorTemp && coolingStartTemp && outdoorTemp.rawValue > coolingStartTemp.rawValue);
const temp = parameters.get(isCooling ? providerParameters.calculatedCoolingTemperatureParamId : providerParameters.calculatedHeatingTemperatureParamId);
const offsetParamId = isCooling ? providerParameters.coolOffsetParamId : providerParameters.heatOffsetParamId;

const manageParameters = {};
manageParameters[offsetParamId] = providerParameters.newValue;

if (temp && temp.value !== undefined) {
manageParameters[offsetParamId] = providerParameters.newValue - Math.round(temp.value);
}

return manageParameters;
}
Expand Down

0 comments on commit 3e8dd6e

Please sign in to comment.