Add HomeKit Door accessory type (#80741)
Co-authored-by: Jason Redd <jredd46@gmail.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
3c70dd9b42
commit
755c44d152
5 changed files with 82 additions and 0 deletions
|
@ -148,6 +148,11 @@ def get_accessory( # noqa: C901
|
|||
and features & CoverEntityFeature.SET_POSITION
|
||||
):
|
||||
a_type = "Window"
|
||||
elif (
|
||||
device_class == CoverDeviceClass.DOOR
|
||||
and features & CoverEntityFeature.SET_POSITION
|
||||
):
|
||||
a_type = "Door"
|
||||
elif features & CoverEntityFeature.SET_POSITION:
|
||||
a_type = "WindowCovering"
|
||||
elif features & (CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE):
|
||||
|
|
|
@ -119,6 +119,7 @@ SERV_CAMERA_RTP_STREAM_MANAGEMENT = "CameraRTPStreamManagement"
|
|||
SERV_CARBON_DIOXIDE_SENSOR = "CarbonDioxideSensor"
|
||||
SERV_CARBON_MONOXIDE_SENSOR = "CarbonMonoxideSensor"
|
||||
SERV_CONTACT_SENSOR = "ContactSensor"
|
||||
SERV_DOOR = "Door"
|
||||
SERV_DOORBELL = "Doorbell"
|
||||
SERV_FANV2 = "Fanv2"
|
||||
SERV_GARAGE_DOOR_OPENER = "GarageDoorOpener"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import logging
|
||||
|
||||
from pyhap.const import (
|
||||
CATEGORY_DOOR,
|
||||
CATEGORY_GARAGE_DOOR_OPENER,
|
||||
CATEGORY_WINDOW,
|
||||
CATEGORY_WINDOW_COVERING,
|
||||
|
@ -54,6 +55,7 @@ from .const import (
|
|||
HK_POSITION_STOPPED,
|
||||
PROP_MAX_VALUE,
|
||||
PROP_MIN_VALUE,
|
||||
SERV_DOOR,
|
||||
SERV_GARAGE_DOOR_OPENER,
|
||||
SERV_WINDOW,
|
||||
SERV_WINDOW_COVERING,
|
||||
|
@ -323,6 +325,18 @@ class OpeningDevice(OpeningDeviceBase, HomeAccessory):
|
|||
super().async_update_state(new_state)
|
||||
|
||||
|
||||
@TYPES.register("Door")
|
||||
class Door(OpeningDevice):
|
||||
"""Generate a Door accessory for a cover entity.
|
||||
|
||||
The entity must support: set_cover_position.
|
||||
"""
|
||||
|
||||
def __init__(self, *args):
|
||||
"""Initialize a Door accessory object."""
|
||||
super().__init__(*args, category=CATEGORY_DOOR, service=SERV_DOOR)
|
||||
|
||||
|
||||
@TYPES.register("Window")
|
||||
class Window(OpeningDevice):
|
||||
"""Generate a Window accessory for a cover entity with WINDOW device class.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue