homebridge-roborock-vacuum-update
Version:
Comprehensive Homebridge plugin for Roborock vacuum cleaners with full HomeKit integration including mopping, dock features, and advanced controls.
20 lines • 730 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureName = ensureName;
function ensureName(hap, service, name) {
const key = [
`homebridge-roborock-vacuum-update`,
`configured-name`,
name.replace(/\s+/g, "_"),
].join("-");
service.addOptionalCharacteristic(hap.Characteristic.ConfiguredName);
if (!hap.HAPStorage.storage().getItemSync(key)) {
service.setCharacteristic(hap.Characteristic.ConfiguredName, name);
}
service
.getCharacteristic(hap.Characteristic.ConfiguredName)
.on("change", ({ newValue }) => {
hap.HAPStorage.storage().setItemSync(key, newValue);
});
}
//# sourceMappingURL=ensure_name.js.map