def actionControlDevice(self, action, dev):
if action.deviceAction == indigo.kDeviceAction.Unlock:
self.logger.debug(u"actionControlDevice: \"%s\" Unlock" % dev.name)
self.changeDevice(dev, kDoorOpen)
elif action.deviceAction == indigo.kDeviceAction.Lock:
self.logger.debug(u"actionControlDevice: \"%s\" Lock" % dev.name)
self.changeDevice(dev, kDoorClose)
elif action.deviceAction == indigo.kDeviceAction.RequestStatus:
self.logger.debug(u"actionControlDevice: \"%s\" Request Status" % dev.name)
self.getDevices()
else:
self.logger.error(u"actionControlDevice: \"%s\" Unsupported action requested: %s" % (dev.name, str(action)))
FlyingDiver wrote:elif action.deviceAction == indigo.kDeviceAction.RequestStatus:
self.logger.debug(u"actionControlDevice: \"%s\" Request Status" % dev.name)
self.getDevices()
###### STATUS REQUEST ######
elif action.deviceAction == indigo.kDeviceAction.RequestStatus:
if dev.deviceTypeId == RA_PHANTOM_BUTTON:
phantom_button = dev.pluginProps[PROP_BUTTON]
integration_id = dev.pluginProps[PROP_REPEATER]
sendCmd = ("?DEVICE," + str(int(integration_id)) + ","+ str(int(phantom_button)) + ",9,")
elif dev.deviceTypeId == RA_KEYPAD:
keypad = dev.pluginProps[PROP_KEYPAD]
keypadButton = dev.pluginProps[PROP_KEYPADBUT]
if (int(keypadButton) > 80):
sendCmd = ("?DEVICE," + keypad + "," + str(int(keypadButton)) + ",9")
else:
sendCmd = ("?DEVICE," + keypad + "," + str(int(keypadButton)+80) + ",9")
elif dev.deviceTypeId == RA_DIMMER:
integration_id = dev.pluginProps[PROP_ZONE]
sendCmd = ("?OUTPUT," + integration_id + ",1,")
elif dev.deviceTypeId == RA_SHADE:
integration_id = dev.pluginProps[PROP_SHADE]
sendCmd = ("?OUTPUT," + integration_id + ",1,")
elif dev.deviceTypeId == RA_SWITCH:
integration_id = dev.pluginProps[PROP_SWITCH]
sendCmd = ("?OUTPUT," + integration_id + ",1,")
elif dev.deviceTypeId == RA_CCI:
self.logger.info(u"This device does not respond to Status Requests")
elif dev.deviceTypeId == RA_CCO:
cco = dev.pluginProps[PROP_CCO_INTEGRATION_ID]
ccoType = dev.pluginProps[PROP_CCO_TYPE]
if ccoType == "momentary":
self.logger.info(u"Momentary CCOs do not respond to Status Requests")
else:
sendCmd = ("?OUTPUT," + cco + ",1,")
if len(sendCmd):
self._sendCommand(sendCmd)
self.logger.debug(u"actionControlDimmerRelay sent: \"%s\" %s %s" % (dev.name, dev.onState, sendCmd))
def actionControlDevice(self, action, dev):
Users browsing this forum: No registered users and 4 guests