本文整理匯總了Python中Domoticz.Debugging方法的典型用法代碼示例。如果您正苦於以下問題:Python Domoticz.Debugging方法的具體用法?Python Domoticz.Debugging怎麽用?Python Domoticz.Debugging使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Domoticz
的用法示例。
在下文中一共展示了Domoticz.Debugging方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [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()
示例2: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [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
示例3: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
try:
self.logLevel = int(Parameters["Mode6"])
except:
self.LogError("Debuglevel '"+Parameters["Mode6"]+"' is not an integer")
if self.logLevel == 10:
Domoticz.Debugging(1)
self.LogMessage("onStart called", 9)
Domoticz.Heartbeat(int(Parameters["Mode2"]))
if (len(Devices) == 0):
Domoticz.Device(Name="Free space", Unit=1, TypeName="Custom", Image=3, Options={"Custom": ("1;" + Parameters["Mode1"])}).Create()
Domoticz.Device(Name="Temperature", Unit=2, Type=80, Subtype=5, Switchtype=0, Image=0).Create()
elif 1 in Devices:
Devices[1].Update(0, "0", Options={"Custom": ("1;" + Parameters["Mode1"])})
self.DumpConfigToLog()
return
示例4: onStop
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStop(self):
Domoticz.Log("onStop called")
Domoticz.Debugging(0)
示例5: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart():
global _pico
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
Domoticz.Heartbeat(20)
for dev, cfg in deviceDict.items():
if not dev in Devices:
Domoticz.Device(Name=cfg["Name"], Unit=cfg["Unit"], TypeName=cfg["TypeName"]).Create()
Domoticz.Log("Device created: " + cfg["Name"])
result = _pico.getData()
#Domoticz.Log("reg 0x69 0-0x26:" + str(data) + "\nlength:" + str(len(data)))
Domoticz.Log("PCB version: " + _pico.picoData["verPCB"])
Domoticz.Log("Bootloader version: " + _pico.picoData["verBoot"])
Domoticz.Log("FW version: " + str(_pico.picoData["verFW"]))
Domoticz.Log("Bat Powering running time (min): " + str(_pico.picoData["pwrRunTime"]))
Domoticz.Debug("-" * 20)
Domoticz.Debug("BAT Voltage: " + str(_pico.picoData["voltBat"]))
Domoticz.Debug("RPi Voltage: " + str(_pico.picoData["voltRpi"]))
Domoticz.Debug("NTC1 Temperature: " + str(_pico.picoData["tempNtc1"]))
Domoticz.Debug("Powering Mode: " + _pico.picoData["pwrMode"])
Domoticz.Debug("User LED Orange: " + str(_pico.picoData["ledOrange"]))
Domoticz.Debug("User LED Green: " + str(_pico.picoData["ledGreen"]))
Domoticz.Debug("User LED Blue: " + str(_pico.picoData["ledBlue"]))
Domoticz.Debug("Enable LEDs: " + str(_pico.picoData["ledEnable"]))
if result:
UpdateDevice(1, 0, str(_pico.picoData["voltBat"]), updEvery=True)
UpdateDevice(2, 0, str(_pico.picoData["voltRpi"]), updEvery=True)
UpdateDevice(3, 0, str(_pico.picoData["tempNtc1"]), updEvery=True)
UpdateDevice(4, 0, _pico.picoData["pwrMode"])
UpdateDevice(5, _pico.picoData["ledOrange"], "0")
UpdateDevice(6, _pico.picoData["ledGreen"], "0")
UpdateDevice(7, _pico.picoData["ledBlue"], "0")
UpdateDevice(8, _pico.picoData["ledEnable"], "0")
#DumpConfigToLog()
示例6: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
Domoticz.Debug("onStart called")
if Parameters["Mode6"] == 'Debug':
self.debug = True
Domoticz.Debugging(1)
DumpConfigToLog()
else:
Domoticz.Debugging(0)
# load custom icons
for key, value in icons.items():
if key not in Images:
Domoticz.Image(value).Create()
Domoticz.Debug("Added icon: " + key + " from file " + value)
Domoticz.Debug("Number of icons loaded = " + str(len(Images)))
for image in Images:
Domoticz.Debug("Icon " + str(Images[image].ID) + " " + Images[image].Name)
# check polling interval parameter
try:
temp = int(Parameters["Mode2"])
except:
Domoticz.Error("Invalid polling interval parameter")
else:
if temp < 1:
temp = 1 # minimum polling interval
Domoticz.Error("Specified polling interval too short: changed to 1 hour")
elif temp > 24:
temp = 24 # maximum polling interval is 1 day
Domoticz.Error("Specified polling interval too long: changed to 24 hours")
self.updatefrequency = temp
Domoticz.Log("Using polling interval of {} hour(s)".format(str(self.updatefrequency)))
# get the Prevair station
if Parameters["Mode1"] == "":
station = False
else:
station = Parameters["Mode1"]
ListLL = Settings["Location"].split(";", 1)
Latitude = float(ListLL[0])
Longitude = float(ListLL[1])
self.stationcode, self.stationINSEE, self.stationname, self.stationdistance = getStation(
station, Latitude, Longitude)
Domoticz.Log("using station {}/{} {} at {}km".format(
self.stationcode, self.stationINSEE, self.stationname, self.stationdistance))
# create (if needed) the device to display the selected station details
if not (99 in Devices):
Domoticz.Device(Name="PrevAir Station", Unit=99, TypeName="Text",
Used=1).Create()
# update the device
try:
Devices[99].Update(nValue=0, sValue=self.stationname + " ({}/{}) at {}km".format(
self.stationcode, self.stationINSEE, self.stationdistance))
except:
Domoticz.Error("Failed to update device unit 99")
示例7: onStop
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStop(self):
Domoticz.Debug("onStop called")
Domoticz.Debugging(0)
示例8: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
Domoticz.Debug("onStart called")
if 1 not in Devices:
Domoticz.Debug("Create Status Device")
Domoticz.Device(Name="Status", Unit=1, Type=17, Switchtype=17, Used=1).Create()
if 2 not in Devices:
Domoticz.Debug("Create Volume Device")
Domoticz.Device(Name="Volume", Unit=2, Type=244, Subtype=73, Switchtype=7, Image=8, Used=1).Create()
if 3 not in Devices:
Domoticz.Debug("Create HDMI Device")
Options = { "LevelActions" : "|||||||",
"LevelNames" : "Off|HDMI1|HDMI2|HDMI3|HDMI4|HDMI5|HDMI6|HDMI7",
"LevelOffHidden" : "true",
"SelectorStyle" : "0"
}
Domoticz.Device(Name="Source", Unit=3, TypeName="Selector Switch", Switchtype=18, Options=Options, Used=1).Create()
if 4 not in Devices:
Domoticz.Debug("Create AV Device")
Options = { "LevelActions" : "||||||",
"LevelNames" : "Off|AV1|AV2|AV3|AV4|AV5|AV6",
"LevelOffHidden" : "true",
"SelectorStyle" : "0"
}
Domoticz.Device(Name="AV Source", Unit=4, TypeName="Selector Switch", Switchtype=18, Options=Options, Used=1).Create()
self.connection = Domoticz.Connection(Name="Yamaha connection", Transport="TCP/IP", Protocol="Line", Address=Parameters["Address"], Port=Parameters["Port"])
self.connection.Connect()
Domoticz.Heartbeat(20)
示例9: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
if Parameters["Mode6"] == "Debug":
self.blDebug = True
Domoticz.Debugging(1)
if (self.blDebug == True):
Domoticz.Log("Onkyo: onStart called")
Domoticz.Heartbeat(2) # Lower hartbeat interval, to speed up the initialization.
示例10: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
# Domoticz.Log("onStart called")
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
Domoticz.Heartbeat(2)
if len(Devices) > 0:
# Some devices are already defined
for aUnit in Devices:
self.lights[Devices[aUnit].DeviceID] = {"DeviceID": Devices[aUnit].DeviceID, "Unit": aUnit}
self.connectToAdaptor()
示例11: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
try:
self.logLevel = int(Parameters["Mode6"])
except:
self.LogError("Debuglevel '"+Parameters["Mode6"]+"' is not an integer")
if self.logLevel == 10:
Domoticz.Debugging(1)
else:
Domoticz.Heartbeat(20)
try:
self.priority = int(Parameters["Mode1"])
if self.priority<0:
self.LogError("Priority is smaller than 0 ("+Parameters["Mode1"]+") this is not allowed, using 1 as priority")
self.priority = 1
except:
self.LogError("Priority '"+Parameters["Mode1"]+"' is not an integer, using 1 as priority")
self.LogMessage("onStart called", 9)
self.connection = Domoticz.Connection(Name="Hyperion", Transport="TCP/IP", Protocol="None", Address=Parameters["Address"], Port=Parameters["Port"])
# ICONS
if ("HyperionLedRed" not in Images): Domoticz.Image('HyperionLedRed.zip').Create()
if ("HyperionLedBlue" not in Images): Domoticz.Image('HyperionLedBlue.zip').Create()
if ("HyperionLedGreen" not in Images): Domoticz.Image('HyperionLedGreen.zip').Create()
if (1 not in Devices):
Domoticz.Device(Name="Red", Unit=1, Type=244, Subtype=73, Switchtype=7, Image=Images["HyperionLedRed"].ID).Create()
if (2 not in Devices):
Domoticz.Device(Name="Green", Unit=2, Type=244, Subtype=73, Switchtype=7, Image=Images["HyperionLedGreen"].ID).Create()
if (3 not in Devices):
Domoticz.Device(Name="Blue", Unit=3, Type=244, Subtype=73, Switchtype=7, Image=Images["HyperionLedBlue"].ID).Create()
# Devices for color picking do no work since it will not return RGB / HSV values....
#Domoticz.Device(Name="RGB Light", Unit=7, Type=241, Subtype=2, Switchtype=7).Create()
#Domoticz.Device(Name="Saturatie", Unit=8, Type=244, Subtype=73, Switchtype=7).Create()
# set default values:
for i in range(1,4):
try:
self.dimmerValues[i-1] = int(Devices[i].sValue.strip('\''))
except:
pass
self.currentColor[i-1] = self.uiToRGB(self.dimmerValues[i-1])
self.LogMessage("Started current status: " + str(self.currentColor) + " dimmer values: " + str(self.dimmerValues), 2 )
self.DumpConfigToLog()
return
示例12: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
try:
self.logLevel = int(Parameters["Mode6"])
except:
self.LogError("Debuglevel '"+Parameters["Mode6"]+"' is not an integer")
if self.logLevel == 10:
Domoticz.Debugging(1)
else:
Domoticz.Heartbeat(20)
self.LogMessage("onStart called", 9)
self.connection = Domoticz.Connection(Name="LedenetBinair", Transport="TCP/IP", Protocol="None", Address=Parameters["Address"], Port=Parameters["Port"])
# ICONS
if ("LedenetAutoLight" not in Images): Domoticz.Image('LedenetAutoLight.zip').Create()
if ("LedenetLedRed" not in Images): Domoticz.Image('LedenetLedRed.zip').Create()
if ("LedenetLedBlue" not in Images): Domoticz.Image('LedenetLedBlue.zip').Create()
if ("LedenetLedGreen" not in Images): Domoticz.Image('LedenetLedGreen.zip').Create()
if ("LedenetLedYellow" not in Images): Domoticz.Image('LedenetLedYellow.zip').Create()
# 241 = limitless, subtype 2= RGB/ 1= RGBW, switchtype 7 = philip
# Devices for color picking do no work since it will not return RGB / HSV values....
#Domoticz.Device(Name="RGB Light", Unit=7, Type=241, Subtype=2, Switchtype=7).Create()
#Domoticz.Device(Name="Saturatie", Unit=8, Type=244, Subtype=73, Switchtype=7).Create()
if (1 not in Devices):
Domoticz.Device(Name="Red", Unit=1, Type=244, Subtype=73, Switchtype=7, Image=Images["LedenetLedRed"].ID).Create()
if (2 not in Devices):
Domoticz.Device(Name="Green", Unit=2, Type=244, Subtype=73, Switchtype=7, Image=Images["LedenetLedGreen"].ID).Create()
if (3 not in Devices):
Domoticz.Device(Name="Blue", Unit=3, Type=244, Subtype=73, Switchtype=7, Image=Images["LedenetLedBlue"].ID).Create()
if (4 not in Devices):
Domoticz.Device(Name="White", Unit=4, Type=244, Subtype=73, Switchtype=7, Image=Images["LedenetLedYellow"].ID).Create()
if (5 not in Devices):
Domoticz.Device(Name="Autolight", Unit=5, TypeName="Switch", Image=Images["LedenetAutoLight"].ID).Create()
if (6 not in Devices):
Domoticz.Device(Name="Power", Unit=6, TypeName="Switch").Create()
# autolight is not saves in the devices itself
self.autolight = Devices[5].nValue != 0
if self.autolight:
now = datetime.now()
sunset = self.volgendeZonondergang()
if sunset > now:
self.LogMessage("Autolight enabled, while no sunset yet ("+str(sunset)+"). Disable LED after connected", 1 )
self.mustForceOff = True
# set default values:
self.currentStatus[0] = False
for i in range(1,5):
try:
self.dimmerValues[i] = int(Devices[i].sValue.strip('\''))
except:
pass
self.currentStatus[i] = self.uiToRGB(self.dimmerValues[i])
self.LogMessage("Started current status: " + str(self.currentStatus) + " dimmer values: " + str(self.dimmerValues), 2 )
self.DumpConfigToLog()
return
示例13: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
try:
self.logLevel = int(Parameters["Mode6"])
except:
self.LogError("Debuglevel '"+Parameters["Mode6"]+"' is not an integer")
if self.logLevel == 10:
Domoticz.Debugging(1)
self.LogMessage("onStart called", 9)
# self.connection = ...
if (self.regexMac.match(Parameters["Mode1"] )):
self.mac = Parameters["Mode1"]
# replace separators
if len(self.mac) == 12 + 5:
sep = self.mac[2]
self.mac = self.mac.replace(sep, '')
if (self.regexIp.match(Parameters["Address"] )):
self.ip = Parameters["Address"]
else:
self.LogError("'"+Parameters["Address"]+"' is not a valid IP adress." )
self.arping = (Parameters["Mode5"] == "arping")
self.tempFile = Parameters["Mode4"] + "ping_"+Parameters["Address"]
self.LogMessage( "Temp file: " + self.tempFile, 1)
try:
self.wolport = int(Parameters["Port"])
except Exception as e:
self.LogError("Port is not a number: "+ Parameters["Port"])
try:
self.maxOutstandingMessages = int(Parameters["Mode3"])
except Exception as e:
self.LogError("Max missed is not a number: "+ Parameters["Mode3"])
try:
Domoticz.Heartbeat(int(Parameters["Mode2"]))
except:
pass
# initial cleanup
if (os.path.isfile(self.tempFile)):
subprocess.call('sudo chmod +wr '+ self.tempFile , shell=True)
os.remove(self.tempFile)
# create a switch
if (len(Devices) == 0):
Domoticz.Device(Name="Device", Unit=1, TypeName="Switch").Create()
self.lastState = Devices[1].nValue != 0
self.DumpConfigToLog()
return
示例14: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
try:
self.logLevel = int(Parameters["Mode6"])
except:
self.LogError("Debuglevel '"+Parameters["Mode6"]+"' is not an integer")
if self.logLevel == 10:
Domoticz.Debugging(1)
self.LogMessage("onStart called", 9)
self.connection = Domoticz.Connection(Name="Hosola_OmnikBinair", Transport="TCP/IP", Protocol="None", Address=Parameters["Address"], Port=Parameters["Port"])
maxOutstandingMessages = int(Parameters["Mode2"])
Domoticz.Heartbeat(int(Parameters["Mode3"]))
self.createInverterId()
# add temperature if not exists
if (1 not in Devices):
Domoticz.Device(Name="Temperature", Unit=1, Type=80, Subtype=5, Switchtype=0, Image=0).Create()
# get total energy
if (4 in Devices):
self.totalEnergy = self.GetTotalEnergy(Devices[4].sValue)
elif (7 in Devices):
self.totalEnergy = self.GetTotalEnergy(Devices[7].sValue)
elif (10 in Devices):
self.totalEnergy = self.GetTotalEnergy(Devices[10].sValue)
self.LogMessage("Current total energy: "+str(self.totalEnergy), 1)
# id 1= temp
# id 2= VAC phase 1
# id 3= VDC phase 1
# id 4= Power phase 1
# id 5= VAC phase 2
# id 6= VDC phase 2
# id 7= Power phase 2
# id 8= VAC phase 3
# id 9= VDC phase 3
# id 10= Power phase 3
#self.checkConnection()
self.DumpConfigToLog()
return
示例15: onStart
# 需要導入模塊: import Domoticz [as 別名]
# 或者: from Domoticz import Debugging [as 別名]
def onStart(self):
global icons
Domoticz.Debug("onStart called")
if Parameters["Mode6"] == 'Debug':
self.debug = True
Domoticz.Debugging(1)
DumpConfigToLog()
else:
Domoticz.Debugging(0)
# load custom battery images
for key, value in icons.items():
if key not in Images:
Domoticz.Image(value).Create()
Domoticz.Debug("Added icon: " + key + " from file " + value)
Domoticz.Debug("Number of icons loaded = " + str(len(Images)))
for image in Images:
Domoticz.Debug("Icon " + str(Images[image].ID) + " " + Images[image].Name)
# check polling interval parameter
try:
temp = int(Parameters["Mode1"])
except:
Domoticz.Error("Invalid polling interval parameter")
else:
if temp < 30:
temp = 30 # minimum polling interval
Domoticz.Error("Specified polling interval too short: changed to 30 minutes")
elif temp > 1440:
temp = 1440 # maximum polling interval is 1 day
Domoticz.Error("Specified polling interval too long: changed to 1440 minutes (24 hours)")
self.pollinterval = temp
Domoticz.Log("Using polling interval of {} minutes".format(str(self.pollinterval)))
# find zwave controller(s)... only one active allowed !
self.error = True
controllers = glob.glob("./Config/zwcfg_0x????????.xml")
if not controllers:
# test if we are running on a synology (different file locations)
controllers = glob.glob("/volume1/@appstore/domoticz/var/zwcfg_0x????????.xml")
for controller in controllers:
lastmod = datetime.fromtimestamp(os.stat(controller).st_mtime)
if lastmod < datetime.now() - timedelta(hours=2):
Domoticz.Error("Ignoring controller {} since presumed dead (not updated for more than 2 hours)".format(controller))
else:
self.zwaveinfofilepath = controller
self.error = False
break
if self.error:
Domoticz.Error("Enable to find a zwave controller configuration file !")