def __simulatedEventTriggered(self): if self.parameters["operation"] == "TEMPERATURE_IN_RANGE": currentScale = "F" if self.parameters["simulationParameters"]["externalTemperature"]: convTemp = float(self.parameters["simulationParameters"]["externalTemperature"].replace(currentScale, "").strip()) else: convTemp = getSimulationValue("externalTemperature", self.parameters["simulationParameters"]["time"], None) if convTemp >= float(self.parameters['0'].upper().replace(currentScale, "").strip()) and convTemp <= float(self.parameters['1'].upper().replace(currentScale, "").strip()): return True else: return False elif self.parameters["operation"] == "CHECK_SUNNY": if self.parameters["simulationParameters"]["weather"]: return True if self.parameters["simulationParameters"]["weather"].upper() == "SUNNY" else False else: return True if getSimulationValue("weather", self.parameters["simulationParameters"]["time"], None) == "SUNNY" else False elif self.parameters["operation"] == "CHECK_RAINY": if self.parameters["simulationParameters"]["weather"]: return True if self.parameters["simulationParameters"]["weather"].upper() == "RAINY" else False else: return True if getSimulationValue("weather", self.parameters["simulationParameters"]["time"], None) == "RAINY" else False elif self.parameters["operation"] == "CHECK_CLOUDY": if self.parameters["simulationParameters"]["weather"]: return True if self.parameters["simulationParameters"]["weather"].upper() == "CLOUDY" else False else: return True if getSimulationValue("weather", self.parameters["simulationParameters"]["time"], None) == "CLOUDY" else False
def __simulatedEventTriggered(self): if self.parameters["operation"] == "CHECK_PRESENCE": if self.parameters["simulationParameters"]["occupancy"]: return bool(self.parameters["simulationParameters"]["occupancy"]) else: return getSimulationValue("occupancy", self.parameters["simulationParameters"]["time"], None) elif self.parameters["operation"] == "CHECK_ABSENCE": if self.parameters["simulationParameters"]["occupancy"]: return not bool(self.parameters["simulationParameters"]["occupancy"]) else: return not getSimulationValue("occupancy", self.parameters["simulationParameters"]["time"], None) elif self.parameters["operation"] == "TEMPERATURE_IN_RANGE": currentScale = "F" if self.parameters["simulationParameters"]["roomTemperature"]: temperature = float(self.parameters["simulationParameters"]["roomTemperature"].replace(currentScale, "").strip()) else: temperature = getSimulationValue("roomTemperature", self.parameters["simulationParameters"]["time"], None) if temperature >= float(self.parameters['0'].upper().replace(currentScale, "").strip()) and temperature <= float(self.parameters['1'].upper().replace(currentScale, "").strip()): return True else: return False