def humidity_sensor_device(device_uid: str) -> Zwave: """ Represent a humidity sensor :param device_uid: Device UID this mock shall have :return: Humidity sensor device """ file = pathlib.Path(__file__).parent / ".." / "test_data.json" with file.open("r") as fh: test_data = json.load(fh) mydevolo = Mydevolo() device = Zwave(mydevolo_instance=mydevolo, **test_data.get("devices").get("humidity")) gateway = MockGateway(test_data.get("gateway").get("id"), mydevolo=mydevolo) session = requests.Session() device.binary_sensor_property = {} device.humidity_bar_property = {} device.multi_level_sensor_property = {} device.settings_property = {} element_uid = f'devolo.DewpointSensor:{device_uid}' device.multi_level_sensor_property[element_uid] = \ MultiLevelSensorProperty(gateway=gateway, session=session, mydevolo=mydevolo, element_uid=element_uid, value=test_data.get("devices").get("humidity").get("dewpoint")) element_uid = f'devolo.MildewSensor:{device_uid}' device.binary_sensor_property[element_uid] = \ BinarySensorProperty(gateway=gateway, session=session, mydevolo=mydevolo, element_uid=element_uid, state=test_data.get("devices").get("humidity").get("mildew")) element_uid = f'devolo.HumidityBar:{device_uid}' device.humidity_bar_property[element_uid] = \ HumidityBarProperty(gateway=gateway, session=session, mydevolo=mydevolo, element_uid=element_uid, zone=test_data.get("devices").get("humidity").get("zone"), value=test_data.get("devices").get("humidity").get("value")) device.settings_property["general_device_settings"] = \ SettingsProperty(gateway=gateway, session=session, mydevolo=mydevolo, element_uid=f'gds.{test_data.get("devices").get("humidity").get("uid")}', icon=test_data.get("devices").get("humidity").get("icon"), name=test_data.get("devices").get("humidity").get("itemName"), zone_id=test_data.get("devices").get("humidity").get("zoneId")) return device
def multi_level_sensor_device(device_uid: str) -> Zwave: """ Represent a Multi Level Sensor :param device_uid: Device UID this mock shall have :return: Multi Level Sensor device """ file = pathlib.Path(__file__).parent / ".." / "test_data.json" with file.open("r") as fh: test_data = json.load(fh) mydevolo = Mydevolo() device = Zwave(mydevolo_instance=mydevolo, **test_data.get("devices").get("sensor")) device.binary_sensor_property = {} device.multi_level_sensor_property = {} device.settings_property = {} element_uid = f"devolo.BinarySensor:{device_uid}" device.binary_sensor_property[element_uid] = BinarySensorProperty( element_uid=element_uid, state=test_data.get("devices").get("sensor").get("state")) element_uid = f"devolo.MultiLevelSensor:{device_uid}#MultilevelSensor(1)" device.multi_level_sensor_property[element_uid] = MultiLevelSensorProperty( element_uid=element_uid, value=test_data.get("devices").get("sensor").get("value"), unit=test_data.get("devices").get("sensor").get("unit")) device.settings_property['temperature_report'] = SettingsProperty( element_uid=f"trs.{device_uid}", setter=lambda uid, state: True, temp_report=test_data.get("devices").get("sensor").get("temp_report")) device.settings_property['motion_sensitivity'] = SettingsProperty( element_uid=f"mss.{device_uid}", setter=lambda uid, state: True, motion_sensitivity=test_data.get("devices").get("sensor").get( "motion_sensitivity")) device.settings_property["general_device_settings"] = SettingsProperty( element_uid=f'gds.{device_uid}', setter=lambda uid, state: None, icon=test_data.get("devices").get("sensor").get("icon"), name=test_data.get("devices").get("sensor").get("itemName"), zone_id=test_data.get("devices").get("sensor").get("zoneId"), zones=test_data.get("gateway").get("zones")) return device