Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-panasonic-heat-pump

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-panasonic-heat-pump - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

1

dist/panasonicApi.d.ts

@@ -23,2 +23,3 @@ export declare enum PanasonicSpecialStatus {

setZoneOperationStatus(deviceId: string, isOn: boolean, retried?: boolean): any;
setZoneTemp(deviceId: string, temp: number, type: 'cool' | 'heat' | 'eco' | 'comfort', retried?: boolean): any;
setOperationStatus(deviceId: string, isOn: boolean, retried?: boolean): any;

@@ -25,0 +26,0 @@ setTankStatus(deviceId: string, isOn: boolean, retried?: boolean): any;

@@ -209,2 +209,30 @@ "use strict";

}
async setZoneTemp(deviceId, temp, type, retried = false) {
await this.ensureAuthenticated();
const response = await (0, axios_1.default)({
'method': 'POST',
'url': `https://aquarea-smart.panasonic.com/remote/v1/api/devices/${deviceId}`,
'headers': {
'Content-Type': 'application/json',
'Cookie': `accessToken=${this.accessToken}; selectedDeviceId=${deviceId};`,
'Origin': 'https://aquarea-smart.panasonic.com',
'Referer': 'https://aquarea-smart.panasonic.com/remote/a2wStatusDisplay',
},
'data': JSON.stringify({
'status': [
{
'deviceGuid': deviceId,
'zoneStatus': [{ zoneId: 1, [`${type}Set`]: temp }],
},
],
}),
});
if (response.status === 403) {
if (retried) {
throw new Error('Cannot authenticate');
}
await this.ensureAuthenticated(true);
return this.setZoneTemp(deviceId, temp, type, true);
}
}
async setOperationStatus(deviceId, isOn, retried = false) {

@@ -211,0 +239,0 @@ await this.ensureAuthenticated();

@@ -37,2 +37,3 @@ import { PlatformAccessory } from 'homebridge';

targetTempMax: any;
tempType: "cool" | "heat" | "eco" | "comfort";
}>;

@@ -39,0 +40,0 @@ updateReadings(): Promise<void>;

106

dist/platformAccessory.js

@@ -19,3 +19,3 @@ "use strict";

.setCharacteristic(this.platform.Characteristic.Model, 'Aquarea')
.setCharacteristic(this.platform.Characteristic.SerialNumber, 'n/a');
.setCharacteristic(this.platform.Characteristic.SerialNumber, this.accessory.context.device.uniqueId);
// FLOOR

@@ -51,2 +51,10 @@ this.service = this.accessory.getService('Floor Heating')

}).onGet(async () => (await this.getReadings()).targetHeatingCoolingState);
this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
.onSet(async (temp) => {
const readings = await this.getReadings();
this.panasonicApi.setZoneTemp(this.accessory.context.device.uniqueId, temp - readings.temperatureNow, readings.temperatureNow);
}).onGet(async () => {
const readings = await this.getReadings();
return readings.targetTempSet + readings.temperatureNow;
});
// Water

@@ -121,2 +129,3 @@ this.tankService = this.accessory.getService('Water')

});
this.updateReadings();
}

@@ -192,36 +201,16 @@ async getReadings(force = false) {

})();
const { targetTempSet, targetTempMin, targetTempMax } = (() => {
const tempType = (() => {
if (ecoModeIsActive) {
return {
targetTempSet: operationalZone.ecoSet,
targetTempMin: operationalZone.ecoMin,
targetTempMax: operationalZone.ecoMax,
};
return 'eco';
}
if (comfortModeIsActive) {
return {
targetTempSet: operationalZone.comfortSet,
targetTempMin: operationalZone.comfortMin,
targetTempMax: operationalZone.comfortMax,
};
return 'comfort';
}
if (operationMode === 1 || operationMode === 3) {
return {
targetTempSet: operationalZone.heatSet,
targetTempMin: operationalZone.heatMin,
targetTempMax: operationalZone.heatMax,
};
return 'heat';
}
if (operationMode === 2 || operationMode === 4) {
return {
targetTempSet: operationalZone.coolSet,
targetTempMin: operationalZone.coolMin,
targetTempMax: operationalZone.coolMax,
};
return 'cool';
}
return {
targetTempSet: 0,
targetTempMin: 0,
targetTempMax: 0,
};
return 'heat';
})();

@@ -242,5 +231,6 @@ return {

tankTemperatureMin: details.tankStatus[0].heatMin,
targetTempSet,
targetTempMin,
targetTempMax,
targetTempSet: operationalZone[`${tempType}Set`],
targetTempMin: operationalZone[`${tempType}Min`],
targetTempMax: operationalZone[`${tempType}Max`],
tempType,
};

@@ -253,28 +243,32 @@ };

async updateReadings() {
const { outdoorTemperatureNow, temperatureNow, tankTemperatureNow, tankTemperatureSet, tankHeatingCoolingState, isActive, ecoModeIsActive, comfortModeIsActive, tankTemperatureMax, tankTemperatureMin, tankTargetHeatingCoolingState, heatingCoolingState, targetHeatingCoolingState, targetTempSet, targetTempMax, targetTempMin, } = await this.getReadings(true);
this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(temperatureNow);
this.service.getCharacteristic(this.platform.Characteristic.Active).updateValue(isActive);
this.service.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState).updateValue(heatingCoolingState);
this.service.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState).updateValue(targetHeatingCoolingState);
this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature).setProps({
minValue: targetTempMin,
maxValue: targetTempMax,
minStep: 1,
}).updateValue(targetTempSet);
this.outdoorTemperatureService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(outdoorTemperatureNow);
this.outdoorTemperatureService.getCharacteristic(this.platform.Characteristic.StatusActive).updateValue(true);
this.tankService.getCharacteristic(this.platform.Characteristic.TargetTemperature).setProps({
minValue: tankTemperatureMin,
maxValue: tankTemperatureMax,
minStep: 1,
});
this.tankService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(tankTemperatureNow);
this.tankService.getCharacteristic(this.platform.Characteristic.TargetTemperature).updateValue(tankTemperatureSet);
this.tankService.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState).updateValue(tankHeatingCoolingState);
this.tankService.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState).updateValue(tankTargetHeatingCoolingState);
this.ecoModeService.getCharacteristic(this.platform.Characteristic.On).updateValue(ecoModeIsActive);
this.comfortModeService.getCharacteristic(this.platform.Characteristic.On).updateValue(comfortModeIsActive);
setTimeout(() => {
this.updateReadings();
}, 1000);
try {
const { outdoorTemperatureNow, temperatureNow, tankTemperatureNow, tankTemperatureSet, tankHeatingCoolingState, isActive, ecoModeIsActive, comfortModeIsActive, tankTemperatureMax, tankTemperatureMin, tankTargetHeatingCoolingState, heatingCoolingState, targetHeatingCoolingState, targetTempSet, targetTempMax, targetTempMin, } = await this.getReadings(true);
this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(temperatureNow);
this.service.getCharacteristic(this.platform.Characteristic.Active).updateValue(isActive);
this.service.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState).updateValue(heatingCoolingState);
this.service.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState).updateValue(targetHeatingCoolingState);
this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature).setProps({
minValue: targetTempMin + temperatureNow,
maxValue: targetTempMax + temperatureNow,
minStep: 1,
}).updateValue(targetTempSet + temperatureNow);
// As heat pumps take -5 up to +5 target temp and HomeKit does not support it, we have to adjust by tempNow
this.outdoorTemperatureService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(outdoorTemperatureNow);
this.outdoorTemperatureService.getCharacteristic(this.platform.Characteristic.StatusActive).updateValue(true);
this.tankService.getCharacteristic(this.platform.Characteristic.TargetTemperature).setProps({
minValue: tankTemperatureMin,
maxValue: tankTemperatureMax,
minStep: 1,
}).updateValue(tankTemperatureSet);
this.tankService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(tankTemperatureNow);
this.tankService.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState).updateValue(tankHeatingCoolingState);
this.tankService.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState).updateValue(tankTargetHeatingCoolingState);
this.ecoModeService.getCharacteristic(this.platform.Characteristic.On).updateValue(ecoModeIsActive);
this.comfortModeService.getCharacteristic(this.platform.Characteristic.On).updateValue(comfortModeIsActive);
}
finally {
setTimeout(() => {
this.updateReadings();
}, 1000);
}
}

@@ -281,0 +275,0 @@ }

{
"displayName": "Homebridge Panasonic Heat Pump",
"name": "homebridge-panasonic-heat-pump",
"version": "1.1.4",
"version": "1.1.5",
"description": "Allows basic control of Panasonic Heat Pump (AQUAREA)",

@@ -6,0 +6,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc