mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[homekit] Add (partial) Doorbell Service (#17130)
* [homekit] add Doorbell Service this is _not_ sufficient for HomeKit to present a doorbell. it just shows as an unsupported accessory with the house icon, Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
parent
58629e29bb
commit
df365dc9a8
@ -811,6 +811,10 @@ All accessories also support the following optional characteristic that can be l
|
||||
| | TargetPosition | | Dimmer, Number, Rollershutter | Target position of motorized door | | |
|
||||
| | | HoldPosition | Rollershutter, Switch | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve) | | |
|
||||
| | | ObstructionStatus | Contact, Dimmer, Switch | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction | | |
|
||||
| Doorbell | | | | Doorbell. This accessory must also have a Speaker, Microphone, and Camera RTP Stream Management service in the same group in order to be usable by the Home App. The latter is not yet implemented in openHAB. | | |
|
||||
| | ProgrammableSwitchEvent | | Contact, Number, String, Switch | The button press event. Note that the event will be forwarded to Home for every _update_ of the item, not just on change. | inverted (false) | SINGLE_PRESS (0, ON, OPEN), DOUBLE_PRESS (1), LONG_PRESS (2) [*](#customizable-enum) |
|
||||
| | | Brightness | Dimmer | Brightness in % (1-100). | | |
|
||||
| | | Volume | Number | Speaker volume from 0% to 100% | | |
|
||||
| Fan | | | | Fan | | |
|
||||
| | ActiveStatus | | Dimmer, Switch | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors. | | |
|
||||
| | | CurrentFanState | Number, String | Current fan state. | | INACTIVE (0), IDLE (1), BLOWING_AIR (2) |
|
||||
|
@ -33,6 +33,7 @@ public enum HomekitAccessoryType {
|
||||
CARBON_MONOXIDE_SENSOR("CarbonMonoxideSensor"),
|
||||
CONTACT_SENSOR("ContactSensor"),
|
||||
DOOR("Door"),
|
||||
DOORBELL("Doorbell"),
|
||||
FAN("Fan"),
|
||||
FAUCET("Faucet"),
|
||||
FILTER_MAINTENANCE("Filter"),
|
||||
|
@ -76,6 +76,7 @@ public class HomekitAccessoryFactory {
|
||||
put(CARBON_MONOXIDE_SENSOR, new HomekitCharacteristicType[] { CARBON_MONOXIDE_DETECTED_STATE });
|
||||
put(CONTACT_SENSOR, new HomekitCharacteristicType[] { CONTACT_SENSOR_STATE });
|
||||
put(DOOR, new HomekitCharacteristicType[] { CURRENT_POSITION, TARGET_POSITION, POSITION_STATE });
|
||||
put(DOORBELL, new HomekitCharacteristicType[] { PROGRAMMABLE_SWITCH_EVENT });
|
||||
put(FAN, new HomekitCharacteristicType[] { ACTIVE_STATUS });
|
||||
put(FAUCET, new HomekitCharacteristicType[] { ACTIVE_STATUS });
|
||||
put(FILTER_MAINTENANCE, new HomekitCharacteristicType[] { FILTER_CHANGE_INDICATION });
|
||||
@ -123,6 +124,7 @@ public class HomekitAccessoryFactory {
|
||||
put(CARBON_MONOXIDE_SENSOR, HomekitCarbonMonoxideSensorImpl.class);
|
||||
put(CONTACT_SENSOR, HomekitContactSensorImpl.class);
|
||||
put(DOOR, HomekitDoorImpl.class);
|
||||
put(DOORBELL, HomekitDoorbellImpl.class);
|
||||
put(FAN, HomekitFanImpl.class);
|
||||
put(FAUCET, HomekitFaucetImpl.class);
|
||||
put(FILTER_MAINTENANCE, HomekitFilterMaintenanceImpl.class);
|
||||
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2024 Contributors to the openHAB project
|
||||
*
|
||||
* See the NOTICE file(s) distributed with this work for additional
|
||||
* information.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.openhab.io.homekit.internal.accessories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
|
||||
import org.openhab.io.homekit.internal.HomekitException;
|
||||
import org.openhab.io.homekit.internal.HomekitSettings;
|
||||
import org.openhab.io.homekit.internal.HomekitTaggedItem;
|
||||
|
||||
import io.github.hapjava.characteristics.Characteristic;
|
||||
import io.github.hapjava.characteristics.impl.common.ProgrammableSwitchEventCharacteristic;
|
||||
import io.github.hapjava.services.impl.DoorbellService;
|
||||
|
||||
/**
|
||||
* Implements a HomeKit Doorbell
|
||||
*
|
||||
* This is only the primary service. To implement the entire video doorbell
|
||||
* profile, you also need to add a Camera RTP Stream Management service,
|
||||
* a Speaker service, and Microphone service.
|
||||
*
|
||||
* @author Cody Cutrer - Initial contribution
|
||||
*/
|
||||
class HomekitDoorbellImpl extends AbstractHomekitAccessoryImpl {
|
||||
|
||||
public HomekitDoorbellImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
|
||||
List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater,
|
||||
HomekitSettings settings) {
|
||||
super(taggedItem, mandatoryCharacteristics, mandatoryRawCharacteristics, updater, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws HomekitException {
|
||||
super.init();
|
||||
addService(new DoorbellService(getCharacteristic(ProgrammableSwitchEventCharacteristic.class).get()));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user