def ELV_getrooms(self, oSetting, oAction, dParams): #check """ Returns a list of rooms :param cInterface.cInterFaceSettings oSetting: The setting object :param cAction oAction: The action object (unused) :param dict dParams: The parameter (unused) :return: list: A list of dicts: key:name=room name , rf_address= Rf Address of Room :rtype: list """ aRet = [] i = 0 for oRoom in oSetting.oDevice.rooms: dLine = QueryDict() dLine.uVarSuffix = "[" + str(i) + "]" dLine.dValue = { "name": oRoom.name, "rf_address": str(oRoom.rf_address) } aRet.append(dLine) i = i + 1 return aRet
def _ELV_getroomdevices(self, oSetting, oAction, dParams, bAddRoom): #check """ Internal Helper function to get a list of devices of a room :param cInterface.cInterFaceSettings oSetting: The setting object :param cAction oAction: The action object (unused) :param dict dParams: The parameter, needs to include room :param boolean bAddRoom: Flag to include the room name as first element :return: list: A list of dicts: key:name=room name , rf_address= Rf Address of Room :rtype: list """ aRet = [] i = 0 uRoom = ReplaceVars(dParams["room"], self.uInterFaceName + u'/' + oSetting.uConfigName) aTmpDestVar = ToList(oAction.uGlobalDestVar) for uVarName in aTmpDestVar: Var_DelArray(uVarName=uVarName + u'[]') for oRoom in oSetting.oDevice.rooms: if oRoom.name == uRoom: if bAddRoom: dLine = QueryDict() dLine.uVarSuffix = "[" + str(i) + "]" dLine.dValue = {} uRfAddress = str(oRoom.rf_address) dLine.dValue = { "name": oRoom.name, "rf_address": uRfAddress } aRet.append(dLine) i = i + 1 for oDevice in oSetting.oDevice.devices_by_room(oRoom): dLine = QueryDict() dLine.uVarSuffix = "[" + str(i) + "]" uRfAddress = str(oDevice.rf_address) dLine.dValue = {} dLine.dValue["name"] = oDevice.name dLine.dValue["rf_address"] = str(uRfAddress) aRet.append(dLine) i = i + 1 break return aRet
def _CreateSimpleResult(self, uResult): """ Helper Function to create a simple one line result :param uResult: :return: a dict key:result=Result :rtype: QueryDict """ aRet = [] dLine = QueryDict() dLine.uVarSuffix = "" dLine.dValue = {"result": uResult} aRet.append(dLine) return aRet