Skip to content

Commit

Permalink
configured name for AC sub-switch #235
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin committed May 12, 2023
1 parent a0fc418 commit a8b1ce5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/devices/AirConditioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ export default class AirConditioner extends baseDevice {
Service: {
Switch,
},
Characteristic,
} = this.platform;

const serviceButton = this.accessory.getService(name) || this.accessory.addService(Switch, name, name);
Expand All @@ -660,6 +661,11 @@ export default class AirConditioner extends baseDevice {
}
});

serviceButton.addOptionalCharacteristic(Characteristic.ConfiguredName);
if (!serviceButton.getCharacteristic(Characteristic.ConfiguredName).value) {
serviceButton.updateCharacteristic(Characteristic.ConfiguredName, name);
}

this.serviceLabelButtons.addLinkedService(serviceButton);
}
}
Expand Down

0 comments on commit a8b1ce5

Please sign in to comment.