From a87f14a01c4b9f5d3f7c66f7172c3ee95beb7ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yakut=20=C3=96zcan?= Date: Thu, 30 Apr 2020 12:28:17 +0300 Subject: [PATCH] Create door lock accessory --- accessory/door_lock.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 accessory/door_lock.go diff --git a/accessory/door_lock.go b/accessory/door_lock.go new file mode 100644 index 00000000..536cf5a1 --- /dev/null +++ b/accessory/door_lock.go @@ -0,0 +1,20 @@ +package accessory + +import "github.com/brutella/hc/service" + +type DoorLocks struct { + *Accessory + DoorLock *service.LockMechanism +} + +// NewDoorLock returns a window which implements model.NewDoorLock. +func NewDoorLock(info Info, targetState int) *DoorLocks { + acc := DoorLocks{} + acc.Accessory = New(info, TypeDoorLock) + acc.DoorLock = service.NewLockMechanism() + acc.DoorLock.LockTargetState.SetValue(targetState) + acc.AddService(acc.DoorLock.Service) + + return &acc +} +