Skip to content

Commit

Permalink
H5042 template; accessory display name
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Jul 30, 2024
1 parent 5ce1b5c commit 0a21814
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 199 deletions.
4 changes: 2 additions & 2 deletions lib/device/outlet-single.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ export default class {
if (this.cacheAmp !== newAmp) {
this.cacheAmp = newAmp
this.service.updateCharacteristic(this.eveChar.ElectricCurrent, this.cacheAmp)
this.accessory.log(`${platformLang.curAmp} [${this.cacheWatt}A]`)
this.accessory.log(`${platformLang.curAmp} [${this.cacheAmp}A]`)
}
if (this.cacheVolt !== newVolt) {
this.cacheVolt = newVolt
this.service.updateCharacteristic(this.eveChar.Voltage, this.cacheVolt)
this.accessory.log(`${platformLang.curVolt} [${this.cacheWatt}V]`)
this.accessory.log(`${platformLang.curVolt} [${this.cacheVolt}V]`)
}
break
}
Expand Down
8 changes: 7 additions & 1 deletion lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,10 @@ export default class {
// Since LAN does not provide a name, we will use the configured label or device id
this.initialiseDevice({
device: lanDevice.device,
deviceName: this.deviceConf?.[lanDevice.device]?.label || lanDevice.device,
deviceName: this.deviceConf?.[lanDevice.device]?.label || lanDevice.device.replaceAll(':', ''),
model: lanDevice.sku || 'HXXXX', // In case the model is not provided
isLANDevice: true,
isLANOnly: true,
})
lanDevicesWereInitialised = true
})
Expand Down Expand Up @@ -1082,6 +1083,11 @@ export default class {
accessory.context.useLANControl = true
}

// If the device is LAN-only, then sync the display name with the label in the configuration
if (device.isLANOnly) {
accessory.displayName = device.deviceName
}

// See if we have extra HTTP client info for this device
if (device.httpInfo) {
// Save the hardware and firmware versions
Expand Down
1 change: 1 addition & 0 deletions lib/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ export default {
template: [
'H1162', // https://github.com/bwp91/homebridge-govee/issues/422
'H5024', // https://github.com/bwp91/homebridge-govee/issues/835
'H5042', // https://github.com/bwp91/homebridge-govee/issues/849
'H5043', // https://github.com/bwp91/homebridge-govee/issues/558
'H5107', // https://github.com/bwp91/homebridge-govee/issues/803
'H5109', // https://github.com/bwp91/homebridge-govee/issues/823
Expand Down
Loading

0 comments on commit 0a21814

Please sign in to comment.