mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[homekit] Support lock optional characteristics on GarageDoorOpener (#17141)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
parent
49a43a43c1
commit
9a8baf464b
@ -805,6 +805,8 @@ All accessories also support the following optional characteristic that can be l
|
||||
| GarageDoorOpener | | | | A garage door opener. | | |
|
||||
| | CurrentDoorState | | Contact, Switch, Number, String | Current door state. | inverted (false) | OPEN (0, ON, OPEN), CLOSED (1, OFF, CLOSED), OPENING (2), CLOSING (3), STOPPED (4) |
|
||||
| | TargetDoorState | | Contact, Switch, Number, String | Target door state. | inverted (false) | OPEN (0, ON, OPEN), CLOSED (1, OFF, CLOSED) |
|
||||
| | | LockCurrentState | Contact, Number, String, Switch | Current state of lock mechanism | inverted (false) | UNSECURED (0, OFF, CLOSED), SECURED (1, ON, OPEN), JAMMED (2), UNKNOWN (3) |
|
||||
| | | LockTargetState | Number, String, Switch | Target state of lock mechanism | inverted (false) | UNSECURED (0, OFF), SECURED (1, ON) |
|
||||
| | | ObstructionStatus | Contact, Switch | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction | inverted (false) | |
|
||||
| HeaterCooler | | | | Heater or/and cooler device | | |
|
||||
| | ActiveStatus | | Dimmer, Switch | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors. | | |
|
||||
|
@ -137,6 +137,10 @@ import io.github.hapjava.characteristics.impl.lightbulb.BrightnessCharacteristic
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.ColorTemperatureCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.HueCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.SaturationCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lock.LockCurrentStateCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lock.LockCurrentStateEnum;
|
||||
import io.github.hapjava.characteristics.impl.lock.LockTargetStateCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lock.LockTargetStateEnum;
|
||||
import io.github.hapjava.characteristics.impl.slat.CurrentTiltAngleCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.slat.TargetTiltAngleCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.television.ClosedCaptionsCharacteristic;
|
||||
@ -227,6 +231,8 @@ public class HomekitCharacteristicFactory {
|
||||
put(INPUT_DEVICE_TYPE, HomekitCharacteristicFactory::createInputDeviceTypeCharacteristic);
|
||||
put(INPUT_SOURCE_TYPE, HomekitCharacteristicFactory::createInputSourceTypeCharacteristic);
|
||||
put(LOCK_CONTROL, HomekitCharacteristicFactory::createLockPhysicalControlsCharacteristic);
|
||||
put(LOCK_CURRENT_STATE, HomekitCharacteristicFactory::createLockCurrentStateCharacteristic);
|
||||
put(LOCK_TARGET_STATE, HomekitCharacteristicFactory::createLockTargetStateCharacteristic);
|
||||
put(MANUFACTURER, HomekitCharacteristicFactory::createManufacturerCharacteristic);
|
||||
put(MODEL, HomekitCharacteristicFactory::createModelCharacteristic);
|
||||
put(MUTE, HomekitCharacteristicFactory::createMuteCharacteristic);
|
||||
@ -1097,6 +1103,23 @@ public class HomekitCharacteristicFactory {
|
||||
getUnsubscriber(taggedItem, LOCK_CONTROL, updater));
|
||||
}
|
||||
|
||||
private static LockCurrentStateCharacteristic createLockCurrentStateCharacteristic(HomekitTaggedItem taggedItem,
|
||||
HomekitAccessoryUpdater updater) {
|
||||
var map = createMapping(taggedItem, LockCurrentStateEnum.class);
|
||||
return new LockCurrentStateCharacteristic(() -> getEnumFromItem(taggedItem, map, LockCurrentStateEnum.UNKNOWN),
|
||||
getSubscriber(taggedItem, LOCK_CURRENT_STATE, updater),
|
||||
getUnsubscriber(taggedItem, LOCK_CURRENT_STATE, updater));
|
||||
}
|
||||
|
||||
private static LockTargetStateCharacteristic createLockTargetStateCharacteristic(HomekitTaggedItem taggedItem,
|
||||
HomekitAccessoryUpdater updater) {
|
||||
var map = createMapping(taggedItem, LockTargetStateEnum.class);
|
||||
return new LockTargetStateCharacteristic(() -> getEnumFromItem(taggedItem, map, LockTargetStateEnum.UNSECURED),
|
||||
(value) -> setValueFromEnum(taggedItem, value, map),
|
||||
getSubscriber(taggedItem, LOCK_TARGET_STATE, updater),
|
||||
getUnsubscriber(taggedItem, LOCK_TARGET_STATE, updater));
|
||||
}
|
||||
|
||||
private static ManufacturerCharacteristic createManufacturerCharacteristic(HomekitTaggedItem taggedItem,
|
||||
HomekitAccessoryUpdater updater) {
|
||||
return new ManufacturerCharacteristic(() -> {
|
||||
|
Loading…
Reference in New Issue
Block a user