-
Notifications
You must be signed in to change notification settings - Fork 1
/
yolinkDoorSensorV2.py
48 lines (35 loc) · 1.26 KB
/
yolinkDoorSensorV2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import json
import time
try:
import udi_interface
logging = udi_interface.LOGGER
Custom = udi_interface.Custom
except ImportError:
import logging
logging.basicConfig(level=logging.DEBUG)
from yolink_mqtt_classV3 import YoLinkMQTTDevice
class YoLinkDoorSens(YoLinkMQTTDevice):
def __init__ (yolink, yoAccess, deviceInfo, callback):
super().__init__(yoAccess, deviceInfo, callback)
yolink.methodList = ['getState' ]
yolink.eventList = ['Report']
yolink.eventTime = 'Time'
yolink.type = 'DoorSensor'
#time.sleep(2)
#def refreshDoorSensor(yolink):
# logging.debug(yolink.type+ ' - refreshDoorSensor')
# return(yolink.refreshDevice( ))
#def doorState(yolink):
# return(yolink.getState())
#def doorData(yolink):
# return(yolink.getData())
def refreshSensor(yolink):
yolink.refreshDevice()
def updateStatus(yolink, data):
yolink.updateCallbackStatus(data, False)
class YoLinkDoorSensor(YoLinkDoorSens):
def __init__(yolink, yoAccess, deviceInfo):
super().__init__( yoAccess, deviceInfo, yolink.updateStatus)
yolink.initNode()
def updateStatus(yolink, data):
yolink.updateCallbackStatus(data, True)