homebridge-xiaomi-roborock-vacuum
Version:
Xiaomi Vacuum Cleaner - 1st (Mi Robot), 2nd (Roborock S50 + S55), 3rd Generation (Roborock S6) and S5 Max - plugin for Homebridge.
20 lines • 730 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureName = ensureName;
function ensureName(hap, service, name) {
const key = [
`homebridge-xiaomi-roborock-vacuum`,
`configured-name`,
name.replaceAll(" ", "_"),
].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