File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ package accessory
2
+
3
+ import "github.com/brutella/hap/service"
4
+
5
+ type ContactSensor struct {
6
+ * A
7
+ ContactSensor * service.ContactSensor
8
+ }
9
+
10
+ // NewContactSensor implements a contact sensor.
11
+ func NewContactSensor (info Info ) * ContactSensor {
12
+ a := ContactSensor {}
13
+ a .A = New (info , TypeSensor )
14
+
15
+ a .ContactSensor = service .NewContactSensor ()
16
+ a .AddS (a .ContactSensor .S )
17
+
18
+ return & a
19
+ }
Original file line number Diff line number Diff line change
1
+ package accessory
2
+
3
+ import "github.com/brutella/hap/service"
4
+
5
+ type MotionSensor struct {
6
+ * A
7
+ MotionSensor * service.MotionSensor
8
+ }
9
+
10
+ // NewMotionSensor returns a motion sensor.
11
+ func NewMotionSensor (info Info ) * MotionSensor {
12
+ a := MotionSensor {}
13
+ a .A = New (info , TypeSensor )
14
+
15
+ a .MotionSensor = service .NewMotionSensor ()
16
+ a .AddS (a .MotionSensor .S )
17
+
18
+ return & a
19
+ }
You can’t perform that action at this time.
0 commit comments