[homekit] Fix invertedness of GarageDoorOpener characteristics (#17181)

In #17137, CurrentDoorState and TargetDoorState were moved from being part
of the accessory itself, to using the CharacteristicFactory, but they lost the
flag that default-inverts them. So make sure to pass that flag in the new location
that the mapping is created.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
Cody Cutrer 2024-07-30 07:02:06 -06:00 committed by GitHub
parent 077cea0e74
commit cc6a202034
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -856,7 +856,7 @@ public class HomekitCharacteristicFactory {
private static CurrentDoorStateCharacteristic createCurrentDoorStateCharacteristic(HomekitTaggedItem taggedItem, private static CurrentDoorStateCharacteristic createCurrentDoorStateCharacteristic(HomekitTaggedItem taggedItem,
HomekitAccessoryUpdater updater) { HomekitAccessoryUpdater updater) {
List<CurrentDoorStateEnum> validValues = new ArrayList<>(); List<CurrentDoorStateEnum> validValues = new ArrayList<>();
var map = createMapping(taggedItem, CurrentDoorStateEnum.class, validValues); var map = createMapping(taggedItem, CurrentDoorStateEnum.class, validValues, true);
return new CurrentDoorStateCharacteristic(() -> getEnumFromItem(taggedItem, map, CurrentDoorStateEnum.CLOSED), return new CurrentDoorStateCharacteristic(() -> getEnumFromItem(taggedItem, map, CurrentDoorStateEnum.CLOSED),
getSubscriber(taggedItem, CURRENT_DOOR_STATE, updater), getSubscriber(taggedItem, CURRENT_DOOR_STATE, updater),
getUnsubscriber(taggedItem, CURRENT_DOOR_STATE, updater)); getUnsubscriber(taggedItem, CURRENT_DOOR_STATE, updater));
@ -1427,7 +1427,7 @@ public class HomekitCharacteristicFactory {
private static TargetDoorStateCharacteristic createTargetDoorStateCharacteristic(HomekitTaggedItem taggedItem, private static TargetDoorStateCharacteristic createTargetDoorStateCharacteristic(HomekitTaggedItem taggedItem,
HomekitAccessoryUpdater updater) { HomekitAccessoryUpdater updater) {
List<TargetDoorStateEnum> validValues = new ArrayList<>(); List<TargetDoorStateEnum> validValues = new ArrayList<>();
var map = createMapping(taggedItem, TargetDoorStateEnum.class, validValues); var map = createMapping(taggedItem, TargetDoorStateEnum.class, validValues, true);
return new TargetDoorStateCharacteristic(() -> getEnumFromItem(taggedItem, map, TargetDoorStateEnum.CLOSED), return new TargetDoorStateCharacteristic(() -> getEnumFromItem(taggedItem, map, TargetDoorStateEnum.CLOSED),
(targetState) -> setValueFromEnum(taggedItem, targetState, map), (targetState) -> setValueFromEnum(taggedItem, targetState, map),
getSubscriber(taggedItem, TARGET_DOOR_STATE, updater), getSubscriber(taggedItem, TARGET_DOOR_STATE, updater),