Skip to content

Commit

Permalink
Replaced switch's use of refreshCharacteristicUI to update the UI (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwi-cam committed Sep 25, 2024
1 parent 540756b commit cd5d1f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- refreshCharacteristic and value() were not updating the UI. Rebuilt to use updateValue method. (#733)
- Replaced switch's use of refreshCharacteristicUI to update the UI (#725)
### Added
- updated package to show Homebridge 2.0 support (#730)

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

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

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

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

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

if (config.stateless === true) {
state.switchState = false;
serviceManager.refreshCharacteristicUI(Characteristic.On);
// serviceManager.refreshCharacteristicUI(Characteristic.On);
serviceManager.updateCharacteristic(Characteristic.On,state.switchState);
} else {
this.checkAutoOnOff();
}
Expand Down

0 comments on commit cd5d1f2

Please sign in to comment.