Skip to content

Commit

Permalink
v4.4.19 (#734)
Browse files Browse the repository at this point in the history
* Rebuilt temperature and humidity monitoring to use updateValue method (#733)
* updated package to show Homebridge 2.0 support (#730)
* Removed refreshCharacteristicUI method from other accessories (#725)
* Made the method refreshCharacteristicUI compatible
* Clearing old code from comments
  • Loading branch information
kiwi-cam authored Sep 30, 2024
1 parent 846d43c commit 6f784fc
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.4.19 - 2024-09-30]
### Fixed
- refreshCharacteristic and value() were not updating the UI. Rebuilt to use updateValue method. (#733 and #725)
### Added
- updated package to show Homebridge 2.0 support (#730)

## [4.4.18 - 2024-08-08]
### Added
- Added ping state change logging for troubleshooting
Expand Down
2 changes: 1 addition & 1 deletion accessories/air-purifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AirPurifierAccessory extends FanAccessory {
state.currentState = Characteristic.CurrentAirPurifierState.INACTIVE
}

serviceManager.refreshCharacteristicUI(Characteristic.CurrentAirPurifierState);
serviceManager.updateCharacteristic(Characteristic.CurrentAirPurifierState,state.currentState);
}

setupServiceManager () {
Expand Down
12 changes: 6 additions & 6 deletions accessories/aircon.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class AirConAccessory extends BroadlinkRMAccessory {

// Do the actual sending of the temperature
this.sendTemperature(state.targetTemperature, previousValue);
serviceManager.refreshCharacteristicUI(Characteristic.TargetTemperature);
serviceManager.updateCharacteristic(Characteristic.TargetTemperature, state.targetTemperature);
}

async setTargetHeatingCoolingState (hexData, previousValue) {
Expand Down Expand Up @@ -271,12 +271,12 @@ class AirConAccessory extends BroadlinkRMAccessory {
//Force Temperature send
delayForDuration(0.25).then(() => {
this.sendTemperature(temperature, state.currentTemperature);
serviceManager.refreshCharacteristicUI(Characteristic.TargetTemperature);
serviceManager.updateCharacteristic(Characteristic.TargetTemperature,state.targetTemperature);
});
}

serviceManager.refreshCharacteristicUI(Characteristic.CurrentHeatingCoolingState);
serviceManager.refreshCharacteristicUI(Characteristic.TargetHeatingCoolingState);
serviceManager.updateCharacteristic(Characteristic.CurrentHeatingCoolingState,state.currentHeatingCoolingState);
serviceManager.updateCharacteristic(Characteristic.TargetHeatingCoolingState,state.targetHeatingCoolingState);

this.checkAutoOff();
}
Expand Down Expand Up @@ -617,8 +617,8 @@ class AirConAccessory extends BroadlinkRMAccessory {
const { config, serviceManager } = this;
const { noHumidity } = config;

serviceManager.refreshCharacteristicUI(Characteristic.CurrentTemperature);
if(!noHumidity){serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity);}
serviceManager.updateCharacteristic(Characteristic.CurrentTemperature, this.state.currentTemperature);
if(!noHumidity){serviceManager.updateCharacteristic(Characteristic.CurrentRelativeHumidity, this.state.currentHumidity);}
}

getCurrentTemperature (callback) {
Expand Down
13 changes: 1 addition & 12 deletions accessories/fan.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class FanAccessory extends BroadlinkRMAccessory {

if (config.pingIPAddressStateOnly) {
state.switchState = active ? true : false;
serviceManager.refreshCharacteristicUI(Characteristic.Active);
serviceManager.updateCharacteristic(Characteristic.Active,state.switchState);

return;
}
Expand All @@ -105,17 +105,6 @@ class FanAccessory extends BroadlinkRMAccessory {
serviceManager.setCharacteristic(Characteristic.Active, value);
}

//async setSwitchState(hexData) {
// const { data, host, log, name, logLevel } = this;

// this.stateChangeInProgress = true;
// this.reset();

// if (hexData) {await this.performSend(hexData);}

// this.checkAutoOnOff();
//}

async checkPingGrace () {
await catchDelayCancelError(async () => {
const { config, log, name, state, serviceManager } = this;
Expand Down
6 changes: 3 additions & 3 deletions accessories/heater-cooler.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,11 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory {
}

updateTemperatureUI() {
const { config, serviceManager } = this;
const { config, serviceManager, state } = this;
const { noHumidity } = config;

serviceManager.refreshCharacteristicUI(Characteristic.CurrentTemperature);
if (!noHumidity) { serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity); }
serviceManager.updateCharacteristic(Characteristic.CurrentTemperature,state.currentTemperature);
if (!noHumidity) { serviceManager.updateCharacteristic(Characteristic.CurrentRelativeHumidity,state.currentHumidity); }
}

getCurrentTemperature(callback) {
Expand Down
8 changes: 4 additions & 4 deletions accessories/humidifier-dehumidifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory {
if (logLevel <=2) {log(`${name} setCurrentState: currently ${previousValue}, changing to ${state.currentState}`);}

if(hexData) {await this.performSend(hexData);}
serviceManager.refreshCharacteristicUI(Characteristic.CurrentHumidifierDehumidifierState);
serviceManager.updateCharacteristic(Characteristic.CurrentHumidifierDehumidifierState,state.currentState);
this.previouslyOff = false;
}

Expand Down Expand Up @@ -149,13 +149,13 @@ class HumidifierDehumidifierAccessory extends FanAccessory {
//Do nothing if turned off
if (!state.switchState) {
state.currentState = Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
serviceManager.refreshCharacteristicUI(Characteristic.CurrentHumidifierDehumidifierState);
serviceManager.updateCharacteristic(Characteristic.CurrentHumidifierDehumidifierState,state.currentState);
this.previouslyOff = true;
return;
}

//Update "switchState to match device state
if (state.targetState === Characteristic.TargetHumidifierDehumidifierState.OFF){
if (state.targetState === Characteristic.TargetHumidifierDehumidifierState.OFF){
state.currentState = Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
state.switchState = false;
this.previouslyOff = true;
Expand Down Expand Up @@ -426,7 +426,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory {
updateHumidityUI () {
const { config, serviceManager } = this;

serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity);
serviceManager.updateCharacteristic(Characteristic.CurrentRelativeHumidity, this.state.currentHumidity);
}

getCurrentHumidity (callback) {
Expand Down
4 changes: 2 additions & 2 deletions accessories/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class LightAccessory extends SwitchAccessory {
x.reset();
x.state.switchState = false;
x.lastBrightness = undefined;
x.serviceManager.refreshCharacteristicUI(Characteristic.On);
x.serviceManager.updateCharacteristic(Characteristic.On,x.state.switchState);
}
});
}
Expand Down Expand Up @@ -104,7 +104,7 @@ class LightAccessory extends SwitchAccessory {
if (!state.switchState) {

state.switchState = true;
serviceManager.refreshCharacteristicUI(Characteristic.On);
serviceManager.updateCharacteristic(Characteristic.On,state.switchState);

if (on) {
log(`${name} setHue: (turn on, wait ${onDelay}s)`);
Expand Down
2 changes: 1 addition & 1 deletion accessories/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OutletAccessory extends SwitchAccessory {

if (config.pingIPAddressStateOnly) {
state.outletInUse = active ? true : false;
serviceManager.refreshCharacteristicUI(Characteristic.OutletInUse)
serviceManager.updateCharacteristic(Characteristic.OutletInUse, state.outletInUse)

return
}
Expand Down
6 changes: 3 additions & 3 deletions accessories/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SwitchAccessory extends BroadlinkRMAccessory {

if (this.serviceManager.getCharacteristic(Characteristic.On) === undefined) {
this.state.switchState = false;
this.serviceManager.refreshCharacteristicUI(Characteristic.On);
this.serviceManager.updateCharacteristic(Characteristic.On, this.state.switchState);
}
}

Expand Down Expand Up @@ -100,7 +100,7 @@ class SwitchAccessory extends BroadlinkRMAccessory {

if (config.pingIPAddressStateOnly) {
state.switchState = active ? true : false;
serviceManager.refreshCharacteristicUI(Characteristic.On);
serviceManager.updateCharacteristic(Characteristic.On,state.switchState);

return;
}
Expand All @@ -118,7 +118,7 @@ class SwitchAccessory extends BroadlinkRMAccessory {

if (config.stateless === true) {
state.switchState = false;
serviceManager.refreshCharacteristicUI(Characteristic.On);
serviceManager.updateCharacteristic(Characteristic.On,state.switchState);
} else {
this.checkAutoOnOff();
}
Expand Down
2 changes: 1 addition & 1 deletion accessories/tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class TVAccessory extends BroadlinkRMAccessory {

if (config.pingIPAddressStateOnly) {
state.switchState = active ? true : false;
serviceManager.refreshCharacteristicUI(Characteristic.Active);
serviceManager.updateCharacteristic(Characteristic.Active,state.switchState);

return;
}
Expand Down
7 changes: 6 additions & 1 deletion helpers/serviceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ class ServiceManager {
this.service.setCharacteristic(characteristic, value);
}

updateCharacteristic (characteristic, value) {
this.service.getCharacteristic(characteristic).updateValue(value);
}

getCharacteristic (characteristic) {
return this.service.getCharacteristic(characteristic)
}

refreshCharacteristicUI (characteristic) {
this.getCharacteristic(characteristic).value;
//Historically, we refreshed the UI using getValue(). This is being depricated and replaced by the parameter value, which unfortunately does not refresh the UI, instaed use updateCharacteristic(characteristic, value)
this.updateCharacteristic(characteristic, this.service.getCharacteristic(characteristic).value);
}

// Convenience
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-broadlink-rm-pro",
"displayName": "Homebridge Broadlink RM Pro",
"version": "4.4.18",
"version": "4.4.19",
"description": "Broadlink RM plugin (including the mini and pro) for homebridge with AC Pro and TV features",
"license": "ISC",
"scripts": {
Expand All @@ -18,7 +18,7 @@
],
"engines": {
"node": ">=7.6.0",
"homebridge": ">=1.4.1"
"homebridge": "^1.4.1 || ^2.0.0-beta.0"
},
"author": {
"name": "kiwi-cam"
Expand Down

0 comments on commit 6f784fc

Please sign in to comment.