當前位置: 首頁>>代碼示例>>Python>>正文


Python Domoticz.Log方法代碼示例

本文整理匯總了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) 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:18,代碼來源:plugin.py

示例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() 
開發者ID:milanvo,項目名稱:domoticz-plugins,代碼行數:24,代碼來源:plugin.py

示例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 
開發者ID:rvdvoorde,項目名稱:domoticz-homewizard,代碼行數:22,代碼來源:plugin.py

示例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... 
開發者ID:rvdvoorde,項目名稱:domoticz-homewizard,代碼行數:24,代碼來源:plugin.py

示例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) 
開發者ID:jorgh6,項目名稱:domoticz-onkyo-plugin,代碼行數:23,代碼來源:plugin.py

示例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 
開發者ID:jorgh6,項目名稱:domoticz-onkyo-plugin,代碼行數:23,代碼來源:plugin.py

示例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')) 
開發者ID:jorgh6,項目名稱:domoticz-onkyo-plugin,代碼行數:26,代碼來源:plugin.py

示例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 
開發者ID:jorgh6,項目名稱:domoticz-onkyo-plugin,代碼行數:18,代碼來源:plugin.py

示例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)) 
開發者ID:moroen,項目名稱:IKEA-Tradfri-plugin,代碼行數:23,代碼來源:plugin.py

示例10: onStop

# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Log [as 別名]
def onStop(self):
        Domoticz.Log("onStop called")
        Domoticz.Debugging(0) 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:5,代碼來源:plugin.py

示例11: onConnect

# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Log [as 別名]
def onConnect(self, Status, Description):
        Domoticz.Log("onConnect called") 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:4,代碼來源:plugin.py

示例12: onMessage

# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Log [as 別名]
def onMessage(self, Data, Status, Extra):
        Domoticz.Log("onMessage called") 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:4,代碼來源:plugin.py

示例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)) 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:5,代碼來源:plugin.py

示例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) 
開發者ID:lrybak,項目名稱:domoticz-airly,代碼行數:5,代碼來源:plugin.py

示例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 
開發者ID:gerard33,項目名稱:sonos,代碼行數:11,代碼來源:plugin.py


注:本文中的Domoticz.Log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。