def switch(self, state, idx):
"""Switch the device in Domoticz."""
try:
f = urllib.urlopen(self.url + "/json.htm?type=command¶m=switchlight&idx=" + str(idx) + "&switchcmd=" + str(state).title())
response = f.read()
LOGGER.debug(str(response))
return response
except IOError as e:
LOGGER.error(str(e) + ' : ' + str(e.read()))
评论列表
文章目录