From 2374edffdb32ab5286f0fac0852447b69dc515da Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Sun, 7 May 2023 20:46:51 +0000 Subject: [PATCH] Make last activity timezone aware --- .github/workflows/pythonpackage.yml | 2 +- devolo_home_control_api/devices/gateway.py | 8 + devolo_home_control_api/homecontrol.py | 59 ++++- devolo_home_control_api/mydevolo.py | 11 + .../properties/binary_sensor_property.py | 11 +- .../properties/binary_switch_property.py | 9 +- .../properties/consumption_property.py | 17 +- .../properties/humidity_bar_property.py | 9 +- .../properties/multi_level_sensor_property.py | 9 +- .../properties/multi_level_switch_property.py | 11 +- .../properties/property.py | 8 +- .../properties/remote_control_property.py | 9 +- .../properties/sensor_property.py | 7 +- .../properties/settings_property.py | 6 +- tests/__init__.py | 12 +- tests/conftest.py | 4 + tests/fixtures/mydevolo_gateway_location.json | 14 ++ .../fixtures/mydevolo_standard_timezone.json | 5 + tests/snapshots/test_homecontrol.ambr | 216 +++++++++--------- tests/snapshots/test_metering_plug.ambr | 22 +- tests/snapshots/test_mydevolo.ambr | 2 +- tests/snapshots/test_shutter.ambr | 12 +- tests/snapshots/test_thermostat.ambr | 128 +++++------ tests/snapshots/test_wall_switch.ambr | 18 +- tests/snapshots/test_window_contact.ambr | 68 +++--- tests/test_homecontrol.py | 34 ++- tests/test_metering_plug.py | 14 +- 27 files changed, 428 insertions(+), 297 deletions(-) create mode 100644 tests/fixtures/mydevolo_gateway_location.json create mode 100644 tests/fixtures/mydevolo_standard_timezone.json diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 801ad3a..e8f00d9 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -41,7 +41,7 @@ jobs: pylint --exit-zero --score=n --disable=E --enable=useless-suppression devolo_home_control_api - name: Lint with mypy run: | - pip install mypy types-requests types-setuptools + pip install mypy types-python-dateutil types-requests mypy --ignore-missing-imports devolo_home_control_api test: diff --git a/devolo_home_control_api/devices/gateway.py b/devolo_home_control_api/devices/gateway.py index e18b65b..e0e1d94 100644 --- a/devolo_home_control_api/devices/gateway.py +++ b/devolo_home_control_api/devices/gateway.py @@ -1,7 +1,10 @@ """The devolo Home Control Central Unit.""" import logging +from datetime import timezone from typing import Dict, Optional +from dateutil import tz + from devolo_home_control_api.exceptions import GatewayOfflineError from devolo_home_control_api.mydevolo import Mydevolo @@ -30,6 +33,11 @@ def __init__(self, gateway_id: str, mydevolo_instance: Mydevolo) -> None: self.external_access = details.get("externalAccess") self.firmware_version = details.get("firmwareVersion") + if details["location"]: + self.timezone = tz.gettz(details["location"]["timezone"]) or timezone.utc + else: + self.timezone = tz.gettz(self._mydevolo.get_timezone()) or timezone.utc + try: self.full_url: Optional[str] = self._mydevolo.get_full_url(self.id) except GatewayOfflineError: diff --git a/devolo_home_control_api/homecontrol.py b/devolo_home_control_api/homecontrol.py index 3f303d2..8b2241f 100644 --- a/devolo_home_control_api/homecontrol.py +++ b/devolo_home_control_api/homecontrol.py @@ -152,6 +152,7 @@ def _binary_sensor(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding binary sensor property to %s.", device_uid) self.devices[device_uid].binary_sensor_property[uid_info["UID"]] = BinarySensorProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, state=bool(uid_info["properties"]["state"]), sensor_type=uid_info["properties"]["sensorType"], sub_type=uid_info["properties"]["subType"], @@ -165,6 +166,7 @@ def _binary_switch(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding binary switch property to %s.", device_uid) self.devices[device_uid].binary_switch_property[uid_info["UID"]] = BinarySwitchProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_binary_switch, state=bool(uid_info["properties"]["state"]), enabled=uid_info["properties"]["guiEnabled"], @@ -176,6 +178,7 @@ def _general_device(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding general device settings to %s.", device_uid) self.devices[device_uid].settings_property["general_device_settings"] = SettingsProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_setting, events_enabled=uid_info["properties"]["settings"]["eventsEnabled"], name=uid_info["properties"]["settings"]["name"], @@ -201,7 +204,9 @@ def _humidity_bar(self, uid_info: Dict[str, Any]) -> None: self.devices[device_uid].humidity_bar_property = {} if self.devices[device_uid].humidity_bar_property.get(fake_element_uid) is None: self.devices[device_uid].humidity_bar_property[fake_element_uid] = HumidityBarProperty( - element_uid=fake_element_uid, sensorType="humidityBar" + element_uid=fake_element_uid, + tz=self.gateway.timezone, + sensorType="humidityBar", ) if uid_info["properties"]["sensorType"] == "humidityBarZone": self._logger.debug("Adding humidity bar zone property to %s.", device_uid) @@ -252,6 +257,7 @@ def _automatic_calibration(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding automatic calibration setting to %s.", device_uid) self.devices[device_uid].settings_property["automatic_calibration"] = SettingsProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_setting, calibration_status=bool(uid_info["properties"]["calibrationStatus"]), ) @@ -264,7 +270,10 @@ def _binary_sync(self, uid_info: Dict[str, Any]) -> None: device_uid = get_device_uid_from_setting_uid(uid_info["UID"]) self._logger.debug("Adding binary sync setting to %s.", device_uid) self.devices[device_uid].settings_property["movement_direction"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, inverted=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + inverted=uid_info["properties"]["value"], ) def _binary_async(self, uid_info: Dict[str, Any]) -> None: @@ -272,7 +281,10 @@ def _binary_async(self, uid_info: Dict[str, Any]) -> None: device_uid = get_device_uid_from_setting_uid(uid_info["UID"]) self._logger.debug("Adding binary async settings to %s.", device_uid) settings_property = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, value=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + value=uid_info["properties"]["value"], ) # The siren needs to be handled differently, as otherwise their binary async setting will not be named nicely @@ -309,7 +321,10 @@ def _led(self, uid_info: Dict[str, Any]) -> None: except KeyError: led_setting = uid_info["properties"]["feedback"] self.devices[device_uid].settings_property["led"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, led_setting=led_setting + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + led_setting=led_setting, ) def _meter(self, uid_info: Dict[str, Any]) -> None: @@ -320,6 +335,7 @@ def _meter(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding consumption property to %s.", device_uid) self.devices[device_uid].consumption_property[uid_info["UID"]] = ConsumptionProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, current=uid_info["properties"]["currentValue"], total=uid_info["properties"]["totalValue"], total_since=uid_info["properties"]["sinceTime"], @@ -339,7 +355,10 @@ def _multilevel_async(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding %s setting to %s.", name, device_uid) self.devices[device_uid].settings_property[name] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, value=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + value=uid_info["properties"]["value"], ) def _multilevel_sync(self, uid_info: Dict[str, Any]) -> None: @@ -350,21 +369,30 @@ def _multilevel_sync(self, uid_info: Dict[str, Any]) -> None: if self.devices[device_uid].device_model_uid == "devolo.model.Siren": self._logger.debug("Adding tone settings to %s.", device_uid) self.devices[device_uid].settings_property["tone"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, tone=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + tone=uid_info["properties"]["value"], ) # The shutter needs to be handled differently, as otherwise their multilevel sync setting will not be named nicely. elif self.devices[device_uid].device_model_uid in ("devolo.model.OldShutter", "devolo.model.Shutter"): self._logger.debug("Adding shutter duration settings to %s.", device_uid) self.devices[device_uid].settings_property["shutter_duration"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, shutter_duration=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + shutter_duration=uid_info["properties"]["value"], ) # Other devices are up to now always motion sensors. else: self._logger.debug("Adding motion sensitivity settings to %s.", device_uid) self.devices[device_uid].settings_property["motion_sensitivity"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, motion_sensitivity=uid_info["properties"]["value"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + motion_sensitivity=uid_info["properties"]["value"], ) def _multi_level_sensor(self, uid_info: Dict[str, Any]) -> None: @@ -375,6 +403,7 @@ def _multi_level_sensor(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding multi level sensor property %s to %s.", uid_info["UID"], device_uid) self.devices[device_uid].multi_level_sensor_property[uid_info["UID"]] = MultiLevelSensorProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, value=uid_info["properties"]["value"], unit=uid_info["properties"]["unit"], sensor_type=uid_info["properties"]["sensorType"], @@ -388,6 +417,7 @@ def _multi_level_switch(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding multi level switch property %s to %s.", uid_info["UID"], device_uid) self.devices[device_uid].multi_level_switch_property[uid_info["UID"]] = MultiLevelSwitchProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_multi_level_switch, value=uid_info["properties"]["value"], switch_type=uid_info["properties"]["switchType"], @@ -400,7 +430,10 @@ def _parameter(self, uid_info: Dict[str, Any]) -> None: device_uid = get_device_uid_from_setting_uid(uid_info["UID"]) self._logger.debug("Adding parameter settings to %s.", device_uid) self.devices[device_uid].settings_property["param_changed"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, param_changed=uid_info["properties"]["paramChanged"] + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + param_changed=uid_info["properties"]["paramChanged"], ) def _protection(self, uid_info: Dict[str, Any]) -> None: @@ -409,6 +442,7 @@ def _protection(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding protection settings to %s.", device_uid) self.devices[device_uid].settings_property["protection"] = SettingsProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_setting, local_switching=uid_info["properties"]["localSwitch"], remote_switching=uid_info["properties"]["remoteSwitch"], @@ -422,6 +456,7 @@ def _remote_control(self, uid_info: Dict[str, Any]) -> None: self.devices[device_uid].remote_control_property = {} self.devices[device_uid].remote_control_property[uid_info["UID"]] = RemoteControlProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_remote_control, key_count=uid_info["properties"]["keyCount"], key_pressed=uid_info["properties"]["keyPressed"], @@ -436,7 +471,10 @@ def _switch_type(self, uid_info: Dict[str, Any]) -> None: device_uid = get_device_uid_from_setting_uid(uid_info["UID"]) self._logger.debug("Adding switch type setting to %s.", device_uid) self.devices[device_uid].settings_property["switch_type"] = SettingsProperty( - element_uid=uid_info["UID"], setter=self.set_setting, value=uid_info["properties"]["switchType"] * 2 + element_uid=uid_info["UID"], + tz=self.gateway.timezone, + setter=self.set_setting, + value=uid_info["properties"]["switchType"] * 2, ) def _temperature_report(self, uid_info: Dict[str, Any]) -> None: @@ -445,6 +483,7 @@ def _temperature_report(self, uid_info: Dict[str, Any]) -> None: self._logger.debug("Adding temperature report settings to %s.", device_uid) self.devices[device_uid].settings_property["temperature_report"] = SettingsProperty( element_uid=uid_info["UID"], + tz=self.gateway.timezone, setter=self.set_setting, temp_report=uid_info["properties"]["tempReport"], target_temp_report=uid_info["properties"]["targetTempReport"], diff --git a/devolo_home_control_api/mydevolo.py b/devolo_home_control_api/mydevolo.py index e5bfce7..28d2c42 100644 --- a/devolo_home_control_api/mydevolo.py +++ b/devolo_home_control_api/mydevolo.py @@ -80,6 +80,8 @@ def get_gateway(self, gateway_id: str) -> Dict[str, Any]: except WrongUrlError: self._logger.error("Could not get full URL. Wrong gateway ID used?") raise + if details["location"]: + details["location"] = self._call(details["location"]) return details def get_full_url(self, gateway_id: str) -> str: @@ -92,6 +94,15 @@ def get_full_url(self, gateway_id: str) -> str: self._logger.debug("Getting full URL of gateway.") return self._call(f"{self.url}/v1/users/{self.uuid()}/hc/gateways/{gateway_id}/fullURL")["url"] + def get_timezone(self) -> str: + """ + Get user's standard timezone. + + :return: Standard timezone of the user based on his country settings. + """ + self._logger.debug("Getting the user's standard timezone.") + return self._call(f"{self.url}/v1/users/{self.uuid()}/standardTimezone")["timezone"] + def get_zwave_products(self, manufacturer: str, product_type: str, product: str) -> Dict[str, Any]: """ Get information about a Z-Wave device. diff --git a/devolo_home_control_api/properties/binary_sensor_property.py b/devolo_home_control_api/properties/binary_sensor_property.py index bc4ef4b..7847069 100644 --- a/devolo_home_control_api/properties/binary_sensor_property.py +++ b/devolo_home_control_api/properties/binary_sensor_property.py @@ -1,5 +1,5 @@ """Binary Sensors.""" -from datetime import datetime +from datetime import datetime, timezone, tzinfo from typing import Any from devolo_home_control_api.exceptions import WrongElementError @@ -12,18 +12,19 @@ class BinarySensorProperty(SensorProperty): Object for binary sensors. It stores the binary sensor state. :param element_uid: Element UID, something like devolo.BinarySensor:hdm:ZWave:CBC56091/24 + :param tz: Timezone the last activity is recorded in :key state: State of the binary sensor :type state: bool """ - def __init__(self, element_uid: str, **kwargs: Any) -> None: + def __init__(self, element_uid: str, tz: tzinfo, **kwargs: Any) -> None: """Initialize the binary sensor.""" if not element_uid.startswith( ("devolo.BinarySensor:", "devolo.MildewSensor:", "devolo.ShutterMovementFI:", "devolo.WarningBinaryFI:") ): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid, **kwargs) + super().__init__(element_uid, tz, **kwargs) self._state: bool = kwargs.pop("state", False) @@ -39,7 +40,7 @@ def last_activity(self, timestamp: int) -> None: They can be initialized with that value. The others stay with a default timestamp until first update. """ if timestamp != -1: - self._last_activity = datetime.utcfromtimestamp(timestamp / 1000) + self._last_activity = datetime.fromtimestamp(timestamp / 1000, tz=timezone.utc).replace(tzinfo=self._timezone) self._logger.debug("last_activity of element_uid %s set to %s.", self.element_uid, self._last_activity) @property @@ -51,5 +52,5 @@ def state(self) -> bool: def state(self, state: bool) -> None: """Update state of the binary sensor and set point in time of the last_activity.""" self._state = state - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("state of element_uid %s set to %s.", self.element_uid, state) diff --git a/devolo_home_control_api/properties/binary_switch_property.py b/devolo_home_control_api/properties/binary_switch_property.py index 187132d..a23dad6 100644 --- a/devolo_home_control_api/properties/binary_switch_property.py +++ b/devolo_home_control_api/properties/binary_switch_property.py @@ -1,5 +1,5 @@ """Binary Switches.""" -from datetime import datetime +from datetime import datetime, tzinfo from typing import Callable from devolo_home_control_api.exceptions import SwitchingProtected, WrongElementError @@ -12,6 +12,7 @@ class BinarySwitchProperty(Property): Object for binary switches. It stores the binary switch state. :param element_uid: Element UID, something like devolo.BinarySwitch:hdm:ZWave:CBC56091/24#2 + :param tz: Timezone the last activity is recorded in :param setter: Method to call on setting the state :key enabled: State of the remote protection setting :type enabled: bool @@ -19,12 +20,12 @@ class BinarySwitchProperty(Property): :type state: bool """ - def __init__(self, element_uid: str, setter: Callable[[str, bool], bool], **kwargs: bool) -> None: + def __init__(self, element_uid: str, tz: tzinfo, setter: Callable[[str, bool], bool], **kwargs: bool) -> None: """Initialize the binary switch.""" if not element_uid.startswith("devolo.BinarySwitch:"): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self._setter = setter self._state: bool = kwargs.pop("state", False) @@ -39,7 +40,7 @@ def state(self) -> bool: def state(self, state: bool) -> None: """Update state of the binary sensor and set point in time of the last_activity.""" self._state = state - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("State of %s set to %s.", self.element_uid, state) def set(self, state: bool) -> bool: diff --git a/devolo_home_control_api/properties/consumption_property.py b/devolo_home_control_api/properties/consumption_property.py index 4b91842..0e60ded 100644 --- a/devolo_home_control_api/properties/consumption_property.py +++ b/devolo_home_control_api/properties/consumption_property.py @@ -1,5 +1,5 @@ """Consumption Meters.""" -from datetime import datetime +from datetime import datetime, timezone, tzinfo from typing import Union from devolo_home_control_api.exceptions import WrongElementError @@ -12,6 +12,7 @@ class ConsumptionProperty(Property): Object for consumption meters. It stores the current and total consumption and the corresponding units. :param element_uid: Element UID, something like devolo.Meter:hdm:ZWave:CBC56091/24#2 + :param tz: Timezone the last activity is recorded in :key current: Consumption value valid at time of creating the instance :type current: float :key total: Total consumption since last reset @@ -20,18 +21,20 @@ class ConsumptionProperty(Property): :type total_since: int """ - def __init__(self, element_uid: str, **kwargs: Union[int, float]) -> None: + def __init__(self, element_uid: str, tz: tzinfo, **kwargs: Union[int, float]) -> None: """Initialize the consumption meter.""" if not element_uid.startswith("devolo.Meter:"): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self._current: float = kwargs.pop("current", 0.0) self.current_unit = "W" self._total: float = kwargs.pop("total", 0.0) self.total_unit = "kWh" - self._total_since = datetime.utcfromtimestamp(kwargs.pop("total_since", 0) / 1000) + self._total_since = datetime.fromtimestamp(kwargs.pop("total_since", 0) / 1000, tz=timezone.utc).replace( + tzinfo=self._timezone + ) @property def current(self) -> float: @@ -42,7 +45,7 @@ def current(self) -> float: def current(self, current: float) -> None: """Update current consumption and set point in time of the last_activity.""" self._current = current - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("current of element_uid %s set to %s.", self.element_uid, current) @property @@ -54,7 +57,7 @@ def total(self) -> float: def total(self, total: float) -> None: """Update total consumption and set point in time of the last_activity.""" self._total = total - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("total of element_uid %s set to %s.", self.element_uid, total) @property @@ -65,5 +68,5 @@ def total_since(self) -> datetime: @total_since.setter def total_since(self, timestamp: int) -> None: """Convert a timestamp in millisecond to a datetime object.""" - self._total_since = datetime.utcfromtimestamp(timestamp / 1000) + self._total_since = datetime.fromtimestamp(timestamp / 1000, tz=timezone.utc).replace(tzinfo=self._timezone) self._logger.debug("total_since of element_uid %s set to %s.", self.element_uid, self._total_since) diff --git a/devolo_home_control_api/properties/humidity_bar_property.py b/devolo_home_control_api/properties/humidity_bar_property.py index 04eaa8c..d1ec784 100644 --- a/devolo_home_control_api/properties/humidity_bar_property.py +++ b/devolo_home_control_api/properties/humidity_bar_property.py @@ -1,5 +1,5 @@ """Humidity Bars.""" -from datetime import datetime +from datetime import datetime, tzinfo from typing import Any from devolo_home_control_api.exceptions import WrongElementError @@ -12,18 +12,19 @@ class HumidityBarProperty(SensorProperty): Object for humidity bars. It stores the zone and the position inside that zone. :param element_uid: Fake element UID, something like devolo.HumidityBar:hdm:ZWave:CBC56091/24 + :param tz: Timezone the last activity is recorded in :key value: Position inside a zone :type value: int :key zone: Humidity zone from 0 (very dry) to 4 (very humid) :type zone: int """ - def __init__(self, element_uid: str, **kwargs: Any) -> None: + def __init__(self, element_uid: str, tz: tzinfo, **kwargs: Any) -> None: """Initialize the humidity bar.""" if not element_uid.startswith("devolo.HumidityBar:"): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid, **kwargs) + super().__init__(element_uid, tz, **kwargs) self._value: int = kwargs.pop("value", 0) self.zone: int = kwargs.pop("zone", 0) @@ -40,5 +41,5 @@ def value(self, value: int) -> None: the last activity. """ self._value = value - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("value of element_uid %s set to %s.", self.element_uid, value) diff --git a/devolo_home_control_api/properties/multi_level_sensor_property.py b/devolo_home_control_api/properties/multi_level_sensor_property.py index d318843..137473b 100644 --- a/devolo_home_control_api/properties/multi_level_sensor_property.py +++ b/devolo_home_control_api/properties/multi_level_sensor_property.py @@ -1,5 +1,5 @@ """Multi Level Sensors.""" -from datetime import datetime +from datetime import datetime, tzinfo from typing import Any from devolo_home_control_api.exceptions import WrongElementError @@ -13,13 +13,14 @@ class MultiLevelSensorProperty(SensorProperty): state in the right context. :param element_uid: Element UID, something like devolo.MultiLevelSensor:hdm:ZWave:CBC56091/24#MultilevelSensor(1) + :param tz: Timezone the last activity is recorded in :key value: Multi level value :type value: float :key unit: Unit of that value :type unit: int """ - def __init__(self, element_uid: str, **kwargs: Any) -> None: + def __init__(self, element_uid: str, tz: tzinfo, **kwargs: Any) -> None: """Initialize the multi level sensor.""" if not element_uid.startswith( ( @@ -31,7 +32,7 @@ def __init__(self, element_uid: str, **kwargs: Any) -> None: ): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid, **kwargs) + super().__init__(element_uid, tz, **kwargs) self._value: float = kwargs.pop("value", 0.0) self._unit: int = kwargs.pop("unit", 0) @@ -61,5 +62,5 @@ def value(self) -> float: def value(self, value: float) -> None: """Update value of the multilevel sensor and set point in time of the last_activity.""" self._value = value - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("value of element_uid %s set to %s.", self.element_uid, value) diff --git a/devolo_home_control_api/properties/multi_level_switch_property.py b/devolo_home_control_api/properties/multi_level_switch_property.py index 8b6553a..9bb1ea2 100644 --- a/devolo_home_control_api/properties/multi_level_switch_property.py +++ b/devolo_home_control_api/properties/multi_level_switch_property.py @@ -1,5 +1,5 @@ """Multi Level Switches.""" -from datetime import datetime +from datetime import datetime, timezone, tzinfo from typing import Any, Callable, Optional from devolo_home_control_api.exceptions import WrongElementError @@ -13,6 +13,7 @@ class MultiLevelSwitchProperty(Property): in the right context. :param element_uid: Element UID, something like devolo.Dimmer:hdm:ZWave:CBC56091/24#2 + :param tz: Timezone the last activity is recorded in :key value: Value the multi level switch has at time of creating this instance :type value: float :key switch_type: Type this switch is of, e.g. temperature @@ -23,14 +24,14 @@ class MultiLevelSwitchProperty(Property): :type min: float """ - def __init__(self, element_uid: str, setter: Callable[[str, float], bool], **kwargs: Any) -> None: + def __init__(self, element_uid: str, tz: tzinfo, setter: Callable[[str, float], bool], **kwargs: Any) -> None: """Initialize the multi level switch.""" if not element_uid.startswith( ("devolo.Blinds:", "devolo.Dimmer:", "devolo.MultiLevelSwitch:", "devolo.SirenMultiLevelSwitch:") ): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self._setter = setter self._value: float = kwargs.pop("value", 0.0) @@ -50,7 +51,7 @@ def last_activity(self, timestamp: int) -> None: level switchs. They can be initialized with that value. The others stay with a default timestamp until first update. """ if timestamp != -1: - self._last_activity = datetime.utcfromtimestamp(timestamp / 1000) + self._last_activity = datetime.fromtimestamp(timestamp / 1000, tz=timezone.utc).replace(tzinfo=self._timezone) self._logger.debug("last_activity of element_uid %s set to %s.", self.element_uid, self._last_activity) @property @@ -71,7 +72,7 @@ def value(self) -> float: def value(self, value: float) -> None: """Update value of the multilevel value and set point in time of the last_activity.""" self._value = value - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("Value of %s set to %s.", self.element_uid, value) def set(self, value: float) -> bool: diff --git a/devolo_home_control_api/properties/property.py b/devolo_home_control_api/properties/property.py index 208b9cd..7ec2ba0 100644 --- a/devolo_home_control_api/properties/property.py +++ b/devolo_home_control_api/properties/property.py @@ -1,7 +1,7 @@ """Generic Properties.""" import logging from abc import ABC -from datetime import datetime +from datetime import datetime, tzinfo from devolo_home_control_api.helper import get_device_uid_from_element_uid @@ -11,15 +11,17 @@ class Property(ABC): # pylint: disable=too-few-public-methods Abstract base object for properties. :param element_uid: Element UID, something like devolo.BinarySwitch:hdm:ZWave:CBC56091/24#2 + :param tz: Timezone the last activity is recorded in """ - def __init__(self, element_uid: str) -> None: + def __init__(self, element_uid: str, tz: tzinfo) -> None: """Initialize the property.""" self.element_uid = element_uid self.device_uid = get_device_uid_from_element_uid(element_uid) self._logger = logging.getLogger(self.__class__.__name__) - self._last_activity = datetime.fromtimestamp(0) # Set last activity to 1.1.1970. Will be corrected on update. + self._last_activity = datetime.fromtimestamp(0, tz=tz) # Set last activity to 1.1.1970. Will be corrected. + self._timezone = tz @property def last_activity(self) -> datetime: diff --git a/devolo_home_control_api/properties/remote_control_property.py b/devolo_home_control_api/properties/remote_control_property.py index 0a67744..08ef279 100644 --- a/devolo_home_control_api/properties/remote_control_property.py +++ b/devolo_home_control_api/properties/remote_control_property.py @@ -1,5 +1,5 @@ """Remote Controls.""" -from datetime import datetime +from datetime import datetime, tzinfo from typing import Callable from devolo_home_control_api.exceptions import WrongElementError @@ -13,6 +13,7 @@ class RemoteControlProperty(Property): right context. :param element_uid: Element UID, something like devolo.RemoteControl:hdm:ZWave:CBC56091/24#2 + :param tz: Timezone the last activity is recorded in :param setter: Method to call on setting the state :key key_count: Number of buttons this remote control has :type key_count: int @@ -20,12 +21,12 @@ class RemoteControlProperty(Property): :type key_pressed: int """ - def __init__(self, element_uid: str, setter: Callable[[str, int], bool], **kwargs: int) -> None: + def __init__(self, element_uid: str, tz: tzinfo, setter: Callable[[str, int], bool], **kwargs: int) -> None: """Initialize the remote control.""" if not element_uid.startswith("devolo.RemoteControl"): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self._setter = setter self._key_pressed: int = kwargs.pop("key_pressed", 0) @@ -40,7 +41,7 @@ def key_pressed(self) -> int: def key_pressed(self, key_pressed: int) -> None: """Update value of the multilevel value and set point in time of the last_activity.""" self._key_pressed = key_pressed - self._last_activity = datetime.now() + self._last_activity = datetime.now(tz=self._timezone) self._logger.debug("key_pressed of element_uid %s set to %s.", self.element_uid, key_pressed) def set(self, key_pressed: int) -> bool: diff --git a/devolo_home_control_api/properties/sensor_property.py b/devolo_home_control_api/properties/sensor_property.py index acef952..ae679b3 100644 --- a/devolo_home_control_api/properties/sensor_property.py +++ b/devolo_home_control_api/properties/sensor_property.py @@ -1,5 +1,6 @@ """Generic Sensors.""" from abc import ABC +from datetime import tzinfo from .property import Property @@ -8,17 +9,17 @@ class SensorProperty(Property, ABC): # pylint: disable=too-few-public-methods """ Abstract object for sensors. It stores the sensor and sub type. - :param connection: Collection of instances needed to communicate with the central unit :param element_uid: Element UID + :param tz: Timezone the last activity is recorded in :key sensor_type: Type of the sensor sensor, something like 'alarm' :type sensor_type: str :key sub_type: Subtype of the sensor, something like 'overload' :type sub_type: str """ - def __init__(self, element_uid: str, **kwargs: str) -> None: + def __init__(self, element_uid: str, tz: tzinfo, **kwargs: str) -> None: """Initialize the sensor.""" - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self.sensor_type: str = kwargs.pop("sensor_type", "") self.sub_type: str = kwargs.pop("sub_type", "") diff --git a/devolo_home_control_api/properties/settings_property.py b/devolo_home_control_api/properties/settings_property.py index f3080f0..6d6bf2d 100644 --- a/devolo_home_control_api/properties/settings_property.py +++ b/devolo_home_control_api/properties/settings_property.py @@ -1,4 +1,5 @@ """Settings.""" +from datetime import tzinfo from typing import Any, Callable, Dict from devolo_home_control_api.exceptions import WrongElementError @@ -13,6 +14,7 @@ class SettingsProperty(Property): # pylint: disable=too-few-public-methods are removed, they should be handled at least in reading them. Nevertheless, a few unwanted attributes are filtered. :param element_uid: Element UID, something like acs.hdm:ZWave:CBC56091/24 + :param tz: Timezone the last activity is recorded in :param setter: Method to call on setting the state :param **kwargs: Any setting, that shall be available in this object """ @@ -33,14 +35,14 @@ class SettingsProperty(Property): # pylint: disable=too-few-public-methods value: bool zone_id: str - def __init__(self, element_uid: str, setter: Callable[..., bool], **kwargs: Any) -> None: + def __init__(self, element_uid: str, tz: tzinfo, setter: Callable[..., bool], **kwargs: Any) -> None: """Initialize the setting.""" if not element_uid.startswith( ("acs", "bas", "bss", "cps", "gds", "lis", "mas", "mss", "ps", "sts", "stmss", "trs", "vfs") ): raise WrongElementError(element_uid, self.__class__.__name__) - super().__init__(element_uid=element_uid) + super().__init__(element_uid, tz) self._setter = setter if element_uid.startswith("gds") and {"zones", "zone_id"} <= kwargs.keys(): diff --git a/tests/__init__.py b/tests/__init__.py index 0e3e55d..4100534 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -12,16 +12,22 @@ MYDEVOLO_URL = "https://www.mydevolo.com" HOMECONTROL_URL = "https://homecontrol.mydevolo.com" GATEWAY_DETAILS_URL = re.compile( - MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/\d{16}", + MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/\d{16}" ) GATEWAY_FULLURL = re.compile( + MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/\d{16}/fullURL" +) +GATEWAY_LOCATION_URL = re.compile( MYDEVOLO_URL - + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/\d{16}/fullURL", + + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/\d{16}/location" ) GATEWAY_STATUS_URL = re.compile( - MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/status", + MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/hc/gateways/status" ) MAINTENANCE_URL = f"{MYDEVOLO_URL}/v1/hc/maintenance" +STANDARD_TIMEZONE_URL = re.compile( + MYDEVOLO_URL + r"/v1/users/[0-9A-F]{8}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{4}\b-[0-9A-F]{12}/standardTimezone" +) UUID_URL = f"{MYDEVOLO_URL}/v1/users/uuid" ZWAVE_PRODUCTS_URL = re.compile(MYDEVOLO_URL + r"/v1/zwave/products/0x[0-9a-f]{4}/0x[0-9a-f]{4}/0x[0-9a-f]{4}") diff --git a/tests/conftest.py b/tests/conftest.py index 76b8cc6..a8e47d2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,9 +14,11 @@ from . import ( GATEWAY_DETAILS_URL, GATEWAY_FULLURL, + GATEWAY_LOCATION_URL, GATEWAY_STATUS_URL, HOMECONTROL_URL, MAINTENANCE_URL, + STANDARD_TIMEZONE_URL, UUID_URL, ZWAVE_PRODUCTS_URL, DifferentDirectoryExtension, @@ -119,9 +121,11 @@ def mydevolo(requests_mock: Mocker) -> Mydevolo: requests_mock.get(UUID_URL, json=load_fixture("mydevolo_uuid")) requests_mock.get(GATEWAY_STATUS_URL, json=load_fixture("mydevolo_gateway_status")) requests_mock.get(GATEWAY_DETAILS_URL, json=load_fixture("mydevolo_gateway_details")) + requests_mock.get(GATEWAY_LOCATION_URL, json=load_fixture("mydevolo_gateway_location")) requests_mock.get(GATEWAY_FULLURL, json=load_fixture("mydevolo_gateway_fullurl")) requests_mock.get(ZWAVE_PRODUCTS_URL, json=load_fixture("mydevolo_zwave_products")) requests_mock.get(MAINTENANCE_URL, json=load_fixture("mydevolo_maintenance")) + requests_mock.get(STANDARD_TIMEZONE_URL, json=load_fixture("mydevolo_standard_timezone")) return Mydevolo() diff --git a/tests/fixtures/mydevolo_gateway_location.json b/tests/fixtures/mydevolo_gateway_location.json new file mode 100644 index 0000000..a21f3c0 --- /dev/null +++ b/tests/fixtures/mydevolo_gateway_location.json @@ -0,0 +1,14 @@ +{ + "href": "https://mydevolo.com/v1/users/535512AB-165D-11E7-A4E2-000C29D76CCA/addresses/535512AB-165D-11E7-A4E2-000C29D76CCA", + "name": "main", + "company": "devolo AG", + "street": "Charlottenburger Allee", + "houseno": "67", + "zipcode": "52068", + "city": "Aachen", + "country": "DE", + "timezone": "Europe/Berlin", + "timezoneCEEJ": "CET", + "latitude": "50.7910659763063", + "longitude": "6.139662697677296" +} diff --git a/tests/fixtures/mydevolo_standard_timezone.json b/tests/fixtures/mydevolo_standard_timezone.json new file mode 100644 index 0000000..ef5df7c --- /dev/null +++ b/tests/fixtures/mydevolo_standard_timezone.json @@ -0,0 +1,5 @@ +{ + "href": "https://mydevolo.com/v1/users/535512AB-165D-11E7-A4E2-000C29D76CCA/standardTimezone", + "timezone": "Europe/Berlin", + "timezoneCEEJ": "CET" +} diff --git a/tests/snapshots/test_homecontrol.ambr b/tests/snapshots/test_homecontrol.ambr index 7303d68..1925630 100644 --- a/tests/snapshots/test_homecontrol.ambr +++ b/tests/snapshots/test_homecontrol.ambr @@ -7,7 +7,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='alarm', state=False, sub_type='overload', @@ -15,7 +15,7 @@ 'devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='warning', state=False, sub_type='overload', @@ -26,7 +26,7 @@ device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySwitch:hdm:ZWave:CBC56091/2', enabled=True, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), state=False, ), }), @@ -37,9 +37,9 @@ current_unit='W', device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.Meter:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total=28.38, - total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000), + total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total_unit='kWh', ), }), @@ -64,7 +64,7 @@ 'devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='voltage', sub_type='', unit='V', @@ -86,31 +86,31 @@ settings_property=dict({ 'flash_mode': SettingsProperty( element_uid='mas.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=3, ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/2', events_enabled=True, icon='light-bulb', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Light Bulb', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='lis.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'protection': SettingsProperty( element_uid='ps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), local_switching=True, remote_switching=True, ), @@ -128,7 +128,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/3': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/3', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -155,7 +155,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -164,7 +164,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -187,24 +187,24 @@ element_uid='gds.hdm:ZWave:CBC56091/3', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Window', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -222,7 +222,7 @@ 'devolo.MildewSensor:hdm:ZWave:CBC56091/4': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MildewSensor:hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', state=True, sub_type='', @@ -245,7 +245,7 @@ 'devolo.HumidityBar:hdm:ZWave:CBC56091/4': HumidityBarProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.HumidityBar:hdm:ZWave:CBC56091/4', - last_activity=FakeDatetime(2023, 4, 28, 8, 0), + last_activity=FakeDatetime(2023, 4, 28, 10, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', sub_type='', value=0, @@ -261,7 +261,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -270,7 +270,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -293,24 +293,24 @@ element_uid='gds.hdm:ZWave:CBC56091/4', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shower', zone='Bathroom', zone_id='hz_2', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -344,7 +344,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -355,7 +355,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -373,7 +373,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -387,14 +387,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -426,7 +426,7 @@ 'devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/6', element_uid='devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6', - last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000), + last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=9, min=0, switch_type='tone', @@ -450,24 +450,24 @@ element_uid='gds.hdm:ZWave:CBC56091/6', events_enabled=True, icon='icon_34', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Siren', zone='Office', zone_id='hz_1', ), 'muted': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'tone': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), tone=7, ), }), @@ -504,7 +504,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/7', key_count=4, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -522,19 +522,19 @@ element_uid='gds.hdm:ZWave:CBC56091/7', events_enabled=True, icon='icon_47', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Wall Switch', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'switch_type': SettingsProperty( element_uid='sts.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=4, ), }), @@ -551,7 +551,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/8': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/8', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -578,7 +578,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -587,7 +587,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -611,29 +611,29 @@ element_uid='gds.hdm:ZWave:CBC56091/8', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Motion', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'motion_sensitivity': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), motion_sensitivity=7, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -666,7 +666,7 @@ 'devolo.Blinds:hdm:ZWave:CBC56091/9': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/9', element_uid='devolo.Blinds:hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=100, min=0, switch_type='', @@ -690,30 +690,30 @@ 'automatic_calibration': SettingsProperty( calibration_status=True, element_uid='acs.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/9', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shutter', zone='Office', zone_id='hz_1', ), 'i2': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/9#i2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'movement_direction': SettingsProperty( element_uid='bss.hdm:ZWave:CBC56091/9', inverted=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'shutter_duration': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), shutter_duration=20, ), }), @@ -732,7 +732,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='alarm', state=False, sub_type='overload', @@ -740,7 +740,7 @@ 'devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='warning', state=False, sub_type='overload', @@ -751,7 +751,7 @@ device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySwitch:hdm:ZWave:CBC56091/2', enabled=True, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), state=False, ), }), @@ -762,9 +762,9 @@ current_unit='W', device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.Meter:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total=28.38, - total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000), + total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total_unit='kWh', ), }), @@ -789,7 +789,7 @@ 'devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='voltage', sub_type='', unit='V', @@ -811,31 +811,31 @@ settings_property=dict({ 'flash_mode': SettingsProperty( element_uid='mas.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=3, ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/2', events_enabled=True, icon='light-bulb', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Light Bulb', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='lis.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'protection': SettingsProperty( element_uid='ps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), local_switching=True, remote_switching=True, ), @@ -853,7 +853,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/3': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/3', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -880,7 +880,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -889,7 +889,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -912,24 +912,24 @@ element_uid='gds.hdm:ZWave:CBC56091/3', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Window', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -947,7 +947,7 @@ 'devolo.MildewSensor:hdm:ZWave:CBC56091/4': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MildewSensor:hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', state=True, sub_type='', @@ -970,7 +970,7 @@ 'devolo.HumidityBar:hdm:ZWave:CBC56091/4': HumidityBarProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.HumidityBar:hdm:ZWave:CBC56091/4', - last_activity=FakeDatetime(2023, 4, 28, 8, 0), + last_activity=FakeDatetime(2023, 4, 28, 10, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', sub_type='', value=0, @@ -986,7 +986,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -995,7 +995,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -1018,24 +1018,24 @@ element_uid='gds.hdm:ZWave:CBC56091/4', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shower', zone='Bathroom', zone_id='hz_2', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -1069,7 +1069,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -1080,7 +1080,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -1098,7 +1098,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -1112,14 +1112,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -1151,7 +1151,7 @@ 'devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/6', element_uid='devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6', - last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000), + last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=9, min=0, switch_type='tone', @@ -1175,24 +1175,24 @@ element_uid='gds.hdm:ZWave:CBC56091/6', events_enabled=True, icon='icon_34', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Siren', zone='Office', zone_id='hz_1', ), 'muted': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'tone': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), tone=7, ), }), @@ -1229,7 +1229,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/7', key_count=4, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -1247,19 +1247,19 @@ element_uid='gds.hdm:ZWave:CBC56091/7', events_enabled=True, icon='icon_47', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Wall Switch', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'switch_type': SettingsProperty( element_uid='sts.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=4, ), }), @@ -1276,7 +1276,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/8': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/8', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -1303,7 +1303,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -1312,7 +1312,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -1336,29 +1336,29 @@ element_uid='gds.hdm:ZWave:CBC56091/8', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Motion', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'motion_sensitivity': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), motion_sensitivity=7, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -1391,7 +1391,7 @@ 'devolo.Blinds:hdm:ZWave:CBC56091/9': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/9', element_uid='devolo.Blinds:hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=100, min=0, switch_type='', @@ -1415,30 +1415,30 @@ 'automatic_calibration': SettingsProperty( calibration_status=True, element_uid='acs.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/9', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shutter', zone='Office', zone_id='hz_1', ), 'i2': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/9#i2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'movement_direction': SettingsProperty( element_uid='bss.hdm:ZWave:CBC56091/9', inverted=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'shutter_duration': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), shutter_duration=20, ), }), diff --git a/tests/snapshots/test_metering_plug.ambr b/tests/snapshots/test_metering_plug.ambr index 3266577..8bd174a 100644 --- a/tests/snapshots/test_metering_plug.ambr +++ b/tests/snapshots/test_metering_plug.ambr @@ -7,7 +7,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='alarm', state=False, sub_type='overload', @@ -15,7 +15,7 @@ 'devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='warning', state=False, sub_type='overload', @@ -26,7 +26,7 @@ device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySwitch:hdm:ZWave:CBC56091/2', enabled=True, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), state=False, ), }), @@ -37,9 +37,9 @@ current_unit='W', device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.Meter:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total=28.38, - total_since=datetime.datetime(2017, 5, 30, 8, 11, 4, 998000), + total_since=datetime.datetime(2017, 5, 30, 8, 11, 4, 998000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total_unit='kWh', ), }), @@ -64,7 +64,7 @@ 'devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='voltage', sub_type='', unit='V', @@ -86,31 +86,31 @@ settings_property=dict({ 'flash_mode': SettingsProperty( element_uid='mas.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=3, ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/2', events_enabled=True, icon='light-bulb', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Light Bulb', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='lis.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'protection': SettingsProperty( element_uid='ps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), local_switching=True, remote_switching=True, ), diff --git a/tests/snapshots/test_mydevolo.ambr b/tests/snapshots/test_mydevolo.ambr index e2d95bd..177ca11 100644 --- a/tests/snapshots/test_mydevolo.ambr +++ b/tests/snapshots/test_mydevolo.ambr @@ -13,7 +13,7 @@ 'href': 'string', }), 'localPasskey': '6b96ad097aa389209f1ceeaed6fe7029', - 'location': 'https://www.mydevolo.com/v1/users/535512AB-165D-11E7-A4E2-000C29D76CCA/hc/gateways/1409301750000598/location', + 'location': None, 'name': 'DVT Lab 1409301750000598', 'partner': 'string', 'role': 'user', diff --git a/tests/snapshots/test_shutter.ambr b/tests/snapshots/test_shutter.ambr index 4b69c43..ac05a03 100644 --- a/tests/snapshots/test_shutter.ambr +++ b/tests/snapshots/test_shutter.ambr @@ -24,7 +24,7 @@ 'devolo.Blinds:hdm:ZWave:CBC56091/9': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/9', element_uid='devolo.Blinds:hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=100, min=0, switch_type='', @@ -48,30 +48,30 @@ 'automatic_calibration': SettingsProperty( calibration_status=True, element_uid='acs.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/9', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shutter', zone='Office', zone_id='hz_1', ), 'i2': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/9#i2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'movement_direction': SettingsProperty( element_uid='bss.hdm:ZWave:CBC56091/9', inverted=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'shutter_duration': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), shutter_duration=20, ), }), diff --git a/tests/snapshots/test_thermostat.ambr b/tests/snapshots/test_thermostat.ambr index e1c4b69..cac3ca8 100644 --- a/tests/snapshots/test_thermostat.ambr +++ b/tests/snapshots/test_thermostat.ambr @@ -7,7 +7,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='alarm', state=False, sub_type='overload', @@ -15,7 +15,7 @@ 'devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='warning', state=False, sub_type='overload', @@ -26,7 +26,7 @@ device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySwitch:hdm:ZWave:CBC56091/2', enabled=True, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), state=False, ), }), @@ -37,9 +37,9 @@ current_unit='W', device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.Meter:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total=28.38, - total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000), + total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total_unit='kWh', ), }), @@ -64,7 +64,7 @@ 'devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='voltage', sub_type='', unit='V', @@ -86,31 +86,31 @@ settings_property=dict({ 'flash_mode': SettingsProperty( element_uid='mas.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=3, ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/2', events_enabled=True, icon='light-bulb', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Light Bulb', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='lis.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'protection': SettingsProperty( element_uid='ps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), local_switching=True, remote_switching=True, ), @@ -128,7 +128,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/3': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/3', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -155,7 +155,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -164,7 +164,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -187,24 +187,24 @@ element_uid='gds.hdm:ZWave:CBC56091/3', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Window', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -222,7 +222,7 @@ 'devolo.MildewSensor:hdm:ZWave:CBC56091/4': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MildewSensor:hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', state=True, sub_type='', @@ -245,7 +245,7 @@ 'devolo.HumidityBar:hdm:ZWave:CBC56091/4': HumidityBarProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.HumidityBar:hdm:ZWave:CBC56091/4', - last_activity=FakeDatetime(2023, 4, 28, 8, 0), + last_activity=FakeDatetime(2023, 4, 28, 10, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', sub_type='', value=0, @@ -261,7 +261,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -270,7 +270,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -293,24 +293,24 @@ element_uid='gds.hdm:ZWave:CBC56091/4', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shower', zone='Bathroom', zone_id='hz_2', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -344,7 +344,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -355,7 +355,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -373,7 +373,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -387,14 +387,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -411,7 +411,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/8': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/8', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -438,7 +438,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -447,7 +447,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -471,29 +471,29 @@ element_uid='gds.hdm:ZWave:CBC56091/8', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Motion', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'motion_sensitivity': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), motion_sensitivity=7, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -531,7 +531,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -542,7 +542,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -560,7 +560,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -574,14 +574,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -613,7 +613,7 @@ 'devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/6', element_uid='devolo.SirenMultiLevelSwitch:hdm:ZWave:CBC56091/6', - last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000), + last_activity=FakeDatetime(2023, 4, 28, 6, 43, 56, 957000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=9, min=0, switch_type='tone', @@ -637,24 +637,24 @@ element_uid='gds.hdm:ZWave:CBC56091/6', events_enabled=True, icon='icon_34', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Siren', zone='Office', zone_id='hz_1', ), 'muted': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'tone': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/6', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), tone=7, ), }), @@ -686,7 +686,7 @@ 'devolo.Blinds:hdm:ZWave:CBC56091/9': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/9', element_uid='devolo.Blinds:hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=100, min=0, switch_type='', @@ -710,30 +710,30 @@ 'automatic_calibration': SettingsProperty( calibration_status=True, element_uid='acs.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/9', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shutter', zone='Office', zone_id='hz_1', ), 'i2': SettingsProperty( element_uid='bas.hdm:ZWave:CBC56091/9#i2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=True, ), 'movement_direction': SettingsProperty( element_uid='bss.hdm:ZWave:CBC56091/9', inverted=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), 'shutter_duration': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/9', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), shutter_duration=20, ), }), @@ -770,7 +770,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -781,7 +781,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -799,7 +799,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -813,14 +813,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -857,7 +857,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/7', key_count=4, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -875,19 +875,19 @@ element_uid='gds.hdm:ZWave:CBC56091/7', events_enabled=True, icon='icon_47', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Wall Switch', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'switch_type': SettingsProperty( element_uid='sts.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=4, ), }), diff --git a/tests/snapshots/test_wall_switch.ambr b/tests/snapshots/test_wall_switch.ambr index ccf4317..9a901f0 100644 --- a/tests/snapshots/test_wall_switch.ambr +++ b/tests/snapshots/test_wall_switch.ambr @@ -25,7 +25,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -36,7 +36,7 @@ 'devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)': MultiLevelSwitchProperty( device_uid='hdm:ZWave:CBC56091/5', element_uid='devolo.MultiLevelSwitch:hdm:ZWave:CBC56091/5#ThermostatSetpoint(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), max=28, min=4, switch_type='temperature', @@ -54,7 +54,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/5', key_count=1, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -68,14 +68,14 @@ element_uid='gds.hdm:ZWave:CBC56091/5', events_enabled=True, icon='icon_27', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Thermostat', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/5', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), }), @@ -112,7 +112,7 @@ element_uid='devolo.RemoteControl:hdm:ZWave:CBC56091/7', key_count=4, key_pressed=0, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ), }), secure_inclusion_code=0, @@ -130,19 +130,19 @@ element_uid='gds.hdm:ZWave:CBC56091/7', events_enabled=True, icon='icon_47', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Wall Switch', zone='Office', zone_id='hz_1', ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'switch_type': SettingsProperty( element_uid='sts.hdm:ZWave:CBC56091/7', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=4, ), }), diff --git a/tests/snapshots/test_window_contact.ambr b/tests/snapshots/test_window_contact.ambr index 4386a0a..0205670 100644 --- a/tests/snapshots/test_window_contact.ambr +++ b/tests/snapshots/test_window_contact.ambr @@ -7,7 +7,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/2#Alarm(0)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='alarm', state=False, sub_type='overload', @@ -15,7 +15,7 @@ 'devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.WarningBinaryFI:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='warning', state=False, sub_type='overload', @@ -26,7 +26,7 @@ device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.BinarySwitch:hdm:ZWave:CBC56091/2', enabled=True, - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), state=False, ), }), @@ -37,9 +37,9 @@ current_unit='W', device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.Meter:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total=28.38, - total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000), + total_since=FakeDatetime(2017, 5, 30, 8, 11, 4, 998000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), total_unit='kWh', ), }), @@ -64,7 +64,7 @@ 'devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/2', element_uid='devolo.VoltageMultiLevelSensor:hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='voltage', sub_type='', unit='V', @@ -86,31 +86,31 @@ settings_property=dict({ 'flash_mode': SettingsProperty( element_uid='mas.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), value=3, ), 'general_device_settings': SettingsProperty( element_uid='gds.hdm:ZWave:CBC56091/2', events_enabled=True, icon='light-bulb', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Light Bulb', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='lis.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'protection': SettingsProperty( element_uid='ps.hdm:ZWave:CBC56091/2', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), local_switching=True, remote_switching=True, ), @@ -128,7 +128,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/3': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/3', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -155,7 +155,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -164,7 +164,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/3', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/3#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -187,24 +187,24 @@ element_uid='gds.hdm:ZWave:CBC56091/3', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Window', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/3', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -222,7 +222,7 @@ 'devolo.MildewSensor:hdm:ZWave:CBC56091/4': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MildewSensor:hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', state=True, sub_type='', @@ -245,7 +245,7 @@ 'devolo.HumidityBar:hdm:ZWave:CBC56091/4': HumidityBarProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.HumidityBar:hdm:ZWave:CBC56091/4', - last_activity=FakeDatetime(2023, 4, 28, 8, 0), + last_activity=FakeDatetime(2023, 4, 28, 10, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='', sub_type='', value=0, @@ -261,7 +261,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -270,7 +270,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/4', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/4#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -293,24 +293,24 @@ element_uid='gds.hdm:ZWave:CBC56091/4', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Shower', zone='Bathroom', zone_id='hz_2', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/4', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), @@ -328,7 +328,7 @@ 'devolo.BinarySensor:hdm:ZWave:CBC56091/8': BinarySensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.BinarySensor:hdm:ZWave:CBC56091/8', - last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000), + last_activity=FakeDatetime(2023, 4, 27, 7, 38, 44, 279000, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='door', state=False, sub_type='', @@ -355,7 +355,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(1)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='temperature', sub_type='', unit='°C', @@ -364,7 +364,7 @@ 'devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)': MultiLevelSensorProperty( device_uid='hdm:ZWave:CBC56091/8', element_uid='devolo.MultiLevelSensor:hdm:ZWave:CBC56091/8#MultilevelSensor(3)', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), sensor_type='light', sub_type='', unit='%', @@ -388,29 +388,29 @@ element_uid='gds.hdm:ZWave:CBC56091/8', events_enabled=True, icon='icon_16', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), name='Motion', zone='Office', zone_id='hz_1', ), 'led': SettingsProperty( element_uid='vfs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), led_setting=True, ), 'motion_sensitivity': SettingsProperty( element_uid='mss.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), motion_sensitivity=7, ), 'param_changed': SettingsProperty( element_uid='cps.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), param_changed=False, ), 'temperature_report': SettingsProperty( element_uid='trs.hdm:ZWave:CBC56091/8', - last_activity=datetime.datetime(1970, 1, 1, 0, 0), + last_activity=FakeDatetime(1970, 1, 1, 1, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), target_temp_report=True, temp_report=True, ), diff --git a/tests/test_homecontrol.py b/tests/test_homecontrol.py index 25227e5..2bc78d9 100644 --- a/tests/test_homecontrol.py +++ b/tests/test_homecontrol.py @@ -6,6 +6,7 @@ import pytest import requests +from dateutil import tz from requests_mock import Mocker from syrupy.assertion import SnapshotAssertion @@ -13,7 +14,17 @@ from devolo_home_control_api.homecontrol import HomeControl from devolo_home_control_api.mydevolo import Mydevolo -from . import GATEWAY_FULLURL, MAINTENANCE_URL, Subscriber, load_fixture +from . import ( + GATEWAY_DETAILS_URL, + GATEWAY_FULLURL, + GATEWAY_STATUS_URL, + MAINTENANCE_URL, + STANDARD_TIMEZONE_URL, + UUID_URL, + ZWAVE_PRODUCTS_URL, + Subscriber, + load_fixture, +) from .mocks import WEBSOCKET @@ -80,10 +91,24 @@ def test_setup_remote_external_access(mydevolo: Mydevolo, gateway_id: str) -> No HomeControl(gateway_id, mydevolo) -def test_context_manager(mydevolo: Mydevolo, gateway_id: str, gateway_ip: str, requests_mock: Mocker) -> None: - """Test setting up using a conext manager.""" +def test_timezone_with_location(local_gateway: HomeControl) -> None: + """Test getting the gateway's timezone, if a location is set.""" + assert local_gateway.gateway.timezone == tz.gettz("Europe/Berlin") + + +def test_timezone_without_location(gateway_id: str, gateway_ip: str, requests_mock: Mocker) -> None: + """Test getting the gateway's timezone, if no location is set.""" connection = load_fixture("homecontrol_local_session") connection["link"] = f"http://{gateway_ip}/dhlp/portal/full/?token=54e8c82fc921ee7e&" + gateway_details = load_fixture("mydevolo_gateway_details") + gateway_details["location"] = None + requests_mock.get(UUID_URL, json=load_fixture("mydevolo_uuid")) + requests_mock.get(GATEWAY_STATUS_URL, json=load_fixture("mydevolo_gateway_status")) + requests_mock.get(GATEWAY_DETAILS_URL, json=gateway_details) + requests_mock.get(GATEWAY_FULLURL, json=load_fixture("mydevolo_gateway_fullurl")) + requests_mock.get(ZWAVE_PRODUCTS_URL, json=load_fixture("mydevolo_zwave_products")) + requests_mock.get(MAINTENANCE_URL, json=load_fixture("mydevolo_maintenance")) + requests_mock.get(STANDARD_TIMEZONE_URL, json=load_fixture("mydevolo_standard_timezone")) requests_mock.get(f"http://{gateway_ip}/dhlp/port/full") requests_mock.get(f"http://{gateway_ip}/dhlp/portal/full", json=connection) requests_mock.get(connection["link"]) @@ -96,8 +121,9 @@ def test_context_manager(mydevolo: Mydevolo, gateway_id: str, gateway_ip: str, r {"json": load_fixture("homecontrol_device_details")}, ], ) + mydevolo = Mydevolo() with HomeControl(gateway_id, mydevolo) as homecontrol: - assert homecontrol + assert homecontrol.gateway.timezone == tz.gettz("Europe/Berlin") def test_update_online_state(local_gateway: HomeControl, gateway_ip: str, requests_mock: Mocker) -> None: diff --git a/tests/test_metering_plug.py b/tests/test_metering_plug.py index 4508b18..9a9668b 100644 --- a/tests/test_metering_plug.py +++ b/tests/test_metering_plug.py @@ -1,9 +1,10 @@ """Test interacting with a metering plug.""" import json import sys -from datetime import datetime +from datetime import datetime, timezone import pytest +from dateutil import tz from requests_mock import Mocker from syrupy.assertion import SnapshotAssertion @@ -15,6 +16,7 @@ ELEMENT_ID = "hdm:ZWave:CBC56091/2" FIXTURE = load_fixture("homecontrol_binary_switch") +TIMEZONE = tz.gettz() @pytest.mark.skipif(sys.version_info < (3, 8), reason="Tests with snapshots need at least Python 3.8") @@ -83,7 +85,9 @@ def test_consumption(local_gateway: HomeControl) -> None: consumption = metering_plug.consumption_property[f"devolo.Meter:{ELEMENT_ID}"] assert consumption.current == element["properties"]["currentValue"] assert consumption.total == element["properties"]["totalValue"] - assert consumption.total_since == datetime.utcfromtimestamp(element["properties"]["sinceTime"] / 1000) + assert consumption.total_since == datetime.fromtimestamp( + element["properties"]["sinceTime"] / 1000, tz=timezone.utc + ).replace(tzinfo=tz.gettz("Europe/Berlin")) last_activity = consumption.last_activity WEBSOCKET.recv_packet(json.dumps(FIXTURE["current_event"])) @@ -98,9 +102,9 @@ def test_consumption(local_gateway: HomeControl) -> None: assert subscriber.update.call_count == 2 WEBSOCKET.recv_packet(json.dumps(FIXTURE["total_since"])) - assert consumption.total_since == datetime.utcfromtimestamp( - FIXTURE["total_since"]["properties"]["property.value.new"] / 1000 - ) + assert consumption.total_since == datetime.fromtimestamp( + FIXTURE["total_since"]["properties"]["property.value.new"] / 1000, tz=timezone.utc + ).replace(tzinfo=tz.gettz("Europe/Berlin")) assert subscriber.update.call_count == 3