homekit: boolean properties are 0/1

This commit is contained in:
Koushik Dutta
2021-12-31 13:42:29 -08:00
parent fd6f52ec75
commit de952e5207

View File

@@ -564,7 +564,7 @@ addSupportedType({
const persistBooleanCharacteristic = (service: Service, characteristic: WithUUID<{ new(): Characteristic }>) => {
const property = `characteristic-v2-${characteristic.UUID}`
service.getCharacteristic(characteristic)
.on(CharacteristicEventTypes.GET, callback => callback(null, storage.getItem(property) === 'true'))
.on(CharacteristicEventTypes.GET, callback => callback(null, storage.getItem(property) === 'true' ? 1 : 0))
.on(CharacteristicEventTypes.SET, (value, callback) => {
callback();
storage.setItem(property, (!!value).toString());