本文整理汇总了Python中Domoticz.Log方法的典型用法代码示例。如果您正苦于以下问题:Python Domoticz.Log方法的具体用法?Python Domoticz.Log怎么用?Python Domoticz.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domoticz
的用法示例。
在下文中一共展示了Domoticz.Log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doUpdate
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def doUpdate(self):
Domoticz.Log(_("Starting device update"))
for unit in self.variables:
nV = self.variables[unit]['nValue']
sV = self.variables[unit]['sValue']
# cast float to str
if isinstance(sV, float):
sV = str(float("{0:.0f}".format(sV))).replace('.', ',')
# Create device if required
if sV:
self.createDevice(key=unit)
if unit in Devices:
Domoticz.Log(_("Update unit=%d; nValue=%d; sValue=%s") % (unit, nV, sV))
Devices[unit].Update(nValue=nV, sValue=sV)
示例2: onStart
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onStart():
global switch
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
if (len(Devices) == 0):
Domoticz.Device(Name="Switch 1", Unit=1, TypeName="Switch").Create()
Domoticz.Log("Device created.")
Domoticz.Heartbeat(30)
switch.ip = Parameters["Address"]
switch.port = Parameters["Port"]
try:
status = switch.status()
except Exception as e:
Domoticz.Error('Except onStart: ' + str(e))
return
updStatus(status)
DumpConfigToLog()
示例3: onStart
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onStart(self):
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
DumpConfigToLog()
self.FullUpdate = int(Parameters["Mode2"])
# If poll interval between 10 and 60 sec.
if 10 <= int(Parameters["Mode1"]) <= 60:
Domoticz.Log("Update interval set to " + Parameters["Mode1"])
Domoticz.Heartbeat(int(Parameters["Mode1"]))
else:
# If not, set to 20 sec.
Domoticz.Heartbeat(20)
Domoticz.Log("Full update after " + Parameters["Mode2"] + " polls")
# Start the Homewizard connection
self.hwConnect("get-sensors")
return True
示例4: Sensors
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def Sensors(self, strData):
Domoticz.Log("No. of sensors found: " + str(len(self.GetValue(strData["response"], "kakusensors",{}))))
for Sensor in self.GetValue(strData["response"], "kakusensors",{}):
sens_id = Sensor["id"] + self.sensor_id
sens_type = self.GetValue(Sensor, "type", "Unknown").lower()
sens_name = self.GetValue(Sensor, "name", "Unknown")
self.hw_types.update({str(sens_id): str(sens_type)})
if ( sens_id not in Devices ):
if ( sens_type == "doorbell" ):
Domoticz.Device(Name=sens_name, Unit=sens_id, Type=17, Switchtype=1).Create()
elif ( sens_type == "motion" ):
Domoticz.Device(Name=sens_name, Unit=sens_id, Type=17, Switchtype=8).Create()
elif ( sens_type == "contact" ):
Domoticz.Device(Name=sens_name, Unit=sens_id, Type=17, Switchtype=2).Create()
elif ( sens_type == "smoke" ) or ( sens_type == "smoke868" ):
Domoticz.Device(Name=sens_name, Unit=sens_id, Type=32, Subtype=3).Create()
return
# TODO: Verify it works...
示例5: onHeartbeat
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onHeartbeat(self):
if (self.blDebug == True):
Domoticz.Log("onHeartbeat called")
if (self.blDiscoverySocketCreated==False): # If the UDP socket has not yet been created, do it now
self.createUDPSocket()
if (self.blDiscoveryRequestSend == True and self.blDiscoverySucces == False):
self.procesDiscoveryData()
if (self.blDiscoverySucces == False):
self.blDiscoveryRequestSend = False # Resend Discovery frame
if (self.blDiscoveryRequestSend == False and self.blDiscoverySocketCreated == True): # If the discovery UDP packet has not been send, send it now
self.sendDiscoveryRequest()
if (self.blConnectInitiated == False and self.blDiscoverySucces == True):
self.connect()
if (self.blConnected==True and self.XMLProcessed==False):
self.workAround()
if (self.XMLProcessed==True and self.blCheckedDevices == False):
self.checkDevices()
if (self.blCheckedDevices == True and self.blCheckedStates == False):
self.getInitialStates()
self.blInitDone = True
Domoticz.Heartbeat(20)
示例6: checkInputBuffer
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def checkInputBuffer(self):
intStartOfFrame = self.bInputBuffer.find(b'ISCP')
if (intStartOfFrame > -1):
if (intStartOfFrame > 0):
if (self.blDebug == True):
Domoticz.Log('We have garbage in the input buffer, getting rid of: '+str(intStartOfFrame)+' bytes.')
self.bInputBuffer = self.bInputBuffer[intStartOfFrame:] # Get rid of possible left overs in front of the first complete frame
if (self.blDebug == True):
Domoticz.Log('Found ISCP frame')
intHeaderSize = self.bInputBuffer[7] + pow(2,8)*self.bInputBuffer[6] + pow(2,16) * self.bInputBuffer[5] + pow(2,32)*self.bInputBuffer[4]
if (self.blDebug == True):
Domoticz.Log('HeaderSize: '+ str(intHeaderSize))
intDataSize = self.bInputBuffer[11] + pow(2,8)*self.bInputBuffer[10] + pow(2,16) * self.bInputBuffer[9] + pow(2,32)*self.bInputBuffer[8]
if (self.blDebug == True):
Domoticz.Log('DataSize: '+ str(intDataSize))
Domoticz.Log('Have ' + str(len(self.bInputBuffer)) + ' bytes in inputbuffer')
if (len(self.bInputBuffer) >= intHeaderSize + intDataSize):
return True
else:
return False # We do not have a complete frame yet
return False
示例7: ProcessXML
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def ProcessXML(self):
Domoticz.Log('Response status: ' + self.XMLRoot.get('status'))
Domoticz.Log('id : ' + (self.XMLRoot.find('device').attrib).get('id'))
Domoticz.Log('brand : ' + (self.XMLRoot.find('device')).find('brand').text)
Domoticz.Log('category : ' + (self.XMLRoot.find('device')).find('category').text)
Domoticz.Log('brand : ' + (self.XMLRoot.find('device')).find('brand').text)
Domoticz.Log('year : ' + (self.XMLRoot.find('device')).find('year').text)
Domoticz.Log('model : ' + (self.XMLRoot.find('device')).find('model').text)
Domoticz.Log('destination : ' + (self.XMLRoot.find('device')).find('destination').text)
Domoticz.Log('modeliconurl : ' + (self.XMLRoot.find('device')).find('modeliconurl').text)
Domoticz.Log('friendlyname : ' + (self.XMLRoot.find('device')).find('friendlyname').text)
Domoticz.Log('firmwareversion: ' + (self.XMLRoot.find('device')).find('firmwareversion').text)
Domoticz.Log('zonelist: ' + (self.XMLRoot.find('device').find('zonelist')).get('count'))
for zone in self.XMLRoot.find('device').find('zonelist'):
Domoticz.Log('zone id: ' + zone.get('id') + ', value: ' + zone.get('value') + ', name: ' + zone.get('name') + ', volmax: ' + zone.get('volmax'))
Domoticz.Log('selectorlist: ' + (self.XMLRoot.find('device').find('selectorlist')).get('count'))
for selector in self.XMLRoot.find('device').find('selectorlist'):
Domoticz.Log('selector id: ' + selector.get('id') + ', value: ' + selector.get('value') + ', name: ' + selector.get('name'))
Domoticz.Log('presetlist: ' + (self.XMLRoot.find('device').find('presetlist')).get('count'))
for preset in self.XMLRoot.find('device').find('presetlist'):
Domoticz.Log('preset id: ' + preset.get('id') + ', band: ' + preset.get('band') + ', freq: ' + preset.get('freq') + ', name: ' + preset.get('name'))
for control in self.XMLRoot.find('device').find('controllist'):
if (control.get('id')[0:3] == 'LMD'):
Domoticz.Log('control id: ' + control.get('id')[4:] + ', code: ' + control.get('code'))
示例8: setSelectorByCode
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def setSelectorByCode(intId, strCode):
Domoticz.Log("Onkyo: setSelectorByCode code: "+strCode)
dictOptions = Devices[intId].Options
Domoticz.Log("Onkyo: Fetched Options")
Domoticz.Log("Onkyo: options: "+dictOptions['LevelNames'])
listLevelNames = dictOptions['LevelNames'].split('|')
intLevel = 0
Domoticz.Log("Onkyo: Starting Loop")
for strLevelName in listLevelNames:
Domoticz.Log(strLevelName[1:3])
if strLevelName[1:3] == strCode:
Domoticz.Log("Onkyo: found level: +"+str(intLevel))
Devices[intId].Update(1,str(intLevel))
return True
intLevel += 10
return False
示例9: onMessage
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onMessage(self, Connection, Data, Status, Extra):
#Domoticz.Debug("Received: " + str(Data))
command = json.loads(Data.decode("utf-8"))
#Domoticz.Log("Command: " + command['action'])
if command['status'] == "Ok":
action = command['action']
if action == "setConfig":
# Config set
Connection.Send(Message=json.dumps({"action":"getLights"}).encode(encoding='utf_8'), Delay=1)
if action == "getLights":
self.registerDevices(command['result'])
if action == "deviceUpdate":
self.updateDeviceState(command['result'])
if command['status'] == "Failed":
Domoticz.Log("Command {0} failed with error: {1}.".format(command['action'],command['error']))
Domoticz.Log(str(command))
示例10: onStop
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onStop(self):
Domoticz.Log("onStop called")
Domoticz.Debugging(0)
示例11: onConnect
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onConnect(self, Status, Description):
Domoticz.Log("onConnect called")
示例12: onMessage
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onMessage(self, Data, Status, Extra):
Domoticz.Log("onMessage called")
示例13: onCommand
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onCommand(self, Unit, Command, Level, Hue):
Domoticz.Log(
"onCommand called for Unit " + str(Unit) + ": Parameter '" + str(Command) + "', Level: " + str(Level))
示例14: onNotification
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def onNotification(self, Name, Subject, Text, Status, Priority, Sound, ImageFile):
Domoticz.Log("Notification: " + Name + "," + Subject + "," + Text + "," + Status + "," + str(
Priority) + "," + Sound + "," + ImageFile)
示例15: UpdateDevice
# 需要导入模块: import Domoticz [as 别名]
# 或者: from Domoticz import Log [as 别名]
def UpdateDevice(Unit, nValue, sValue, AlwaysUpdate=False):
# Make sure that the Domoticz device still exists (they can be deleted) before updating it
if Unit in Devices:
if Devices[Unit].nValue != nValue or Devices[Unit].sValue != sValue or AlwaysUpdate == True:
Devices[Unit].Update(nValue, str(sValue))
Domoticz.Log("Update " + Devices[Unit].Name + ": " + str(nValue) + " - '" + str(sValue) + "'")
return
# Synchronise images to match parameter in hardware page