Skip to content

Commit

Permalink
Merge pull request #100 from Jason-Morcos/fix/More-minor-updates-with…
Browse files Browse the repository at this point in the history
…-requerying-device-info

More fixes around re-querying device info
  • Loading branch information
fjs21 authored Nov 10, 2023
2 parents a28e876 + 0507a21 commit 40294c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/kumo-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export class KumoApi {

if (existingDeviceIndex !== undefined) {
this.log.info('Updated existing device. Serial: %s. Label: %s', device.serial, device.label);
this.devices[existingDeviceIndex] = device;
this.devices[existingDeviceIndex].label = device.label;
this.devices[existingDeviceIndex].zoneTable = device.zoneTable;
} else {
this.log.info('Found device. Serial: %s. Label: %s', device.serial, device.label);
this.devices.push(device);
Expand Down
4 changes: 2 additions & 2 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ export class KumoHomebridgePlatform implements DynamicPlatformPlugin {
const overrideAddress = this.optionGetOverrideAddress(device);
if (overrideAddress !== null) {
this.log.info('Override address found for device - using IP %s instead of %s for direct access', overrideAddress, accessory.context.zoneTable.address);
accessory.context.overrideAddress = overrideAddress;
device.overrideAddress = overrideAddress;
}

this.log.debug(device.zoneTable);

if (this.config.directAccess) {
accessory.context.device = await this.kumo.queryDevice_Direct(device.serial);
if(accessory.context.device === null) {
this.log.error('Failed to connect to device IP (%s) at %s', device.serial, accessory.context.overrideAddress ?? accessory.context.zoneTable.address);
this.log.error('Failed to connect to device IP (%s) at %s', device.serial, device.overrideAddress ?? accessory.context.zoneTable.address);
this.config.directAccess = false;
this.log.info('Disabling directAccess to Kumo devices');
accessory.context.device = await this.kumo.queryDevice(device.serial);
Expand Down

0 comments on commit 40294c2

Please sign in to comment.