-
Notifications
You must be signed in to change notification settings - Fork 1
/
yolinkSmartRemoterV2.py
52 lines (40 loc) · 1.57 KB
/
yolinkSmartRemoterV2.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
49
50
51
52
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 YoLinkSmartRemote(YoLinkMQTTDevice):
def __init__(yolink, yoAccess, deviceInfo, callback):
super().__init__(yoAccess, deviceInfo, callback)
yolink.methodList = ['getState' ]
yolink.eventList = ['Alert' , 'getState', 'StatusChange']
yolink.eventName = 'SmartRemoteEvent'
yolink.eventTime = 'Time'
yolink.type = 'SmartRemoter'
#time.sleep(2)
def updateStatus(yolink, data):
yolink.updateCallbackStatus(data, False)
def getDevTemperature(yolink):
temp = yolink.getStateValue('devTemperature')
logging.debug('getDevTemperature: {}'.format(temp))
return(temp)
def getEventData(yolink):
temp = yolink.get_event_from_state()
logging.debug('getEventData: {}'.format(temp))
return(temp)
#def isControlEvent(yolink):
# return(yolink.isControlEvent())
def clearEventData(yolink):
if yolink.clear_event_from_state():
logging.debug('clearEventData - SUCCESS:')
class YoLinkSmartRemoter(YoLinkSmartRemote):
def __init__(yolink, yoAccess, deviceInfo):
super().__init__( yoAccess, deviceInfo, yolink.updateStatus)
yolink.initNode()
# Enable Event Support (True below)
def updateStatus(yolink, data):
yolink.updateCallbackStatus(data, True)