From 283e62eb736fd18563bc55461dd9aecfdbc153f7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 17:40:31 +0100 Subject: [PATCH 01/37] Add weather-related measurements --- plugwise/constants.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 232da091b..97ec29c5e 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -126,7 +126,6 @@ # radiator_valve: 'uncorrected_temperature', 'temperature_offset' DEVICE_MEASUREMENTS: Final[dict[str, DATA | UOM]] = { - "humidity": UOM(NONE), # Specific for a Jip "illuminance": UOM(UNIT_LUMEN), # Specific for an Anna "temperature": UOM(TEMP_CELSIUS), # HA Core thermostat current_temperature "thermostat": DATA("setpoint", TEMP_CELSIUS), # HA Core thermostat setpoint @@ -144,6 +143,13 @@ "electricity_consumed": UOM(POWER_WATT), "electricity_produced": UOM(POWER_WATT), "relay": UOM(NONE), + ##################### + # Gateway weather related + "humidity": UOM(NONE), # also present for a Jip + "outdoor_temperature": UOM(NONE), + "solar_irradiance": UOM(NONE), + "weather_description": UOM(NONE), + "wind_vector": UOM(NONE), } # Heater Central related measurements From b69515e117fb828c943c8ca5e6dc168496a46849 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 17:49:59 +0100 Subject: [PATCH 02/37] Create _get_gateway_measurements() function --- plugwise/helper.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 58e499e0c..38b721f3d 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -559,7 +559,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: self._get_regulation_mode(appliance, entity_id, data) self._get_gateway_mode(appliance, entity_id, data) - self._get_gateway_outdoor_temp(entity_id, data) + self._get_gateway_measurements(entity_id, data) if "c_heating_state" in data: self._process_c_heating_state(data) @@ -763,18 +763,20 @@ def _get_gateway_mode( data["select_gateway_mode"] = mode self._count += 1 - def _get_gateway_outdoor_temp(self, entity_id: str, data: GwEntityData) -> None: - """Adam & Anna: the Smile outdoor_temperature is present in DOMAIN_OBJECTS and LOCATIONS. + def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: + """Adam & Anna: the Gateway weather-data is present in DOMAIN_OBJECTS and LOCATIONS. Available under the Home location. """ - if self._is_thermostat and entity_id == self.gateway_id: - outdoor_temperature = self._object_value( - self._home_location, "outdoor_temperature" - ) - if outdoor_temperature is not None: - data.update({"sensors": {"outdoor_temperature": outdoor_temperature}}) - self._count += 1 + measurements = HEATER_CENTRAL_MEASUREMENTS + if entity_id != self.gateway_id: + return + + location_id = self.gw_entities[entity_id]["location"] + if ( + location := self._domain_objects.find(f'./location[@id="{location_id}"]') + ) is not None: + self._appliance_measurements(location, data, measurements) def _object_value(self, obj_id: str, measurement: str) -> float | int | None: """Helper-function for smile.py: _get_entity_data(). From accfc33971506e83486938787498bde118f782e3 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 17:53:15 +0100 Subject: [PATCH 03/37] Try --- plugwise/helper.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 38b721f3d..c881bc91f 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -769,14 +769,17 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: Available under the Home location. """ measurements = HEATER_CENTRAL_MEASUREMENTS - if entity_id != self.gateway_id: - return + if self._is_thermostat: + if entity_id != self.gateway_id: + return - location_id = self.gw_entities[entity_id]["location"] - if ( - location := self._domain_objects.find(f'./location[@id="{location_id}"]') - ) is not None: - self._appliance_measurements(location, data, measurements) + location_id = self.gw_entities[entity_id]["location"] + if ( + location := self._domain_objects.find(f'./location[@id="{location_id}"]') + ) is not None: + self._appliance_measurements(location, data, measurements) + + return def _object_value(self, obj_id: str, measurement: str) -> float | int | None: """Helper-function for smile.py: _get_entity_data(). From 0eb98378db4826d1e13cf0891b0f6b1221eb02af Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 18:01:15 +0100 Subject: [PATCH 04/37] Try 2 --- plugwise/helper.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index c881bc91f..b60d5bfcd 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -768,16 +768,13 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: Available under the Home location. """ - measurements = HEATER_CENTRAL_MEASUREMENTS - if self._is_thermostat: - if entity_id != self.gateway_id: - return - - location_id = self.gw_entities[entity_id]["location"] - if ( - location := self._domain_objects.find(f'./location[@id="{location_id}"]') - ) is not None: - self._appliance_measurements(location, data, measurements) + measurements = DEVICE_MEASUREMENTS + if self._is_thermostat and entity_id == self.gateway_id: + for measurement, attrs in measurements.items(): + value = self._object_value(self._home_location, measurement) + if value is not None: + data[measurement] = value + self._count += 1 return From 8f3479c3ac505a8f738026c15e471ad9f45c4953 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 18:09:58 +0100 Subject: [PATCH 05/37] Let _object_value() handle string --- plugwise/helper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index b60d5bfcd..21e47e9c6 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -783,13 +783,17 @@ def _object_value(self, obj_id: str, measurement: str) -> float | int | None: Obtain the value/state for the given object from a location in DOMAIN_OBJECTS """ - val: float | int | None = None + val: float | int | str | None = None search = self._domain_objects locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' if (found := search.find(locator)) is not None: - val = format_measure(found.text, NONE) + value = found.text + if isinstance(value, str): + return val - return val + return format_measure(value, NONE) + + return None def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). From 5d97c1ddfeaf1b0157ca6b36f5348e8199f82f27 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 18:12:45 +0100 Subject: [PATCH 06/37] Debug --- plugwise/helper.py | 7 ++++++- scripts/tests_and_coverage.sh | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 21e47e9c6..14d2eeb4b 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -771,14 +771,17 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.gateway_id: for measurement, attrs in measurements.items(): + LOGGER.debug("HOI meas: %s", measurement) + LOGGER.debug("HOI loc: %s", self._home_location) value = self._object_value(self._home_location, measurement) + LOGGER.debug("HOI value: %s", value) if value is not None: data[measurement] = value self._count += 1 return - def _object_value(self, obj_id: str, measurement: str) -> float | int | None: + def _object_value(self, obj_id: str, measurement: str) -> float | int | str| None: """Helper-function for smile.py: _get_entity_data(). Obtain the value/state for the given object from a location in DOMAIN_OBJECTS @@ -787,7 +790,9 @@ def _object_value(self, obj_id: str, measurement: str) -> float | int | None: search = self._domain_objects locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' if (found := search.find(locator)) is not None: + LOGGER.debug("HOI found!") value = found.text + LOGGER.debug("HOI found_value: %s", value) if isinstance(value, str): return val diff --git a/scripts/tests_and_coverage.sh b/scripts/tests_and_coverage.sh index 73be7e825..462744720 100755 --- a/scripts/tests_and_coverage.sh +++ b/scripts/tests_and_coverage.sh @@ -43,7 +43,8 @@ set +u if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "test_and_coverage" ] ; then # Python tests (rerun with debug if failures) - PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing || PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/ + # PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing || + PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/ handle_command_error "python code testing" fi From 786b58f52ace3568e5bf39e074ff328c5c7d9a56 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 18:35:45 +0100 Subject: [PATCH 07/37] Fix --- plugwise/helper.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 14d2eeb4b..d6ca10698 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -786,20 +786,16 @@ def _object_value(self, obj_id: str, measurement: str) -> float | int | str| Non Obtain the value/state for the given object from a location in DOMAIN_OBJECTS """ - val: float | int | str | None = None + value: float | int | str | None = None search = self._domain_objects locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' if (found := search.find(locator)) is not None: - LOGGER.debug("HOI found!") value = found.text - LOGGER.debug("HOI found_value: %s", value) if isinstance(value, str): - return val + return value return format_measure(value, NONE) - return None - def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). From 62e945fbd39407095ec95f324cca279804e55e76 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:18:46 +0100 Subject: [PATCH 08/37] Correct some attrs --- plugwise/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 97ec29c5e..a415d45c5 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -145,8 +145,8 @@ "relay": UOM(NONE), ##################### # Gateway weather related - "humidity": UOM(NONE), # also present for a Jip - "outdoor_temperature": UOM(NONE), + "humidity": UOM(PERCENTAGE), # also present for a Jip + "outdoor_temperature": UOM(TEMP_CELSIUS), "solar_irradiance": UOM(NONE), "weather_description": UOM(NONE), "wind_vector": UOM(NONE), From dba68177137a4074c48fd0044d78193e828d869f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:20:57 +0100 Subject: [PATCH 09/37] Use attr for formatting --- plugwise/common.py | 2 +- plugwise/helper.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index d1300b592..c69f5fc33 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -169,7 +169,7 @@ def _power_data_peak_value(self, loc: Munch, legacy: bool) -> Munch: # --------------------------------------# loc.net_string = f"net_electricity_{log_found}" val = loc.logs.find(loc.locator).text - loc.f_val = power_data_local_format(loc.attrs, loc.key_string, val) + loc.f_val = power_data_local_format(loc.attr, loc.key_string, val) return loc diff --git a/plugwise/helper.py b/plugwise/helper.py index d6ca10698..57b5e411f 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -586,7 +586,7 @@ def _power_data_from_location(self, loc_id: str) -> GwEntityData: search = self._domain_objects loc.logs = search.find(f'./location[@id="{loc_id}"]/logs') - for loc.measurement, loc.attrs in P1_MEASUREMENTS.items(): + for loc.measurement, loc.attr in P1_MEASUREMENTS.items(): for loc.log_type in log_list: self._collect_power_values(data, loc, t_string) @@ -600,13 +600,13 @@ def _appliance_measurements( measurements: dict[str, DATA | UOM], ) -> None: """Helper-function for _get_measurement_data() - collect appliance measurement data.""" - for measurement, attrs in measurements.items(): + for measurement, attr in measurements.items(): p_locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' if (appl_p_loc := appliance.find(p_locator)) is not None: if skip_obsolete_measurements(appliance, measurement): continue - if new_name := getattr(attrs, ATTR_NAME, None): + if new_name := getattr(attr, ATTR_NAME, None): measurement = new_name match measurement: @@ -615,7 +615,7 @@ def _appliance_measurements( case "select_dhw_mode": data["select_dhw_mode"] = appl_p_loc.text - common_match_cases(measurement, attrs, appl_p_loc, data) + common_match_cases(measurement, attr, appl_p_loc, data) i_locator = f'.//logs/interval_log[type="{measurement}"]/period/measurement' if (appl_i_loc := appliance.find(i_locator)) is not None: @@ -770,10 +770,10 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: """ measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.gateway_id: - for measurement, attrs in measurements.items(): + for measurement, attr in measurements.items(): LOGGER.debug("HOI meas: %s", measurement) LOGGER.debug("HOI loc: %s", self._home_location) - value = self._object_value(self._home_location, measurement) + value = self._object_value(self._home_location, measurement, attr) LOGGER.debug("HOI value: %s", value) if value is not None: data[measurement] = value @@ -781,7 +781,7 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: return - def _object_value(self, obj_id: str, measurement: str) -> float | int | str| None: + def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int | str| None: """Helper-function for smile.py: _get_entity_data(). Obtain the value/state for the given object from a location in DOMAIN_OBJECTS @@ -794,7 +794,7 @@ def _object_value(self, obj_id: str, measurement: str) -> float | int | str| Non if isinstance(value, str): return value - return format_measure(value, NONE) + return format_measure(value, attr) def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). From 0bd47f3a863f8d7e2d0698aeeb907ebc0ab0487b Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:24:24 +0100 Subject: [PATCH 10/37] Fix humidity --- plugwise/helper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugwise/helper.py b/plugwise/helper.py index 57b5e411f..97cd40cbb 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -794,6 +794,9 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int if isinstance(value, str): return value + if measurement == "humidity": + value = float(value/100) + return format_measure(value, attr) def _process_c_heating_state(self, data: GwEntityData) -> None: From 8f8318f9c5f229c085f07e717f95371e723adfa7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:38:14 +0100 Subject: [PATCH 11/37] Try 3 --- plugwise/helper.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 97cd40cbb..c90dee2de 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -791,13 +791,17 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' if (found := search.find(locator)) is not None: value = found.text - if isinstance(value, str): - return value - - if measurement == "humidity": - value = float(value/100) - - return format_measure(value, attr) + match measurement: + case "humidity": + return format_measure(float(value)/100, attr) + case "outdoor_temperature": + return format_measure(float(value), attr) + case "solar_irradiance": + return format_measure(float(value), attr) + case "weather_description": + return value + case "wind_vector": + return value def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). From cd47ef7b62521c0d51290eddc45e0e60f96e7a18 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:50:16 +0100 Subject: [PATCH 12/37] Debug --- plugwise/helper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index c90dee2de..a885ed84c 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -792,8 +792,10 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int if (found := search.find(locator)) is not None: value = found.text match measurement: - case "humidity": - return format_measure(float(value)/100, attr) + case "humidity": + value = float(value)/100 + LOGGER.debug("HOI hum_val: %s", value) + return format_measure(value, attr) case "outdoor_temperature": return format_measure(float(value), attr) case "solar_irradiance": From a41984327edc30a9aa7dc028d67b75176b4b4058 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:52:57 +0100 Subject: [PATCH 13/37] Try 4 --- plugwise/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index a885ed84c..06e8fa921 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -772,7 +772,7 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: if self._is_thermostat and entity_id == self.gateway_id: for measurement, attr in measurements.items(): LOGGER.debug("HOI meas: %s", measurement) - LOGGER.debug("HOI loc: %s", self._home_location) + LOGGER.debug("HOI attr: %s", attr) value = self._object_value(self._home_location, measurement, attr) LOGGER.debug("HOI value: %s", value) if value is not None: From a5c81a3b2d44a1687dabdd093e701b62a4a14e39 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 19:58:24 +0100 Subject: [PATCH 14/37] Another attr-fix --- plugwise/util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugwise/util.py b/plugwise/util.py index e2d1a125a..4549c72d2 100644 --- a/plugwise/util.py +++ b/plugwise/util.py @@ -119,7 +119,7 @@ def check_model(name: str | None, vendor_name: str | None) -> str | None: def common_match_cases( measurement: str, - attrs: DATA | UOM, + attr: DATA | UOM, location: etree, data: GwEntityData, ) -> None: @@ -132,7 +132,7 @@ def common_match_cases( case _ as measurement if measurement in SENSORS: s_key = cast(SensorType, measurement) s_value = format_measure( - location.text, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) + location.text, getattr(attr, ATTR_UNIT_OF_MEASUREMENT) ) data["sensors"][s_key] = s_value case _ as measurement if measurement in SWITCHES: @@ -189,16 +189,16 @@ def get_vendor_name(module: etree, model_data: ModuleData) -> ModuleData: def power_data_local_format( - attrs: dict[str, str], key_string: str, val: str + attr: dict[str, str], key_string: str, val: str ) -> float | int: """Format power data.""" # Special formatting of P1_MEASUREMENT POWER_WATT values, do not move to util-format_measure() function! if all(item in key_string for item in ("electricity", "cumulative")): return format_measure(val, ENERGY_KILO_WATT_HOUR) - if (attrs_uom := getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: + if (attr_uom := getattr(atts, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: return int(round(float(val))) - return format_measure(val, attrs_uom) + return format_measure(val, attr_uom) def remove_empty_platform_dicts(data: GwEntityData) -> None: From ed335527ab0aef896b427664c2ca3b28c0471880 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Thu, 19 Dec 2024 20:01:25 +0100 Subject: [PATCH 15/37] Try 4 --- plugwise/helper.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 06e8fa921..210f76d4d 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -16,6 +16,7 @@ ADAM, ANNA, ATTR_NAME, + ATTR_UNIT_OF_MEASUREMENT, DATA, DEVICE_MEASUREMENTS, DHW_SETPOINT, @@ -772,14 +773,17 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: if self._is_thermostat and entity_id == self.gateway_id: for measurement, attr in measurements.items(): LOGGER.debug("HOI meas: %s", measurement) - LOGGER.debug("HOI attr: %s", attr) value = self._object_value(self._home_location, measurement, attr) LOGGER.debug("HOI value: %s", value) if value is not None: - data[measurement] = value - self._count += 1 - - return + if measurement == "wind_vector": + value = value.split(",") + data["wind_speed"] = format_measure(value[0].strip("("), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + data["wind_direction"] = format_measure(value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + self._count += 2 + else: + data[measurement] = value + self._count += 1 def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int | str| None: """Helper-function for smile.py: _get_entity_data(). @@ -795,11 +799,13 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int case "humidity": value = float(value)/100 LOGGER.debug("HOI hum_val: %s", value) - return format_measure(value, attr) + value = format_measure(str(value), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + LOGGER.debug("HOI hum_val_fm: %s", value) + return value case "outdoor_temperature": - return format_measure(float(value), attr) + return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) case "solar_irradiance": - return format_measure(float(value), attr) + return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) case "weather_description": return value case "wind_vector": From 056ac48697e3ac7832edf8ce98c755c306cf1ded Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 08:44:09 +0100 Subject: [PATCH 16/37] Simplify --- plugwise/helper.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 210f76d4d..e7807032b 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -779,7 +779,7 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: if measurement == "wind_vector": value = value.split(",") data["wind_speed"] = format_measure(value[0].strip("("), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) - data["wind_direction"] = format_measure(value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + data["wind_bearing"] = format_measure(value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) self._count += 2 else: data[measurement] = value @@ -797,11 +797,7 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int value = found.text match measurement: case "humidity": - value = float(value)/100 - LOGGER.debug("HOI hum_val: %s", value) - value = format_measure(str(value), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) - LOGGER.debug("HOI hum_val_fm: %s", value) - return value + return int(value) case "outdoor_temperature": return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) case "solar_irradiance": From e4af18a6a554c1cbe8c82d43d5542528ec4d013c Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 08:48:54 +0100 Subject: [PATCH 17/37] Collect as weather-dict --- plugwise/helper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index e7807032b..a2671d48e 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -778,11 +778,15 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: if value is not None: if measurement == "wind_vector": value = value.split(",") - data["wind_speed"] = format_measure(value[0].strip("("), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) - data["wind_bearing"] = format_measure(value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + data["weather"]["wind_speed"] = format_measure( + value[0].strip("("), getattr(attr, ATTR_UNIT_OF_MEASUREMENT) + ) + data["weather"]["wind_bearing"] = format_measure( + value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT) + ) self._count += 2 else: - data[measurement] = value + data["weather"][measurement] = value self._count += 1 def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int | str| None: From b47cd5062bcef9d343acc8664bcce05465c9e3fc Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 08:51:25 +0100 Subject: [PATCH 18/37] Fix --- plugwise/helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index a2671d48e..f37f02327 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -771,6 +771,7 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: """ measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.gateway_id: + data["weather"] = {} for measurement, attr in measurements.items(): LOGGER.debug("HOI meas: %s", measurement) value = self._object_value(self._home_location, measurement, attr) @@ -801,7 +802,7 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int value = found.text match measurement: case "humidity": - return int(value) + return int(float(value)) case "outdoor_temperature": return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) case "solar_irradiance": From 6067b227af3126aa587ac188714282cb096d1d88 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 09:00:45 +0100 Subject: [PATCH 19/37] Update Adam testdata, device-items --- tests/data/adam/adam_heatpump_cooling.json | 11 ++++++++--- tests/data/adam/adam_jip.json | 11 ++++++++--- .../data/adam/adam_multiple_devices_per_zone.json | 11 ++++++++--- .../adam/adam_onoff_cooling_fake_firmware.json | 11 ++++++++--- tests/data/adam/adam_plus_anna.json | 11 ++++++++--- tests/data/adam/adam_plus_anna_new.json | 11 ++++++++--- .../adam/adam_plus_anna_new_regulation_off.json | 11 ++++++++--- tests/data/adam/adam_zone_per_device.json | 11 ++++++++--- tests/test_adam.py | 14 +++++++------- 9 files changed, 71 insertions(+), 31 deletions(-) diff --git a/tests/data/adam/adam_heatpump_cooling.json b/tests/data/adam/adam_heatpump_cooling.json index 0dd1354b8..27b3f9a0f 100644 --- a/tests/data/adam/adam_heatpump_cooling.json +++ b/tests/data/adam/adam_heatpump_cooling.json @@ -305,10 +305,15 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", - "sensors": { - "outdoor_temperature": 13.4 - }, "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 13.4, + "solar_irradiance": 208.2, + "weather_description": "clouded", + "wind_bearing": 228.0, + "wind_speed": 1.79 + }, "zigbee_mac_address": "ABCD012345670101" }, "7fda9f84f01342f8afe9ebbbbff30c0f": { diff --git a/tests/data/adam/adam_jip.json b/tests/data/adam/adam_jip.json index 6d021a276..4b812a7d5 100644 --- a/tests/data/adam/adam_jip.json +++ b/tests/data/adam/adam_jip.json @@ -225,10 +225,15 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 24.9 - }, "vendor": "Plugwise", + "weather": { + "humidity": 68, + "outdoor_temperature": 24.9, + "solar_irradiance": 449.2, + "weather_description": "overcast", + "wind_bearing": 216.0, + "wind_speed": 2.68 + }, "zigbee_mac_address": "ABCD012345670101" }, "d27aede973b54be484f6842d1b2802ad": { diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index 523f9cfcc..4522ae314 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -580,10 +580,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 7.81 - }, "vendor": "Plugwise", + "weather": { + "humidity": 75, + "outdoor_temperature": 7.81, + "solar_irradiance": 157.5, + "weather_description": "cloudy", + "wind_bearing": 40.0, + "wind_speed": 8.2 + }, "zigbee_mac_address": "ABCD012345670101" } } diff --git a/tests/data/adam/adam_onoff_cooling_fake_firmware.json b/tests/data/adam/adam_onoff_cooling_fake_firmware.json index 612e5caa5..4941b71c9 100644 --- a/tests/data/adam/adam_onoff_cooling_fake_firmware.json +++ b/tests/data/adam/adam_onoff_cooling_fake_firmware.json @@ -59,10 +59,15 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", - "sensors": { - "outdoor_temperature": 13.4 - }, "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 13.4, + "solar_irradiance": 208.2, + "weather_description": "clouded", + "wind_bearing": 228.0, + "wind_speed": 1.79 + }, "zigbee_mac_address": "ABCD012345670101" }, "ca79d23ae0094120b877558734cff85c": { diff --git a/tests/data/adam/adam_plus_anna.json b/tests/data/adam/adam_plus_anna.json index bf471305e..2ff687b50 100644 --- a/tests/data/adam/adam_plus_anna.json +++ b/tests/data/adam/adam_plus_anna.json @@ -86,10 +86,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 11.9 - }, "vendor": "Plugwise", + "weather": { + "humidity": 58, + "outdoor_temperature": 11.9, + "solar_irradiance": 53.8, + "weather_description": "overcast", + "wind_bearing": 220.0, + "wind_speed": 2.6 + }, "zigbee_mac_address": "ABCD012345670101" }, "ee62cad889f94e8ca3d09021f03a660b": { diff --git a/tests/data/adam/adam_plus_anna_new.json b/tests/data/adam/adam_plus_anna_new.json index 22146d9f7..b328b61c4 100644 --- a/tests/data/adam/adam_plus_anna_new.json +++ b/tests/data/adam/adam_plus_anna_new.json @@ -172,10 +172,15 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 9.19 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": 9.19, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { diff --git a/tests/data/adam/adam_plus_anna_new_regulation_off.json b/tests/data/adam/adam_plus_anna_new_regulation_off.json index c27d1e58d..93ce93774 100644 --- a/tests/data/adam/adam_plus_anna_new_regulation_off.json +++ b/tests/data/adam/adam_plus_anna_new_regulation_off.json @@ -172,10 +172,15 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "off", - "sensors": { - "outdoor_temperature": 9.19 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": 9.19, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index b16d8807c..da52897ab 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -577,10 +577,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 7.69 - }, "vendor": "Plugwise", + "weather": { + "humidity": 70, + "outdoor_temperature": 7.69, + "solar_irradiance": 86.2, + "weather_description": "cloudy", + "wind_bearing": 40.0, + "wind_speed": 7.2 + }, "zigbee_mac_address": "ABCD012345670101" } } diff --git a/tests/test_adam.py b/tests/test_adam.py index bc521104f..59b7e8911 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -36,7 +36,7 @@ async def test_connect_adam_plus_anna_new(self): assert smile.gateway_id == "da224107914542988a88561b4452b0f6" assert smile._last_active["f2bf9048bef64cc5b6d5110154e33c81"] == "Weekschema" assert smile._last_active["f871b8c4d63549319221e294e4f88074"] == "Badkamer" - assert self.entity_items == 177 + assert self.entity_items == 182 assert self.entity_list == [ "da224107914542988a88561b4452b0f6", "056ee145a816487eaa69243c3280f8bf", @@ -207,7 +207,7 @@ async def test_connect_adam_zone_per_device(self): assert smile._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert smile._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert smile._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 369 + assert self.entity_items == 374 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications await smile.delete_notification() @@ -287,7 +287,7 @@ async def test_connect_adam_multiple_devices_per_zone(self): assert smile._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert smile._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert smile._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 369 + assert self.entity_items == 374 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications @@ -325,7 +325,7 @@ async def test_adam_heatpump_cooling(self): assert smile._last_active["a562019b0b1f47a4bde8ebe3dbe3e8a9"] == WERKDAG_SCHEMA assert smile._last_active["8cf650a4c10c44819e426bed406aec34"] == WERKDAG_SCHEMA assert smile._last_active["5cc21042f87f4b4c94ccb5537c47a53f"] == WERKDAG_SCHEMA - assert self.entity_items == 497 + assert self.entity_items == 502 assert self.cooling_present assert self._cooling_enabled @@ -348,7 +348,7 @@ async def test_connect_adam_onoff_cooling_fake_firmware(self): ) await self.device_test(smile, "2022-01-02 00:00:01", testdata) - assert self.entity_items == 64 + assert self.entity_items == 69 assert self.cooling_present # assert self._cooling_enabled - no cooling_enabled indication present @@ -373,7 +373,7 @@ async def test_connect_adam_plus_anna(self): await self.device_test(smile, "2020-03-22 00:00:01", testdata) assert smile.gateway_id == "b128b4bbbd1f47e9bf4d756e8fb5ee94" assert smile._last_active["009490cc2f674ce6b576863fbb64f867"] == "Weekschema" - assert self.entity_items == 80 + assert self.entity_items == 85 assert "6fb89e35caeb4b1cb275184895202d84" in self.notifications result = await self.tinker_thermostat( @@ -419,7 +419,7 @@ async def test_adam_plus_jip(self): assert smile._last_active["06aecb3d00354375924f50c47af36bd2"] is None assert smile._last_active["d27aede973b54be484f6842d1b2802ad"] is None assert smile._last_active["13228dab8ce04617af318a2888b3c548"] is None - assert self.entity_items == 244 + assert self.entity_items == 249 # Negative test result = await self.tinker_thermostat( From 5bf9c87cde90460d94af9aea04bbeeb92624daec Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 15:01:40 +0100 Subject: [PATCH 20/37] Update Anna testdata, device-items --- tests/data/anna/anna_elga_2.json | 13 +++++--- tests/data/anna/anna_elga_2_cooling.json | 13 +++++--- .../anna_elga_2_cooling_UPDATED_DATA.json | 13 +++++--- tests/data/anna/anna_elga_2_schedule_off.json | 13 +++++--- tests/data/anna/anna_elga_no_cooling.json | 13 +++++--- tests/data/anna/anna_heatpump_cooling.json | 13 +++++--- .../anna_heatpump_cooling_fake_firmware.json | 13 +++++--- tests/data/anna/anna_heatpump_heating.json | 13 +++++--- .../data/anna/anna_loria_cooling_active.json | 13 +++++--- tests/data/anna/anna_loria_driessens.json | 13 +++++--- tests/data/anna/anna_loria_heating_idle.json | 13 +++++--- tests/data/anna/anna_v4.json | 13 +++++--- tests/data/anna/anna_v4_UPDATED_DATA.json | 9 ++++-- tests/data/anna/anna_v4_dhw.json | 13 +++++--- tests/data/anna/anna_v4_no_tag.json | 13 +++++--- .../data/anna/anna_without_boiler_fw441.json | 13 +++++--- tests/test_anna.py | 30 +++++++++---------- 17 files changed, 157 insertions(+), 77 deletions(-) diff --git a/tests/data/anna/anna_elga_2.json b/tests/data/anna/anna_elga_2.json index 5eecd2289..b35a09905 100644 --- a/tests/data/anna/anna_elga_2.json +++ b/tests/data/anna/anna_elga_2.json @@ -83,10 +83,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 13.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 13.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } } } diff --git a/tests/data/anna/anna_elga_2_cooling.json b/tests/data/anna/anna_elga_2_cooling.json index 07ab576ef..d284e00b5 100644 --- a/tests/data/anna/anna_elga_2_cooling.json +++ b/tests/data/anna/anna_elga_2_cooling.json @@ -83,10 +83,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 31.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 31.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } } } diff --git a/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json b/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json index cddbcd352..777985f67 100644 --- a/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json +++ b/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json @@ -83,10 +83,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 3.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 3.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } } } diff --git a/tests/data/anna/anna_elga_2_schedule_off.json b/tests/data/anna/anna_elga_2_schedule_off.json index 94afaa3ff..a75ce209f 100644 --- a/tests/data/anna/anna_elga_2_schedule_off.json +++ b/tests/data/anna/anna_elga_2_schedule_off.json @@ -83,10 +83,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 13.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 13.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } } } diff --git a/tests/data/anna/anna_elga_no_cooling.json b/tests/data/anna/anna_elga_no_cooling.json index 5653798f3..850f53cc8 100644 --- a/tests/data/anna/anna_elga_no_cooling.json +++ b/tests/data/anna/anna_elga_no_cooling.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 20.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 20.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, diff --git a/tests/data/anna/anna_heatpump_cooling.json b/tests/data/anna/anna_heatpump_cooling.json index fdca784f0..9bf41d432 100644 --- a/tests/data/anna/anna_heatpump_cooling.json +++ b/tests/data/anna/anna_heatpump_cooling.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 22.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 35, + "outdoor_temperature": 22.0, + "solar_irradiance": 207.2, + "weather_description": "overcast", + "wind_bearing": 0.0, + "wind_speed": 2.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, diff --git a/tests/data/anna/anna_heatpump_cooling_fake_firmware.json b/tests/data/anna/anna_heatpump_cooling_fake_firmware.json index cbc7e0a85..7d4cd6597 100644 --- a/tests/data/anna/anna_heatpump_cooling_fake_firmware.json +++ b/tests/data/anna/anna_heatpump_cooling_fake_firmware.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 22.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 35, + "outdoor_temperature": 22.0, + "solar_irradiance": 207.2, + "weather_description": "overcast", + "wind_bearing": 0.0, + "wind_speed": 2.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, diff --git a/tests/data/anna/anna_heatpump_heating.json b/tests/data/anna/anna_heatpump_heating.json index c1a6526ce..ad66932e2 100644 --- a/tests/data/anna/anna_heatpump_heating.json +++ b/tests/data/anna/anna_heatpump_heating.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 20.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 20.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, diff --git a/tests/data/anna/anna_loria_cooling_active.json b/tests/data/anna/anna_loria_cooling_active.json index 4c104d005..2b853720f 100644 --- a/tests/data/anna/anna_loria_cooling_active.json +++ b/tests/data/anna/anna_loria_cooling_active.json @@ -46,10 +46,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 15.5 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 65, + "outdoor_temperature": 15.5, + "solar_irradiance": 84.7, + "weather_description": "overcast", + "wind_bearing": 289.0, + "wind_speed": 2.2 + } }, "bfb5ee0a88e14e5f97bfa725a760cc49": { "available": true, diff --git a/tests/data/anna/anna_loria_driessens.json b/tests/data/anna/anna_loria_driessens.json index dd265e086..6dc1ad1a8 100644 --- a/tests/data/anna/anna_loria_driessens.json +++ b/tests/data/anna/anna_loria_driessens.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 6.81 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 6.81, + "solar_irradiance": 97.6, + "weather_description": "clouded", + "wind_bearing": 230.0, + "wind_speed": 4.12 + } }, "9fb768d699e44c7fb5cc50309dc4e7d4": { "active_preset": "home", diff --git a/tests/data/anna/anna_loria_heating_idle.json b/tests/data/anna/anna_loria_heating_idle.json index 5bd6afbc1..9d099d3fe 100644 --- a/tests/data/anna/anna_loria_heating_idle.json +++ b/tests/data/anna/anna_loria_heating_idle.json @@ -46,10 +46,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 15.5 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 65, + "outdoor_temperature": 15.5, + "solar_irradiance": 84.7, + "weather_description": "overcast", + "wind_bearing": 289.0, + "wind_speed": 2.2 + } }, "bfb5ee0a88e14e5f97bfa725a760cc49": { "available": true, diff --git a/tests/data/anna/anna_v4.json b/tests/data/anna/anna_v4.json index 060168bc2..e257ff14c 100644 --- a/tests/data/anna/anna_v4.json +++ b/tests/data/anna/anna_v4.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, diff --git a/tests/data/anna/anna_v4_UPDATED_DATA.json b/tests/data/anna/anna_v4_UPDATED_DATA.json index e3c4c1382..697532205 100644 --- a/tests/data/anna/anna_v4_UPDATED_DATA.json +++ b/tests/data/anna/anna_v4_UPDATED_DATA.json @@ -47,8 +47,13 @@ } }, "0466eae8520144c78afb29628384edeb": { - "sensors": { - "outdoor_temperature": 6.44 + "weather": { + "humidity": 81, + "outdoor_temperature": 6.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 } } } diff --git a/tests/data/anna/anna_v4_dhw.json b/tests/data/anna/anna_v4_dhw.json index 8019a7bf5..33ab7f7a3 100644 --- a/tests/data/anna/anna_v4_dhw.json +++ b/tests/data/anna/anna_v4_dhw.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, diff --git a/tests/data/anna/anna_v4_no_tag.json b/tests/data/anna/anna_v4_no_tag.json index 914cb889d..7e0d8aeb8 100644 --- a/tests/data/anna/anna_v4_no_tag.json +++ b/tests/data/anna/anna_v4_no_tag.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, diff --git a/tests/data/anna/anna_without_boiler_fw441.json b/tests/data/anna/anna_without_boiler_fw441.json index d8b883551..fcd93aab5 100644 --- a/tests/data/anna/anna_without_boiler_fw441.json +++ b/tests/data/anna/anna_without_boiler_fw441.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 8.31 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 91, + "outdoor_temperature": 8.31, + "solar_irradiance": 0.0, + "weather_description": "rain", + "wind_bearing": 208.0, + "wind_speed": 6.77 + } }, "c46b4794d28149699eacf053deedd003": { "binary_sensors": { diff --git a/tests/test_anna.py b/tests/test_anna.py index a5e81702b..651f70f3c 100644 --- a/tests/test_anna.py +++ b/tests/test_anna.py @@ -30,7 +30,7 @@ async def test_connect_anna_v4(self): await self.device_test(smile, "2020-04-05 00:00:01", testdata) assert smile.gateway_id == "0466eae8520144c78afb29628384edeb" assert smile._last_active["eb5309212bf5407bb143e5bfa3b18aee"] == "Standaard" - assert self.entity_items == 58 + assert self.entity_items == 63 assert not self.notifications assert not self.cooling_present @@ -109,7 +109,7 @@ async def test_connect_anna_v4_dhw(self): await self.device_test(smile, "2020-04-05 00:00:01", testdata) assert smile._last_active["eb5309212bf5407bb143e5bfa3b18aee"] == "Standaard" - assert self.entity_items == 58 + assert self.entity_items == 63 assert not self.notifications result = await self.tinker_thermostat( @@ -138,7 +138,7 @@ async def test_connect_anna_v4_no_tag(self): ) await self.device_test(smile, "2020-04-05 00:00:01", testdata) - assert self.entity_items == 58 + assert self.entity_items == 63 result = await self.tinker_thermostat( smile, @@ -167,7 +167,7 @@ async def test_connect_anna_without_boiler_fw441(self): await self.device_test(smile, "2022-05-16 00:00:01", testdata) assert smile._last_active["c34c6864216446528e95d88985e714cc"] == "Normaal" - assert self.entity_items == 39 + assert self.entity_items == 44 assert not self.notifications result = await self.tinker_thermostat( @@ -196,7 +196,7 @@ async def test_connect_anna_heatpump_heating(self): await self.device_test(smile, "2020-04-12 00:00:01", testdata) assert smile.gateway_id == "015ae9ea3f964e668e490fa39da3870b" assert smile._last_active["c784ee9fdab44e1395b8dee7d7a497d5"] == "standaard" - assert self.entity_items == 67 + assert self.entity_items == 72 assert not self.notifications assert self.cooling_present assert not self._cooling_enabled @@ -226,7 +226,7 @@ async def test_connect_anna_heatpump_heating(self): await self.device_test( smile, "2020-04-13 00:00:01", testdata_updated, initialize=False ) - assert self.entity_items == 64 + assert self.entity_items == 69 await smile.close_connection() await self.disconnect(server, client) @@ -252,7 +252,7 @@ async def test_connect_anna_heatpump_cooling(self): await self.device_test(smile, "2020-04-19 00:00:01", testdata) assert smile._last_active["c784ee9fdab44e1395b8dee7d7a497d5"] == "standaard" - assert self.entity_items == 64 + assert self.entity_items == 69 assert self.cooling_present assert not self.notifications @@ -298,7 +298,7 @@ async def test_connect_anna_heatpump_cooling_fake_firmware(self): ) await self.device_test(smile, "2020-04-19 00:00:01", testdata) - assert self.entity_items == 64 + assert self.entity_items == 69 assert self.cooling_present assert self._cooling_enabled assert self._cooling_active @@ -325,7 +325,7 @@ async def test_connect_anna_elga_no_cooling(self): await self.device_test(smile, "2020-04-12 00:00:01", testdata) assert smile.gateway_id == "015ae9ea3f964e668e490fa39da3870b" assert smile._last_active["c784ee9fdab44e1395b8dee7d7a497d5"] == "standaard" - assert self.entity_items == 63 + assert self.entity_items == 68 assert not self.notifications assert not self.cooling_present @@ -352,7 +352,7 @@ async def test_connect_anna_elga_2(self): smile._last_active["d3ce834534114348be628b61b26d9220"] == THERMOSTAT_SCHEDULE ) - assert self.entity_items == 63 + assert self.entity_items == 68 assert smile.gateway_id == "fb49af122f6e4b0f91267e1cf7666d6f" assert self.cooling_present assert not self._cooling_enabled @@ -377,7 +377,7 @@ async def test_connect_anna_elga_2_schedule_off(self): ) assert self.cooling_present assert not self._cooling_enabled - assert self.entity_items == 63 + assert self.entity_items == 68 await smile.close_connection() await self.disconnect(server, client) @@ -406,7 +406,7 @@ async def test_connect_anna_elga_2_cooling(self): smile._last_active["d3ce834534114348be628b61b26d9220"] == THERMOSTAT_SCHEDULE ) - assert self.entity_items == 63 + assert self.entity_items == 68 assert not self.notifications assert self.cooling_present @@ -460,7 +460,7 @@ async def test_connect_anna_loria_heating_idle(self): await self.device_test(smile, "2022-05-16 00:00:01", testdata) assert smile._last_active["15da035090b847e7a21f93e08c015ebc"] == "Winter" - assert self.entity_items == 66 + assert self.entity_items == 71 assert self.cooling_present assert not self._cooling_enabled @@ -528,7 +528,7 @@ async def test_connect_anna_loria_cooling_active(self): await self.device_test(smile, "2022-05-16 00:00:01", testdata) assert smile._last_active["15da035090b847e7a21f93e08c015ebc"] == "Winter" - assert self.entity_items == 66 + assert self.entity_items == 71 assert self.cooling_present assert self._cooling_enabled @@ -551,7 +551,7 @@ async def test_connect_anna_loria_driessens(self): ) await self.device_test(smile, "2022-05-16 00:00:01", testdata) - assert self.entity_items == 66 + assert self.entity_items == 71 assert self.cooling_present assert not self._cooling_enabled From 2d42d5164f662ae745b95d3df8bd1a311fe7cf60 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 15:38:35 +0100 Subject: [PATCH 21/37] Revert attrs -> attr --- plugwise/common.py | 2 +- plugwise/helper.py | 22 +++++++++++----------- plugwise/util.py | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index c69f5fc33..d1300b592 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -169,7 +169,7 @@ def _power_data_peak_value(self, loc: Munch, legacy: bool) -> Munch: # --------------------------------------# loc.net_string = f"net_electricity_{log_found}" val = loc.logs.find(loc.locator).text - loc.f_val = power_data_local_format(loc.attr, loc.key_string, val) + loc.f_val = power_data_local_format(loc.attrs, loc.key_string, val) return loc diff --git a/plugwise/helper.py b/plugwise/helper.py index f37f02327..038ca585e 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -587,7 +587,7 @@ def _power_data_from_location(self, loc_id: str) -> GwEntityData: search = self._domain_objects loc.logs = search.find(f'./location[@id="{loc_id}"]/logs') - for loc.measurement, loc.attr in P1_MEASUREMENTS.items(): + for loc.measurement, loc.attrs in P1_MEASUREMENTS.items(): for loc.log_type in log_list: self._collect_power_values(data, loc, t_string) @@ -601,13 +601,13 @@ def _appliance_measurements( measurements: dict[str, DATA | UOM], ) -> None: """Helper-function for _get_measurement_data() - collect appliance measurement data.""" - for measurement, attr in measurements.items(): + for measurement, attrs in measurements.items(): p_locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' if (appl_p_loc := appliance.find(p_locator)) is not None: if skip_obsolete_measurements(appliance, measurement): continue - if new_name := getattr(attr, ATTR_NAME, None): + if new_name := getattr(attrs, ATTR_NAME, None): measurement = new_name match measurement: @@ -616,7 +616,7 @@ def _appliance_measurements( case "select_dhw_mode": data["select_dhw_mode"] = appl_p_loc.text - common_match_cases(measurement, attr, appl_p_loc, data) + common_match_cases(measurement, attrs, appl_p_loc, data) i_locator = f'.//logs/interval_log[type="{measurement}"]/period/measurement' if (appl_i_loc := appliance.find(i_locator)) is not None: @@ -772,25 +772,25 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.gateway_id: data["weather"] = {} - for measurement, attr in measurements.items(): + for measurement, attrs in measurements.items(): LOGGER.debug("HOI meas: %s", measurement) - value = self._object_value(self._home_location, measurement, attr) + value = self._object_value(self._home_location, measurement, attrs) LOGGER.debug("HOI value: %s", value) if value is not None: if measurement == "wind_vector": value = value.split(",") data["weather"]["wind_speed"] = format_measure( - value[0].strip("("), getattr(attr, ATTR_UNIT_OF_MEASUREMENT) + value[0].strip("("), getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) ) data["weather"]["wind_bearing"] = format_measure( - value[1].strip(")"), getattr(attr, ATTR_UNIT_OF_MEASUREMENT) + value[1].strip(")"), getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) ) self._count += 2 else: data["weather"][measurement] = value self._count += 1 - def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int | str| None: + def _object_value(self, obj_id: str, measurement: str, attrs: str) -> float | int | str| None: """Helper-function for smile.py: _get_entity_data(). Obtain the value/state for the given object from a location in DOMAIN_OBJECTS @@ -804,9 +804,9 @@ def _object_value(self, obj_id: str, measurement: str, attr: str) -> float | int case "humidity": return int(float(value)) case "outdoor_temperature": - return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + return format_measure(value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) case "solar_irradiance": - return format_measure(value, getattr(attr, ATTR_UNIT_OF_MEASUREMENT)) + return format_measure(value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) case "weather_description": return value case "wind_vector": diff --git a/plugwise/util.py b/plugwise/util.py index 4549c72d2..94ffce629 100644 --- a/plugwise/util.py +++ b/plugwise/util.py @@ -119,7 +119,7 @@ def check_model(name: str | None, vendor_name: str | None) -> str | None: def common_match_cases( measurement: str, - attr: DATA | UOM, + attrs: DATA | UOM, location: etree, data: GwEntityData, ) -> None: @@ -132,7 +132,7 @@ def common_match_cases( case _ as measurement if measurement in SENSORS: s_key = cast(SensorType, measurement) s_value = format_measure( - location.text, getattr(attr, ATTR_UNIT_OF_MEASUREMENT) + location.text, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) ) data["sensors"][s_key] = s_value case _ as measurement if measurement in SWITCHES: @@ -189,13 +189,13 @@ def get_vendor_name(module: etree, model_data: ModuleData) -> ModuleData: def power_data_local_format( - attr: dict[str, str], key_string: str, val: str + attrs: dict[str, str], key_string: str, val: str ) -> float | int: """Format power data.""" # Special formatting of P1_MEASUREMENT POWER_WATT values, do not move to util-format_measure() function! if all(item in key_string for item in ("electricity", "cumulative")): return format_measure(val, ENERGY_KILO_WATT_HOUR) - if (attr_uom := getattr(atts, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: + if (attr_uom := getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: return int(round(float(val))) return format_measure(val, attr_uom) From 5735dd261881aff92bd0ab4e5ace97f5505df749 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 15:42:18 +0100 Subject: [PATCH 22/37] Remove debugging --- plugwise/helper.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 038ca585e..1f548be72 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -773,9 +773,7 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: if self._is_thermostat and entity_id == self.gateway_id: data["weather"] = {} for measurement, attrs in measurements.items(): - LOGGER.debug("HOI meas: %s", measurement) value = self._object_value(self._home_location, measurement, attrs) - LOGGER.debug("HOI value: %s", value) if value is not None: if measurement == "wind_vector": value = value.split(",") From 5561f35618bfb0c4aa7f5692d4662a2aebd2b5f0 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 15:47:49 +0100 Subject: [PATCH 23/37] Add typing --- plugwise/constants.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugwise/constants.py b/plugwise/constants.py index a415d45c5..6fdc7f3dc 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -391,6 +391,15 @@ "cooling_enabled": "cooling_ena_switch", "domestic_hot_water_comfort_mode": "dhw_cm_switch", } +WeatherType = Literal[ + "humidity", + "outdoor_temperature", + "solar_irradiance", + "weather_description", + "wind_bearing", + "wind_speed", +] +WEATHER: Final[tuple[str, ...]] = get_args(WeatherType) ZONE_THERMOSTATS: Final[tuple[str, ...]] = ( "thermostat", @@ -512,6 +521,18 @@ class ThermoLoc(TypedDict, total=False): secondary: list[str] +@dataclass +class WeatherData: + """Smile Weather data class.""" + + humidity: int + outdoor_temperature: float + solar_irradiance: float + weather_description: str + wind_bearing: float + wind_speed: float + + class ActuatorData(TypedDict, total=False): """Actuator data for thermostat types.""" @@ -583,6 +604,7 @@ class GwEntityData(TypedDict, total=False): switches: SmileSwitches temperature_offset: ActuatorData thermostat: ActuatorData + weather: WeatherData @dataclass From acd0cee16fa62958fa0a3d15549b5f8f515e47b2 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 15:51:15 +0100 Subject: [PATCH 24/37] Further typing fixes --- plugwise/common.py | 2 ++ plugwise/constants.py | 3 +-- plugwise/helper.py | 36 ++++++++++++++++++++++++++---------- plugwise/util.py | 8 +++++--- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index d1300b592..f2019f54a 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -147,6 +147,8 @@ def _count_data_items(self, data: GwEntityData) -> None: self._count += len(data["sensors"]) - 1 if "switches" in data: self._count += len(data["switches"]) - 1 + if "weather" in data: + self._count += len(data["weather"]) - 1 self._count += len(data) def _power_data_peak_value(self, loc: Munch, legacy: bool) -> Munch: diff --git a/plugwise/constants.py b/plugwise/constants.py index 6fdc7f3dc..044b48dc9 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -521,8 +521,7 @@ class ThermoLoc(TypedDict, total=False): secondary: list[str] -@dataclass -class WeatherData: +class WeatherData(TypedDict, total=False): """Smile Weather data class.""" humidity: int diff --git a/plugwise/helper.py b/plugwise/helper.py index 1f548be72..739e1ae6a 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -44,6 +44,7 @@ SensorType, ThermoLoc, ToggleNameType, + WeatherType, ) from plugwise.exceptions import ( ConnectionFailedError, @@ -527,7 +528,12 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: Collect the appliance-data based on entity_id. """ - data: GwEntityData = {"binary_sensors": {}, "sensors": {}, "switches": {}} + data: GwEntityData = { + "binary_sensors": {}, + "sensors": {}, + "switches": {}, + "weather": {}, + } # Get P1 smartmeter data from LOCATIONS entity = self.gw_entities[entity_id] # !! DON'T CHANGE below two if-lines, will break stuff !! @@ -771,29 +777,33 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: """ measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.gateway_id: - data["weather"] = {} for measurement, attrs in measurements.items(): value = self._object_value(self._home_location, measurement, attrs) if value is not None: if measurement == "wind_vector": - value = value.split(",") + value_list: list[str] = str(value).split(",") data["weather"]["wind_speed"] = format_measure( - value[0].strip("("), getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) + value_list[0].strip("("), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), ) data["weather"]["wind_bearing"] = format_measure( - value[1].strip(")"), getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) + value_list[1].strip(")"), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), ) self._count += 2 else: - data["weather"][measurement] = value + key = cast(WeatherType, measurement) + data["weather"][key] = value self._count += 1 - def _object_value(self, obj_id: str, measurement: str, attrs: str) -> float | int | str| None: + def _object_value( + self, obj_id: str, measurement: str, attrs: DATA | UOM + ) -> float | int | str | None: """Helper-function for smile.py: _get_entity_data(). Obtain the value/state for the given object from a location in DOMAIN_OBJECTS """ - value: float | int | str | None = None + value: str = "" search = self._domain_objects locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' if (found := search.find(locator)) is not None: @@ -802,14 +812,20 @@ def _object_value(self, obj_id: str, measurement: str, attrs: str) -> float | in case "humidity": return int(float(value)) case "outdoor_temperature": - return format_measure(value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) + return format_measure( + value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) + ) case "solar_irradiance": - return format_measure(value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) + return format_measure( + value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) + ) case "weather_description": return value case "wind_vector": return value + return None + def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). diff --git a/plugwise/util.py b/plugwise/util.py index 94ffce629..ec23243da 100644 --- a/plugwise/util.py +++ b/plugwise/util.py @@ -203,12 +203,14 @@ def power_data_local_format( def remove_empty_platform_dicts(data: GwEntityData) -> None: """Helper-function for removing any empty platform dicts.""" - if not data["binary_sensors"]: + if "binary_sensors" in data and not data["binary_sensors"]: data.pop("binary_sensors") - if not data["sensors"]: + if "sensors" in data and not data["sensors"]: data.pop("sensors") - if not data["switches"]: + if "switches" in data and not data["switches"]: data.pop("switches") + if "weather" in data and not data["weather"]: + data.pop("weather") def return_valid(value: etree | None, default: etree) -> etree: From 11f92874167b5cd0017136f98ea0ad5896821cb0 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 16:46:08 +0100 Subject: [PATCH 25/37] Update manual_fixtures script --- scripts/manual_fixtures.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/manual_fixtures.py b/scripts/manual_fixtures.py index 6e5946c92..4d17096aa 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -139,7 +139,7 @@ def json_writer(manual_name: str, all_data: dict) -> None: m_adam_cooling["devices"]["da224107914542988a88561b4452b0f6"][ "regulation_modes" ].append("cooling") -m_adam_cooling["devices"]["da224107914542988a88561b4452b0f6"]["sensors"][ +m_adam_cooling["devices"]["da224107914542988a88561b4452b0f6"]["weather"][ "outdoor_temperature" ] = 29.65 @@ -220,7 +220,7 @@ def json_writer(manual_name: str, all_data: dict) -> None: m_adam_heating["devices"]["da224107914542988a88561b4452b0f6"][ "regulation_modes" ].remove("cooling") -m_adam_heating["devices"]["da224107914542988a88561b4452b0f6"]["sensors"][ +m_adam_heating["devices"]["da224107914542988a88561b4452b0f6"]["weather"][ "outdoor_temperature" ] = -1.25 @@ -295,7 +295,7 @@ def json_writer(manual_name: str, all_data: dict) -> None: ] = 28.0 # Go for 015a -m_anna_heatpump_cooling["devices"]["015ae9ea3f964e668e490fa39da3870b"]["sensors"][ +m_anna_heatpump_cooling["devices"]["015ae9ea3f964e668e490fa39da3870b"]["weather"][ "outdoor_temperature" ] = 28.2 From 653e1e7b9745366bea41720ed3aa99fba17ede03 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 16:46:58 +0100 Subject: [PATCH 26/37] Save updated fixtures --- fixtures/adam_heatpump_cooling/all_data.json | 13 +++++++++---- fixtures/adam_jip/all_data.json | 13 +++++++++---- .../adam_multiple_devices_per_zone/all_data.json | 13 +++++++++---- .../all_data.json | 13 +++++++++---- fixtures/adam_plus_anna/all_data.json | 13 +++++++++---- fixtures/adam_plus_anna_new/all_data.json | 13 +++++++++---- .../all_data.json | 13 +++++++++---- fixtures/adam_zone_per_device/all_data.json | 13 +++++++++---- fixtures/anna_elga_2/all_data.json | 15 ++++++++++----- fixtures/anna_elga_2_cooling/all_data.json | 15 ++++++++++----- fixtures/anna_elga_2_schedule_off/all_data.json | 15 ++++++++++----- fixtures/anna_elga_no_cooling/all_data.json | 15 ++++++++++----- fixtures/anna_heatpump_cooling/all_data.json | 15 ++++++++++----- .../all_data.json | 15 ++++++++++----- fixtures/anna_heatpump_heating/all_data.json | 15 ++++++++++----- fixtures/anna_loria_cooling_active/all_data.json | 15 ++++++++++----- fixtures/anna_loria_driessens/all_data.json | 15 ++++++++++----- fixtures/anna_loria_heating_idle/all_data.json | 15 ++++++++++----- fixtures/anna_v4/all_data.json | 15 ++++++++++----- fixtures/anna_v4_dhw/all_data.json | 15 ++++++++++----- fixtures/anna_v4_no_tag/all_data.json | 15 ++++++++++----- fixtures/anna_without_boiler_fw441/all_data.json | 15 ++++++++++----- fixtures/m_adam_cooling/all_data.json | 11 ++++++++--- fixtures/m_adam_heating/all_data.json | 11 ++++++++--- fixtures/m_adam_jip/all_data.json | 13 +++++++++---- .../all_data.json | 13 +++++++++---- fixtures/m_anna_heatpump_cooling/all_data.json | 15 ++++++++++----- fixtures/m_anna_heatpump_idle/all_data.json | 15 ++++++++++----- 28 files changed, 266 insertions(+), 126 deletions(-) diff --git a/fixtures/adam_heatpump_cooling/all_data.json b/fixtures/adam_heatpump_cooling/all_data.json index 8c7e1667e..e332a2a66 100644 --- a/fixtures/adam_heatpump_cooling/all_data.json +++ b/fixtures/adam_heatpump_cooling/all_data.json @@ -305,10 +305,15 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", - "sensors": { - "outdoor_temperature": 13.4 - }, "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 13.4, + "solar_irradiance": 208.2, + "weather_description": "clouded", + "wind_bearing": 228.0, + "wind_speed": 1.79 + }, "zigbee_mac_address": "ABCD012345670101" }, "7fda9f84f01342f8afe9ebbbbff30c0f": { @@ -809,7 +814,7 @@ "cooling_present": true, "gateway_id": "7d97fc3117784cfdafe347bcedcbbbcb", "heater_id": "0ca13e8176204ca7bf6f09de59f81c83", - "item_count": 497, + "item_count": 502, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/adam_jip/all_data.json b/fixtures/adam_jip/all_data.json index 1dfe021ac..c77110905 100644 --- a/fixtures/adam_jip/all_data.json +++ b/fixtures/adam_jip/all_data.json @@ -229,10 +229,15 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 24.9 - }, "vendor": "Plugwise", + "weather": { + "humidity": 68, + "outdoor_temperature": 24.9, + "solar_irradiance": 449.2, + "weather_description": "overcast", + "wind_bearing": 216.0, + "wind_speed": 2.68 + }, "zigbee_mac_address": "ABCD012345670101" }, "d27aede973b54be484f6842d1b2802ad": { @@ -373,7 +378,7 @@ "cooling_present": false, "gateway_id": "b5c2386c6f6342669e50fe49dd05b188", "heater_id": "e4684553153b44afbef2200885f379dc", - "item_count": 244, + "item_count": 249, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/adam_multiple_devices_per_zone/all_data.json b/fixtures/adam_multiple_devices_per_zone/all_data.json index 4c8242b35..e44a04fa2 100644 --- a/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -580,10 +580,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 7.81 - }, "vendor": "Plugwise", + "weather": { + "humidity": 75, + "outdoor_temperature": 7.81, + "solar_irradiance": 157.5, + "weather_description": "cloudy", + "wind_bearing": 40.0, + "wind_speed": 8.2 + }, "zigbee_mac_address": "ABCD012345670101" } }, @@ -591,7 +596,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 369, + "item_count": 374, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." diff --git a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json index fba4e8168..95b534083 100644 --- a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json +++ b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json @@ -59,10 +59,15 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", - "sensors": { - "outdoor_temperature": 13.4 - }, "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 13.4, + "solar_irradiance": 208.2, + "weather_description": "clouded", + "wind_bearing": 228.0, + "wind_speed": 1.79 + }, "zigbee_mac_address": "ABCD012345670101" }, "ca79d23ae0094120b877558734cff85c": { @@ -114,7 +119,7 @@ "cooling_present": true, "gateway_id": "7d97fc3117784cfdafe347bcedcbbbcb", "heater_id": "0ca13e8176204ca7bf6f09de59f81c83", - "item_count": 64, + "item_count": 69, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/adam_plus_anna/all_data.json b/fixtures/adam_plus_anna/all_data.json index 1b2b11f71..2283dde6c 100644 --- a/fixtures/adam_plus_anna/all_data.json +++ b/fixtures/adam_plus_anna/all_data.json @@ -86,10 +86,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 11.9 - }, "vendor": "Plugwise", + "weather": { + "humidity": 58, + "outdoor_temperature": 11.9, + "solar_irradiance": 53.8, + "weather_description": "overcast", + "wind_bearing": 220.0, + "wind_speed": 2.6 + }, "zigbee_mac_address": "ABCD012345670101" }, "ee62cad889f94e8ca3d09021f03a660b": { @@ -128,7 +133,7 @@ "cooling_present": false, "gateway_id": "b128b4bbbd1f47e9bf4d756e8fb5ee94", "heater_id": "2743216f626f43948deec1f7ab3b3d70", - "item_count": 80, + "item_count": 85, "notifications": { "6fb89e35caeb4b1cb275184895202d84": { "error": "There is no OpenTherm communication with the boiler." diff --git a/fixtures/adam_plus_anna_new/all_data.json b/fixtures/adam_plus_anna_new/all_data.json index 9e074f344..8c151c996 100644 --- a/fixtures/adam_plus_anna_new/all_data.json +++ b/fixtures/adam_plus_anna_new/all_data.json @@ -172,10 +172,15 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 9.19 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": 9.19, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { @@ -288,7 +293,7 @@ "cooling_present": false, "gateway_id": "da224107914542988a88561b4452b0f6", "heater_id": "056ee145a816487eaa69243c3280f8bf", - "item_count": 177, + "item_count": 182, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/adam_plus_anna_new_regulation_off/all_data.json b/fixtures/adam_plus_anna_new_regulation_off/all_data.json index 8d447dc81..23a4888ef 100644 --- a/fixtures/adam_plus_anna_new_regulation_off/all_data.json +++ b/fixtures/adam_plus_anna_new_regulation_off/all_data.json @@ -172,10 +172,15 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "off", - "sensors": { - "outdoor_temperature": 9.19 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": 9.19, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { @@ -288,7 +293,7 @@ "cooling_present": false, "gateway_id": "da224107914542988a88561b4452b0f6", "heater_id": "056ee145a816487eaa69243c3280f8bf", - "item_count": 177, + "item_count": 182, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/adam_zone_per_device/all_data.json b/fixtures/adam_zone_per_device/all_data.json index a8d028c19..d751751cd 100644 --- a/fixtures/adam_zone_per_device/all_data.json +++ b/fixtures/adam_zone_per_device/all_data.json @@ -577,10 +577,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 7.69 - }, "vendor": "Plugwise", + "weather": { + "humidity": 70, + "outdoor_temperature": 7.69, + "solar_irradiance": 86.2, + "weather_description": "cloudy", + "wind_bearing": 40.0, + "wind_speed": 7.2 + }, "zigbee_mac_address": "ABCD012345670101" } }, @@ -588,7 +593,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 369, + "item_count": 374, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." diff --git a/fixtures/anna_elga_2/all_data.json b/fixtures/anna_elga_2/all_data.json index e56ec7d35..b8cf08286 100644 --- a/fixtures/anna_elga_2/all_data.json +++ b/fixtures/anna_elga_2/all_data.json @@ -83,17 +83,22 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 13.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 13.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } }, "gateway": { "cooling_present": true, "gateway_id": "fb49af122f6e4b0f91267e1cf7666d6f", "heater_id": "573c152e7d4f4720878222bd75638f5b", - "item_count": 63, + "item_count": 68, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_elga_2_cooling/all_data.json b/fixtures/anna_elga_2_cooling/all_data.json index 7b580695e..aaf39f908 100644 --- a/fixtures/anna_elga_2_cooling/all_data.json +++ b/fixtures/anna_elga_2_cooling/all_data.json @@ -83,17 +83,22 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 31.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 31.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } }, "gateway": { "cooling_present": true, "gateway_id": "fb49af122f6e4b0f91267e1cf7666d6f", "heater_id": "573c152e7d4f4720878222bd75638f5b", - "item_count": 63, + "item_count": 68, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_elga_2_schedule_off/all_data.json b/fixtures/anna_elga_2_schedule_off/all_data.json index 9054718c1..5f5d350df 100644 --- a/fixtures/anna_elga_2_schedule_off/all_data.json +++ b/fixtures/anna_elga_2_schedule_off/all_data.json @@ -83,17 +83,22 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 13.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 13.0, + "solar_irradiance": 0.0, + "weather_description": "cloudy", + "wind_bearing": 120.0, + "wind_speed": 3.6 + } } }, "gateway": { "cooling_present": true, "gateway_id": "fb49af122f6e4b0f91267e1cf7666d6f", "heater_id": "573c152e7d4f4720878222bd75638f5b", - "item_count": 63, + "item_count": 68, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_elga_no_cooling/all_data.json b/fixtures/anna_elga_no_cooling/all_data.json index 2fc1f56a0..d7d572e1b 100644 --- a/fixtures/anna_elga_no_cooling/all_data.json +++ b/fixtures/anna_elga_no_cooling/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 20.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 20.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -95,7 +100,7 @@ "cooling_present": false, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 63, + "item_count": 68, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_heatpump_cooling/all_data.json b/fixtures/anna_heatpump_cooling/all_data.json index b7d0c0c84..6fb0f003d 100644 --- a/fixtures/anna_heatpump_cooling/all_data.json +++ b/fixtures/anna_heatpump_cooling/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 22.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 35, + "outdoor_temperature": 22.0, + "solar_irradiance": 207.2, + "weather_description": "overcast", + "wind_bearing": 0.0, + "wind_speed": 2.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -94,7 +99,7 @@ "cooling_present": true, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 64, + "item_count": 69, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json b/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json index 844cc7a59..382c5aa96 100644 --- a/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json +++ b/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 22.0 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 35, + "outdoor_temperature": 22.0, + "solar_irradiance": 207.2, + "weather_description": "overcast", + "wind_bearing": 0.0, + "wind_speed": 2.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -94,7 +99,7 @@ "cooling_present": true, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 64, + "item_count": 69, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_heatpump_heating/all_data.json b/fixtures/anna_heatpump_heating/all_data.json index 3a54c3fb9..1334dc181 100644 --- a/fixtures/anna_heatpump_heating/all_data.json +++ b/fixtures/anna_heatpump_heating/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 20.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 20.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -99,7 +104,7 @@ "cooling_present": true, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 67, + "item_count": 72, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_loria_cooling_active/all_data.json b/fixtures/anna_loria_cooling_active/all_data.json index 0f661f859..5699c0fc1 100644 --- a/fixtures/anna_loria_cooling_active/all_data.json +++ b/fixtures/anna_loria_cooling_active/all_data.json @@ -46,10 +46,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 15.5 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 65, + "outdoor_temperature": 15.5, + "solar_irradiance": 84.7, + "weather_description": "overcast", + "wind_bearing": 289.0, + "wind_speed": 2.2 + } }, "bfb5ee0a88e14e5f97bfa725a760cc49": { "available": true, @@ -98,7 +103,7 @@ "cooling_present": true, "gateway_id": "9ff0569b4984459fb243af64c0901894", "heater_id": "bfb5ee0a88e14e5f97bfa725a760cc49", - "item_count": 66, + "item_count": 71, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_loria_driessens/all_data.json b/fixtures/anna_loria_driessens/all_data.json index 6f5141e9b..8f1243d8f 100644 --- a/fixtures/anna_loria_driessens/all_data.json +++ b/fixtures/anna_loria_driessens/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 6.81 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 88, + "outdoor_temperature": 6.81, + "solar_irradiance": 97.6, + "weather_description": "clouded", + "wind_bearing": 230.0, + "wind_speed": 4.12 + } }, "9fb768d699e44c7fb5cc50309dc4e7d4": { "active_preset": "home", @@ -104,7 +109,7 @@ "cooling_present": true, "gateway_id": "5c118b1842e943c0a5b6ef88a60bb17a", "heater_id": "a449cbc334ae4a5bb7f89064984b2906", - "item_count": 66, + "item_count": 71, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_loria_heating_idle/all_data.json b/fixtures/anna_loria_heating_idle/all_data.json index c486f43f2..b114c1a70 100644 --- a/fixtures/anna_loria_heating_idle/all_data.json +++ b/fixtures/anna_loria_heating_idle/all_data.json @@ -46,10 +46,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 15.5 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 65, + "outdoor_temperature": 15.5, + "solar_irradiance": 84.7, + "weather_description": "overcast", + "wind_bearing": 289.0, + "wind_speed": 2.2 + } }, "bfb5ee0a88e14e5f97bfa725a760cc49": { "available": true, @@ -98,7 +103,7 @@ "cooling_present": true, "gateway_id": "9ff0569b4984459fb243af64c0901894", "heater_id": "bfb5ee0a88e14e5f97bfa725a760cc49", - "item_count": 66, + "item_count": 71, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_v4/all_data.json b/fixtures/anna_v4/all_data.json index c2a07516b..f3381a03f 100644 --- a/fixtures/anna_v4/all_data.json +++ b/fixtures/anna_v4/all_data.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, @@ -90,7 +95,7 @@ "cooling_present": false, "gateway_id": "0466eae8520144c78afb29628384edeb", "heater_id": "cd0e6156b1f04d5f952349ffbe397481", - "item_count": 58, + "item_count": 63, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_v4_dhw/all_data.json b/fixtures/anna_v4_dhw/all_data.json index 6e1bd3944..a0da111de 100644 --- a/fixtures/anna_v4_dhw/all_data.json +++ b/fixtures/anna_v4_dhw/all_data.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, @@ -90,7 +95,7 @@ "cooling_present": false, "gateway_id": "0466eae8520144c78afb29628384edeb", "heater_id": "cd0e6156b1f04d5f952349ffbe397481", - "item_count": 58, + "item_count": 63, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_v4_no_tag/all_data.json b/fixtures/anna_v4_no_tag/all_data.json index 086c7d094..90f4901c6 100644 --- a/fixtures/anna_v4_no_tag/all_data.json +++ b/fixtures/anna_v4_no_tag/all_data.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 7.44 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 81, + "outdoor_temperature": 7.44, + "solar_irradiance": 449.4, + "weather_description": "clear", + "wind_bearing": 240.0, + "wind_speed": 3.6 + } }, "cd0e6156b1f04d5f952349ffbe397481": { "available": true, @@ -90,7 +95,7 @@ "cooling_present": false, "gateway_id": "0466eae8520144c78afb29628384edeb", "heater_id": "cd0e6156b1f04d5f952349ffbe397481", - "item_count": 58, + "item_count": 63, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/anna_without_boiler_fw441/all_data.json b/fixtures/anna_without_boiler_fw441/all_data.json index cd61c6b5b..2aa5839df 100644 --- a/fixtures/anna_without_boiler_fw441/all_data.json +++ b/fixtures/anna_without_boiler_fw441/all_data.json @@ -44,10 +44,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 8.31 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 91, + "outdoor_temperature": 8.31, + "solar_irradiance": 0.0, + "weather_description": "rain", + "wind_bearing": 208.0, + "wind_speed": 6.77 + } }, "c46b4794d28149699eacf053deedd003": { "binary_sensors": { @@ -63,7 +68,7 @@ "cooling_present": false, "gateway_id": "a270735e4ccd45239424badc0578a2b1", "heater_id": "c46b4794d28149699eacf053deedd003", - "item_count": 39, + "item_count": 44, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/m_adam_cooling/all_data.json b/fixtures/m_adam_cooling/all_data.json index af6d4b833..22d2ddf16 100644 --- a/fixtures/m_adam_cooling/all_data.json +++ b/fixtures/m_adam_cooling/all_data.json @@ -89,10 +89,15 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", - "sensors": { - "outdoor_temperature": 29.65 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": 29.65, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { diff --git a/fixtures/m_adam_heating/all_data.json b/fixtures/m_adam_heating/all_data.json index bb24faeeb..766618ef3 100644 --- a/fixtures/m_adam_heating/all_data.json +++ b/fixtures/m_adam_heating/all_data.json @@ -88,10 +88,15 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": -1.25 - }, "vendor": "Plugwise", + "weather": { + "humidity": 90, + "outdoor_temperature": -1.25, + "solar_irradiance": 3.0, + "weather_description": "rain", + "wind_bearing": 291.0, + "wind_speed": 6.26 + }, "zigbee_mac_address": "000D6F000D5A168D" }, "e2f4322d57924fa090fbbc48b3a140dc": { diff --git a/fixtures/m_adam_jip/all_data.json b/fixtures/m_adam_jip/all_data.json index 1a3ef66c1..5bad8282f 100644 --- a/fixtures/m_adam_jip/all_data.json +++ b/fixtures/m_adam_jip/all_data.json @@ -228,10 +228,15 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 24.9 - }, "vendor": "Plugwise", + "weather": { + "humidity": 68, + "outdoor_temperature": 24.9, + "solar_irradiance": 449.2, + "weather_description": "overcast", + "wind_bearing": 216.0, + "wind_speed": 2.68 + }, "zigbee_mac_address": "ABCD012345670101" }, "d27aede973b54be484f6842d1b2802ad": { @@ -372,7 +377,7 @@ "cooling_present": false, "gateway_id": "b5c2386c6f6342669e50fe49dd05b188", "heater_id": "e4684553153b44afbef2200885f379dc", - "item_count": 244, + "item_count": 249, "notifications": {}, "reboot": true, "smile_name": "Adam" diff --git a/fixtures/m_adam_multiple_devices_per_zone/all_data.json b/fixtures/m_adam_multiple_devices_per_zone/all_data.json index 8da184a7a..ceec94c34 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/all_data.json @@ -571,10 +571,15 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", - "sensors": { - "outdoor_temperature": 7.81 - }, "vendor": "Plugwise", + "weather": { + "humidity": 75, + "outdoor_temperature": 7.81, + "solar_irradiance": 157.5, + "weather_description": "cloudy", + "wind_bearing": 40.0, + "wind_speed": 8.2 + }, "zigbee_mac_address": "ABCD012345670101" } }, @@ -582,7 +587,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 369, + "item_count": 374, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." diff --git a/fixtures/m_anna_heatpump_cooling/all_data.json b/fixtures/m_anna_heatpump_cooling/all_data.json index eaa42facf..3eb9a4ffb 100644 --- a/fixtures/m_anna_heatpump_cooling/all_data.json +++ b/fixtures/m_anna_heatpump_cooling/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 28.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 28.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -99,7 +104,7 @@ "cooling_present": true, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 67, + "item_count": 72, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" diff --git a/fixtures/m_anna_heatpump_idle/all_data.json b/fixtures/m_anna_heatpump_idle/all_data.json index 52645b0f3..da9cab163 100644 --- a/fixtures/m_anna_heatpump_idle/all_data.json +++ b/fixtures/m_anna_heatpump_idle/all_data.json @@ -12,10 +12,15 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", - "sensors": { - "outdoor_temperature": 28.2 - }, - "vendor": "Plugwise" + "vendor": "Plugwise", + "weather": { + "humidity": 42, + "outdoor_temperature": 28.2, + "solar_irradiance": 653.6, + "weather_description": "clear", + "wind_bearing": 50.0, + "wind_speed": 4.1 + } }, "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, @@ -99,7 +104,7 @@ "cooling_present": true, "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "item_count": 67, + "item_count": 72, "notifications": {}, "reboot": true, "smile_name": "Smile Anna" From f52bbb5fd5a0269c2ccc9b5a95ac4ff86c5eab79 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 16:49:30 +0100 Subject: [PATCH 27/37] Improve --- plugwise/helper.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 739e1ae6a..ce3a93773 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -811,17 +811,11 @@ def _object_value( match measurement: case "humidity": return int(float(value)) - case "outdoor_temperature": + case "outdoor_temperature" | "solar_irradiance": return format_measure( value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) ) - case "solar_irradiance": - return format_measure( - value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) - ) - case "weather_description": - return value - case "wind_vector": + case _: return value return None From 1d4ffb8a0863cc195952b1c42801ccc212b96738 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 16:53:44 +0100 Subject: [PATCH 28/37] Revert missed attrs_uom change --- plugwise/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugwise/util.py b/plugwise/util.py index ec23243da..c8677b482 100644 --- a/plugwise/util.py +++ b/plugwise/util.py @@ -195,10 +195,10 @@ def power_data_local_format( # Special formatting of P1_MEASUREMENT POWER_WATT values, do not move to util-format_measure() function! if all(item in key_string for item in ("electricity", "cumulative")): return format_measure(val, ENERGY_KILO_WATT_HOUR) - if (attr_uom := getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: + if (attrs_uom := getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) == POWER_WATT: return int(round(float(val))) - return format_measure(val, attr_uom) + return format_measure(val, attrs_uom) def remove_empty_platform_dicts(data: GwEntityData) -> None: From 5b14d73f3273812c3daaaca725c5cf8804c47b41 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Fri, 20 Dec 2024 16:54:21 +0100 Subject: [PATCH 29/37] Back to normal test-output --- scripts/tests_and_coverage.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/tests_and_coverage.sh b/scripts/tests_and_coverage.sh index 462744720..73be7e825 100755 --- a/scripts/tests_and_coverage.sh +++ b/scripts/tests_and_coverage.sh @@ -43,8 +43,7 @@ set +u if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "test_and_coverage" ] ; then # Python tests (rerun with debug if failures) - # PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing || - PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/ + PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing || PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/ handle_command_error "python code testing" fi From 6488ec9a957b772a81d31ce73463f9f3e5bdbf70 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 09:42:54 +0100 Subject: [PATCH 30/37] Optimize --- plugwise/helper.py | 77 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index ce3a93773..aabe27b2c 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -771,54 +771,55 @@ def _get_gateway_mode( self._count += 1 def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: - """Adam & Anna: the Gateway weather-data is present in DOMAIN_OBJECTS and LOCATIONS. + """Adam & Anna: the Gateway weather-data is present under the Home location. Available under the Home location. """ + if not (self._is_thermostat and entity_id == self.gateway_id): + return + measurements = DEVICE_MEASUREMENTS - if self._is_thermostat and entity_id == self.gateway_id: - for measurement, attrs in measurements.items(): - value = self._object_value(self._home_location, measurement, attrs) - if value is not None: - if measurement == "wind_vector": - value_list: list[str] = str(value).split(",") - data["weather"]["wind_speed"] = format_measure( - value_list[0].strip("("), - getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), - ) - data["weather"]["wind_bearing"] = format_measure( - value_list[1].strip(")"), - getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), - ) - self._count += 2 - else: - key = cast(WeatherType, measurement) - data["weather"][key] = value - self._count += 1 - - def _object_value( - self, obj_id: str, measurement: str, attrs: DATA | UOM + for measurement, attrs in measurements.items(): + if ( + value := self._loc_value(self._home_location, measurement, attrs) + ) is None: + continue + + if measurement == "wind_vector": + value_list: list[str] = str(value).split(",") + data["weather"]["wind_speed"] = format_measure( + value_list[0].strip("("), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), + ) + data["weather"]["wind_bearing"] = format_measure( + value_list[1].strip(")"), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), + ) + self._count += 2 + else: + key = cast(WeatherType, measurement) + data["weather"][key] = value + self._count += 1 + + def _loc_value( + self, loc_id: str, measurement: str, attrs: DATA | UOM ) -> float | int | str | None: """Helper-function for smile.py: _get_entity_data(). Obtain the value/state for the given object from a location in DOMAIN_OBJECTS """ - value: str = "" - search = self._domain_objects - locator = f'./location[@id="{obj_id}"]/logs/point_log[type="{measurement}"]/period/measurement' - if (found := search.find(locator)) is not None: - value = found.text - match measurement: - case "humidity": - return int(float(value)) - case "outdoor_temperature" | "solar_irradiance": - return format_measure( - value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT) - ) - case _: - return value + locator = f"./location[@id='{loc_id}']/logs/point_log[type='{measurement}']/period/measurement" + if (found := self._domain_objects.find(locator)) is None: + return None - return None + value: str = found.text + match measurement: + case "humidity": + return int(float(value)) + case "outdoor_temperature" | "solar_irradiance": + return format_measure(value, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)) + case _: + return value def _process_c_heating_state(self, data: GwEntityData) -> None: """Helper-function for _get_measurement_data(). From 898ccf8e1e0c7865beb08076c53a44c37982731c Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 10:44:00 +0100 Subject: [PATCH 31/37] Add comment --- plugwise/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugwise/util.py b/plugwise/util.py index c8677b482..c5e0ff18a 100644 --- a/plugwise/util.py +++ b/plugwise/util.py @@ -157,6 +157,7 @@ def format_measure(measure: str, unit: str) -> float | int: try: result = int(measure) if unit == TEMP_CELSIUS: + # Return for instance 20 (degrees) as 20.0 result = float(measure) except ValueError: float_measure = float(measure) From aa74d4f4a0f8c45753ca756150703b0b78a697b0 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 10:44:43 +0100 Subject: [PATCH 32/37] Bump to v1.7.0a0 test-version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b573a777e..522f26631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.6.4" +version = "1.7.0a0" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From 5d0022cc30fb72fb42163793e244030764018b35 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 11:18:38 +0100 Subject: [PATCH 33/37] Make solar_irradiance a sensor --- plugwise/helper.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index aabe27b2c..92b343fad 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -785,21 +785,27 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: ) is None: continue - if measurement == "wind_vector": - value_list: list[str] = str(value).split(",") - data["weather"]["wind_speed"] = format_measure( - value_list[0].strip("("), - getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), - ) - data["weather"]["wind_bearing"] = format_measure( - value_list[1].strip(")"), - getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), - ) - self._count += 2 - else: - key = cast(WeatherType, measurement) - data["weather"][key] = value - self._count += 1 + match measurement: + case "solar_irradiance": + # Not available in HA weather platform -> sensor + key = cast(SensorType, measurement) + data["sensors"][key] = value + self._count += 1 + case "wind_vector": + value_list: list[str] = str(value).split(",") + data["weather"]["wind_speed"] = format_measure( + value_list[0].strip("("), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), + ) + data["weather"]["wind_bearing"] = format_measure( + value_list[1].strip(")"), + getattr(attrs, ATTR_UNIT_OF_MEASUREMENT), + ) + self._count += 2 + case _: + key = cast(WeatherType, measurement) + data["weather"][key] = value + self._count += 1 def _loc_value( self, loc_id: str, measurement: str, attrs: DATA | UOM From ec9bbc243b8d79f8244aa41451a20237f70f9823 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 11:31:34 +0100 Subject: [PATCH 34/37] Update testdata jsons --- tests/data/adam/adam_heatpump_cooling.json | 4 +++- tests/data/adam/adam_jip.json | 4 +++- tests/data/adam/adam_multiple_devices_per_zone.json | 4 +++- tests/data/adam/adam_onoff_cooling_fake_firmware.json | 4 +++- tests/data/adam/adam_plus_anna.json | 4 +++- tests/data/adam/adam_plus_anna_new.json | 4 +++- tests/data/adam/adam_plus_anna_new_regulation_off.json | 4 +++- tests/data/adam/adam_zone_per_device.json | 4 +++- tests/data/anna/anna_elga_2.json | 4 +++- tests/data/anna/anna_elga_2_cooling.json | 4 +++- tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json | 4 +++- tests/data/anna/anna_elga_2_schedule_off.json | 4 +++- tests/data/anna/anna_elga_no_cooling.json | 4 +++- tests/data/anna/anna_heatpump_cooling.json | 4 +++- tests/data/anna/anna_heatpump_cooling_fake_firmware.json | 4 +++- tests/data/anna/anna_heatpump_heating.json | 4 +++- tests/data/anna/anna_loria_cooling_active.json | 4 +++- tests/data/anna/anna_loria_driessens.json | 4 +++- tests/data/anna/anna_loria_heating_idle.json | 4 +++- tests/data/anna/anna_v4.json | 4 +++- tests/data/anna/anna_v4_UPDATED_DATA.json | 4 +++- tests/data/anna/anna_v4_dhw.json | 4 +++- tests/data/anna/anna_v4_no_tag.json | 4 +++- tests/data/anna/anna_without_boiler_fw441.json | 4 +++- 24 files changed, 72 insertions(+), 24 deletions(-) diff --git a/tests/data/adam/adam_heatpump_cooling.json b/tests/data/adam/adam_heatpump_cooling.json index 27b3f9a0f..1d183a2bd 100644 --- a/tests/data/adam/adam_heatpump_cooling.json +++ b/tests/data/adam/adam_heatpump_cooling.json @@ -305,11 +305,13 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", + "sensors": { + "solar_irradiance": 208.2 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 13.4, - "solar_irradiance": 208.2, "weather_description": "clouded", "wind_bearing": 228.0, "wind_speed": 1.79 diff --git a/tests/data/adam/adam_jip.json b/tests/data/adam/adam_jip.json index 4b812a7d5..887bec69c 100644 --- a/tests/data/adam/adam_jip.json +++ b/tests/data/adam/adam_jip.json @@ -225,11 +225,13 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 449.2 + }, "vendor": "Plugwise", "weather": { "humidity": 68, "outdoor_temperature": 24.9, - "solar_irradiance": 449.2, "weather_description": "overcast", "wind_bearing": 216.0, "wind_speed": 2.68 diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index 4522ae314..e4f416f24 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -580,11 +580,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 157.5 + }, "vendor": "Plugwise", "weather": { "humidity": 75, "outdoor_temperature": 7.81, - "solar_irradiance": 157.5, "weather_description": "cloudy", "wind_bearing": 40.0, "wind_speed": 8.2 diff --git a/tests/data/adam/adam_onoff_cooling_fake_firmware.json b/tests/data/adam/adam_onoff_cooling_fake_firmware.json index 4941b71c9..7e4e8c9ff 100644 --- a/tests/data/adam/adam_onoff_cooling_fake_firmware.json +++ b/tests/data/adam/adam_onoff_cooling_fake_firmware.json @@ -59,11 +59,13 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", + "sensors": { + "solar_irradiance": 208.2 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 13.4, - "solar_irradiance": 208.2, "weather_description": "clouded", "wind_bearing": 228.0, "wind_speed": 1.79 diff --git a/tests/data/adam/adam_plus_anna.json b/tests/data/adam/adam_plus_anna.json index 2ff687b50..5c50dba41 100644 --- a/tests/data/adam/adam_plus_anna.json +++ b/tests/data/adam/adam_plus_anna.json @@ -86,11 +86,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 53.8 + }, "vendor": "Plugwise", "weather": { "humidity": 58, "outdoor_temperature": 11.9, - "solar_irradiance": 53.8, "weather_description": "overcast", "wind_bearing": 220.0, "wind_speed": 2.6 diff --git a/tests/data/adam/adam_plus_anna_new.json b/tests/data/adam/adam_plus_anna_new.json index b328b61c4..6abf114f2 100644 --- a/tests/data/adam/adam_plus_anna_new.json +++ b/tests/data/adam/adam_plus_anna_new.json @@ -172,11 +172,13 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": 9.19, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/tests/data/adam/adam_plus_anna_new_regulation_off.json b/tests/data/adam/adam_plus_anna_new_regulation_off.json index 93ce93774..78a88b510 100644 --- a/tests/data/adam/adam_plus_anna_new_regulation_off.json +++ b/tests/data/adam/adam_plus_anna_new_regulation_off.json @@ -172,11 +172,13 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "off", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": 9.19, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index da52897ab..543c79909 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -577,11 +577,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 86.2 + }, "vendor": "Plugwise", "weather": { "humidity": 70, "outdoor_temperature": 7.69, - "solar_irradiance": 86.2, "weather_description": "cloudy", "wind_bearing": 40.0, "wind_speed": 7.2 diff --git a/tests/data/anna/anna_elga_2.json b/tests/data/anna/anna_elga_2.json index b35a09905..4799b6f9f 100644 --- a/tests/data/anna/anna_elga_2.json +++ b/tests/data/anna/anna_elga_2.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 13.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_elga_2_cooling.json b/tests/data/anna/anna_elga_2_cooling.json index d284e00b5..91bdbd44b 100644 --- a/tests/data/anna/anna_elga_2_cooling.json +++ b/tests/data/anna/anna_elga_2_cooling.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 31.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json b/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json index 777985f67..0ab0a275d 100644 --- a/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json +++ b/tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 3.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_elga_2_schedule_off.json b/tests/data/anna/anna_elga_2_schedule_off.json index a75ce209f..812d1c184 100644 --- a/tests/data/anna/anna_elga_2_schedule_off.json +++ b/tests/data/anna/anna_elga_2_schedule_off.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 13.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_elga_no_cooling.json b/tests/data/anna/anna_elga_no_cooling.json index 850f53cc8..65df7acfa 100644 --- a/tests/data/anna/anna_elga_no_cooling.json +++ b/tests/data/anna/anna_elga_no_cooling.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 20.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 diff --git a/tests/data/anna/anna_heatpump_cooling.json b/tests/data/anna/anna_heatpump_cooling.json index 9bf41d432..e7b79339f 100644 --- a/tests/data/anna/anna_heatpump_cooling.json +++ b/tests/data/anna/anna_heatpump_cooling.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 207.2 + }, "vendor": "Plugwise", "weather": { "humidity": 35, "outdoor_temperature": 22.0, - "solar_irradiance": 207.2, "weather_description": "overcast", "wind_bearing": 0.0, "wind_speed": 2.1 diff --git a/tests/data/anna/anna_heatpump_cooling_fake_firmware.json b/tests/data/anna/anna_heatpump_cooling_fake_firmware.json index 7d4cd6597..3e0a9998d 100644 --- a/tests/data/anna/anna_heatpump_cooling_fake_firmware.json +++ b/tests/data/anna/anna_heatpump_cooling_fake_firmware.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 207.2 + }, "vendor": "Plugwise", "weather": { "humidity": 35, "outdoor_temperature": 22.0, - "solar_irradiance": 207.2, "weather_description": "overcast", "wind_bearing": 0.0, "wind_speed": 2.1 diff --git a/tests/data/anna/anna_heatpump_heating.json b/tests/data/anna/anna_heatpump_heating.json index ad66932e2..844d04351 100644 --- a/tests/data/anna/anna_heatpump_heating.json +++ b/tests/data/anna/anna_heatpump_heating.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 20.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 diff --git a/tests/data/anna/anna_loria_cooling_active.json b/tests/data/anna/anna_loria_cooling_active.json index 2b853720f..296b5e531 100644 --- a/tests/data/anna/anna_loria_cooling_active.json +++ b/tests/data/anna/anna_loria_cooling_active.json @@ -46,11 +46,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 84.7 + }, "vendor": "Plugwise", "weather": { "humidity": 65, "outdoor_temperature": 15.5, - "solar_irradiance": 84.7, "weather_description": "overcast", "wind_bearing": 289.0, "wind_speed": 2.2 diff --git a/tests/data/anna/anna_loria_driessens.json b/tests/data/anna/anna_loria_driessens.json index 6dc1ad1a8..819ad1155 100644 --- a/tests/data/anna/anna_loria_driessens.json +++ b/tests/data/anna/anna_loria_driessens.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 97.6 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 6.81, - "solar_irradiance": 97.6, "weather_description": "clouded", "wind_bearing": 230.0, "wind_speed": 4.12 diff --git a/tests/data/anna/anna_loria_heating_idle.json b/tests/data/anna/anna_loria_heating_idle.json index 9d099d3fe..a0342331d 100644 --- a/tests/data/anna/anna_loria_heating_idle.json +++ b/tests/data/anna/anna_loria_heating_idle.json @@ -46,11 +46,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 84.7 + }, "vendor": "Plugwise", "weather": { "humidity": 65, "outdoor_temperature": 15.5, - "solar_irradiance": 84.7, "weather_description": "overcast", "wind_bearing": 289.0, "wind_speed": 2.2 diff --git a/tests/data/anna/anna_v4.json b/tests/data/anna/anna_v4.json index e257ff14c..04393ebf0 100644 --- a/tests/data/anna/anna_v4.json +++ b/tests/data/anna/anna_v4.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_v4_UPDATED_DATA.json b/tests/data/anna/anna_v4_UPDATED_DATA.json index 697532205..42ef62e55 100644 --- a/tests/data/anna/anna_v4_UPDATED_DATA.json +++ b/tests/data/anna/anna_v4_UPDATED_DATA.json @@ -47,10 +47,12 @@ } }, "0466eae8520144c78afb29628384edeb": { + "sensors": { + "solar_irradiance": 449.4 + }, "weather": { "humidity": 81, "outdoor_temperature": 6.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_v4_dhw.json b/tests/data/anna/anna_v4_dhw.json index 33ab7f7a3..168f9f3ef 100644 --- a/tests/data/anna/anna_v4_dhw.json +++ b/tests/data/anna/anna_v4_dhw.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_v4_no_tag.json b/tests/data/anna/anna_v4_no_tag.json index 7e0d8aeb8..1f82571a6 100644 --- a/tests/data/anna/anna_v4_no_tag.json +++ b/tests/data/anna/anna_v4_no_tag.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/tests/data/anna/anna_without_boiler_fw441.json b/tests/data/anna/anna_without_boiler_fw441.json index fcd93aab5..da6bdb2d7 100644 --- a/tests/data/anna/anna_without_boiler_fw441.json +++ b/tests/data/anna/anna_without_boiler_fw441.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 91, "outdoor_temperature": 8.31, - "solar_irradiance": 0.0, "weather_description": "rain", "wind_bearing": 208.0, "wind_speed": 6.77 From d90bc592a3327d5ea138976084262e980738f52a Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 11:34:15 +0100 Subject: [PATCH 35/37] Correct typing --- plugwise/constants.py | 4 ++-- plugwise/helper.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 044b48dc9..af62fc2f8 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -340,6 +340,7 @@ "setpoint", "setpoint_high", "setpoint_low", + "solar_irradiance", "temperature_difference", "valve_position", "voltage_phase_one", @@ -394,7 +395,6 @@ WeatherType = Literal[ "humidity", "outdoor_temperature", - "solar_irradiance", "weather_description", "wind_bearing", "wind_speed", @@ -493,6 +493,7 @@ class SmileSensors(TypedDict, total=False): return_temperature: float setpoint: float setpoint_high: float + solar_irradiance: float setpoint_low: float temperature_difference: float valve_position: int @@ -526,7 +527,6 @@ class WeatherData(TypedDict, total=False): humidity: int outdoor_temperature: float - solar_irradiance: float weather_description: str wind_bearing: float wind_speed: float diff --git a/plugwise/helper.py b/plugwise/helper.py index 92b343fad..ef10dafd6 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -788,8 +788,8 @@ def _get_gateway_measurements(self, entity_id: str, data: GwEntityData) -> None: match measurement: case "solar_irradiance": # Not available in HA weather platform -> sensor - key = cast(SensorType, measurement) - data["sensors"][key] = value + sensor = cast(SensorType, measurement) + data["sensors"][sensor] = float(value) self._count += 1 case "wind_vector": value_list: list[str] = str(value).split(",") From 32922e8c6dc4153d258cd0df25ab00be8cb27a7d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 11:45:42 +0100 Subject: [PATCH 36/37] Save updated fixtures --- fixtures/adam_heatpump_cooling/all_data.json | 4 +++- fixtures/adam_jip/all_data.json | 4 +++- fixtures/adam_multiple_devices_per_zone/all_data.json | 4 +++- fixtures/adam_onoff_cooling_fake_firmware/all_data.json | 4 +++- fixtures/adam_plus_anna/all_data.json | 4 +++- fixtures/adam_plus_anna_new/all_data.json | 4 +++- fixtures/adam_plus_anna_new_regulation_off/all_data.json | 4 +++- fixtures/adam_zone_per_device/all_data.json | 4 +++- fixtures/anna_elga_2/all_data.json | 4 +++- fixtures/anna_elga_2_cooling/all_data.json | 4 +++- fixtures/anna_elga_2_schedule_off/all_data.json | 4 +++- fixtures/anna_elga_no_cooling/all_data.json | 4 +++- fixtures/anna_heatpump_cooling/all_data.json | 4 +++- fixtures/anna_heatpump_cooling_fake_firmware/all_data.json | 4 +++- fixtures/anna_heatpump_heating/all_data.json | 4 +++- fixtures/anna_loria_cooling_active/all_data.json | 4 +++- fixtures/anna_loria_driessens/all_data.json | 4 +++- fixtures/anna_loria_heating_idle/all_data.json | 4 +++- fixtures/anna_v4/all_data.json | 4 +++- fixtures/anna_v4_dhw/all_data.json | 4 +++- fixtures/anna_v4_no_tag/all_data.json | 4 +++- fixtures/anna_without_boiler_fw441/all_data.json | 4 +++- fixtures/m_adam_cooling/all_data.json | 4 +++- fixtures/m_adam_heating/all_data.json | 4 +++- fixtures/m_adam_jip/all_data.json | 4 +++- fixtures/m_adam_multiple_devices_per_zone/all_data.json | 4 +++- fixtures/m_anna_heatpump_cooling/all_data.json | 4 +++- fixtures/m_anna_heatpump_idle/all_data.json | 4 +++- 28 files changed, 84 insertions(+), 28 deletions(-) diff --git a/fixtures/adam_heatpump_cooling/all_data.json b/fixtures/adam_heatpump_cooling/all_data.json index e332a2a66..177015552 100644 --- a/fixtures/adam_heatpump_cooling/all_data.json +++ b/fixtures/adam_heatpump_cooling/all_data.json @@ -305,11 +305,13 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", + "sensors": { + "solar_irradiance": 208.2 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 13.4, - "solar_irradiance": 208.2, "weather_description": "clouded", "wind_bearing": 228.0, "wind_speed": 1.79 diff --git a/fixtures/adam_jip/all_data.json b/fixtures/adam_jip/all_data.json index c77110905..f07addfdb 100644 --- a/fixtures/adam_jip/all_data.json +++ b/fixtures/adam_jip/all_data.json @@ -229,11 +229,13 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 449.2 + }, "vendor": "Plugwise", "weather": { "humidity": 68, "outdoor_temperature": 24.9, - "solar_irradiance": 449.2, "weather_description": "overcast", "wind_bearing": 216.0, "wind_speed": 2.68 diff --git a/fixtures/adam_multiple_devices_per_zone/all_data.json b/fixtures/adam_multiple_devices_per_zone/all_data.json index e44a04fa2..9b09a6989 100644 --- a/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -580,11 +580,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 157.5 + }, "vendor": "Plugwise", "weather": { "humidity": 75, "outdoor_temperature": 7.81, - "solar_irradiance": 157.5, "weather_description": "cloudy", "wind_bearing": 40.0, "wind_speed": 8.2 diff --git a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json index 95b534083..b8cdc3d70 100644 --- a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json +++ b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json @@ -59,11 +59,13 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", + "sensors": { + "solar_irradiance": 208.2 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 13.4, - "solar_irradiance": 208.2, "weather_description": "clouded", "wind_bearing": 228.0, "wind_speed": 1.79 diff --git a/fixtures/adam_plus_anna/all_data.json b/fixtures/adam_plus_anna/all_data.json index 2283dde6c..5404aaab8 100644 --- a/fixtures/adam_plus_anna/all_data.json +++ b/fixtures/adam_plus_anna/all_data.json @@ -86,11 +86,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 53.8 + }, "vendor": "Plugwise", "weather": { "humidity": 58, "outdoor_temperature": 11.9, - "solar_irradiance": 53.8, "weather_description": "overcast", "wind_bearing": 220.0, "wind_speed": 2.6 diff --git a/fixtures/adam_plus_anna_new/all_data.json b/fixtures/adam_plus_anna_new/all_data.json index 8c151c996..c6cf4f5a3 100644 --- a/fixtures/adam_plus_anna_new/all_data.json +++ b/fixtures/adam_plus_anna_new/all_data.json @@ -172,11 +172,13 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": 9.19, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/fixtures/adam_plus_anna_new_regulation_off/all_data.json b/fixtures/adam_plus_anna_new_regulation_off/all_data.json index 23a4888ef..456333816 100644 --- a/fixtures/adam_plus_anna_new_regulation_off/all_data.json +++ b/fixtures/adam_plus_anna_new_regulation_off/all_data.json @@ -172,11 +172,13 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "off", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": 9.19, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/fixtures/adam_zone_per_device/all_data.json b/fixtures/adam_zone_per_device/all_data.json index d751751cd..7b70d312a 100644 --- a/fixtures/adam_zone_per_device/all_data.json +++ b/fixtures/adam_zone_per_device/all_data.json @@ -577,11 +577,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 86.2 + }, "vendor": "Plugwise", "weather": { "humidity": 70, "outdoor_temperature": 7.69, - "solar_irradiance": 86.2, "weather_description": "cloudy", "wind_bearing": 40.0, "wind_speed": 7.2 diff --git a/fixtures/anna_elga_2/all_data.json b/fixtures/anna_elga_2/all_data.json index b8cf08286..9415bc082 100644 --- a/fixtures/anna_elga_2/all_data.json +++ b/fixtures/anna_elga_2/all_data.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 13.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/fixtures/anna_elga_2_cooling/all_data.json b/fixtures/anna_elga_2_cooling/all_data.json index aaf39f908..bd050d100 100644 --- a/fixtures/anna_elga_2_cooling/all_data.json +++ b/fixtures/anna_elga_2_cooling/all_data.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 31.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/fixtures/anna_elga_2_schedule_off/all_data.json b/fixtures/anna_elga_2_schedule_off/all_data.json index 5f5d350df..2c5a16809 100644 --- a/fixtures/anna_elga_2_schedule_off/all_data.json +++ b/fixtures/anna_elga_2_schedule_off/all_data.json @@ -83,11 +83,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 13.0, - "solar_irradiance": 0.0, "weather_description": "cloudy", "wind_bearing": 120.0, "wind_speed": 3.6 diff --git a/fixtures/anna_elga_no_cooling/all_data.json b/fixtures/anna_elga_no_cooling/all_data.json index d7d572e1b..fe1d0cf4f 100644 --- a/fixtures/anna_elga_no_cooling/all_data.json +++ b/fixtures/anna_elga_no_cooling/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 20.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 diff --git a/fixtures/anna_heatpump_cooling/all_data.json b/fixtures/anna_heatpump_cooling/all_data.json index 6fb0f003d..6beef9c0c 100644 --- a/fixtures/anna_heatpump_cooling/all_data.json +++ b/fixtures/anna_heatpump_cooling/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 207.2 + }, "vendor": "Plugwise", "weather": { "humidity": 35, "outdoor_temperature": 22.0, - "solar_irradiance": 207.2, "weather_description": "overcast", "wind_bearing": 0.0, "wind_speed": 2.1 diff --git a/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json b/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json index 382c5aa96..fd3ee037e 100644 --- a/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json +++ b/fixtures/anna_heatpump_cooling_fake_firmware/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 207.2 + }, "vendor": "Plugwise", "weather": { "humidity": 35, "outdoor_temperature": 22.0, - "solar_irradiance": 207.2, "weather_description": "overcast", "wind_bearing": 0.0, "wind_speed": 2.1 diff --git a/fixtures/anna_heatpump_heating/all_data.json b/fixtures/anna_heatpump_heating/all_data.json index 1334dc181..9550d3fac 100644 --- a/fixtures/anna_heatpump_heating/all_data.json +++ b/fixtures/anna_heatpump_heating/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 20.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 diff --git a/fixtures/anna_loria_cooling_active/all_data.json b/fixtures/anna_loria_cooling_active/all_data.json index 5699c0fc1..b28542138 100644 --- a/fixtures/anna_loria_cooling_active/all_data.json +++ b/fixtures/anna_loria_cooling_active/all_data.json @@ -46,11 +46,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 84.7 + }, "vendor": "Plugwise", "weather": { "humidity": 65, "outdoor_temperature": 15.5, - "solar_irradiance": 84.7, "weather_description": "overcast", "wind_bearing": 289.0, "wind_speed": 2.2 diff --git a/fixtures/anna_loria_driessens/all_data.json b/fixtures/anna_loria_driessens/all_data.json index 8f1243d8f..46cf703a9 100644 --- a/fixtures/anna_loria_driessens/all_data.json +++ b/fixtures/anna_loria_driessens/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 97.6 + }, "vendor": "Plugwise", "weather": { "humidity": 88, "outdoor_temperature": 6.81, - "solar_irradiance": 97.6, "weather_description": "clouded", "wind_bearing": 230.0, "wind_speed": 4.12 diff --git a/fixtures/anna_loria_heating_idle/all_data.json b/fixtures/anna_loria_heating_idle/all_data.json index b114c1a70..cee4f50cf 100644 --- a/fixtures/anna_loria_heating_idle/all_data.json +++ b/fixtures/anna_loria_heating_idle/all_data.json @@ -46,11 +46,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 84.7 + }, "vendor": "Plugwise", "weather": { "humidity": 65, "outdoor_temperature": 15.5, - "solar_irradiance": 84.7, "weather_description": "overcast", "wind_bearing": 289.0, "wind_speed": 2.2 diff --git a/fixtures/anna_v4/all_data.json b/fixtures/anna_v4/all_data.json index f3381a03f..ed2759875 100644 --- a/fixtures/anna_v4/all_data.json +++ b/fixtures/anna_v4/all_data.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/fixtures/anna_v4_dhw/all_data.json b/fixtures/anna_v4_dhw/all_data.json index a0da111de..1ef6f2036 100644 --- a/fixtures/anna_v4_dhw/all_data.json +++ b/fixtures/anna_v4_dhw/all_data.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/fixtures/anna_v4_no_tag/all_data.json b/fixtures/anna_v4_no_tag/all_data.json index 90f4901c6..6009cef85 100644 --- a/fixtures/anna_v4_no_tag/all_data.json +++ b/fixtures/anna_v4_no_tag/all_data.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 449.4 + }, "vendor": "Plugwise", "weather": { "humidity": 81, "outdoor_temperature": 7.44, - "solar_irradiance": 449.4, "weather_description": "clear", "wind_bearing": 240.0, "wind_speed": 3.6 diff --git a/fixtures/anna_without_boiler_fw441/all_data.json b/fixtures/anna_without_boiler_fw441/all_data.json index 2aa5839df..a06469294 100644 --- a/fixtures/anna_without_boiler_fw441/all_data.json +++ b/fixtures/anna_without_boiler_fw441/all_data.json @@ -44,11 +44,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 0.0 + }, "vendor": "Plugwise", "weather": { "humidity": 91, "outdoor_temperature": 8.31, - "solar_irradiance": 0.0, "weather_description": "rain", "wind_bearing": 208.0, "wind_speed": 6.77 diff --git a/fixtures/m_adam_cooling/all_data.json b/fixtures/m_adam_cooling/all_data.json index 22d2ddf16..c071af190 100644 --- a/fixtures/m_adam_cooling/all_data.json +++ b/fixtures/m_adam_cooling/all_data.json @@ -89,11 +89,13 @@ ], "select_gateway_mode": "full", "select_regulation_mode": "cooling", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": 29.65, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/fixtures/m_adam_heating/all_data.json b/fixtures/m_adam_heating/all_data.json index 766618ef3..67ed4f700 100644 --- a/fixtures/m_adam_heating/all_data.json +++ b/fixtures/m_adam_heating/all_data.json @@ -88,11 +88,13 @@ "regulation_modes": ["bleeding_hot", "bleeding_cold", "off", "heating"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 3.0 + }, "vendor": "Plugwise", "weather": { "humidity": 90, "outdoor_temperature": -1.25, - "solar_irradiance": 3.0, "weather_description": "rain", "wind_bearing": 291.0, "wind_speed": 6.26 diff --git a/fixtures/m_adam_jip/all_data.json b/fixtures/m_adam_jip/all_data.json index 5bad8282f..6387917ea 100644 --- a/fixtures/m_adam_jip/all_data.json +++ b/fixtures/m_adam_jip/all_data.json @@ -228,11 +228,13 @@ "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], "select_gateway_mode": "full", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 449.2 + }, "vendor": "Plugwise", "weather": { "humidity": 68, "outdoor_temperature": 24.9, - "solar_irradiance": 449.2, "weather_description": "overcast", "wind_bearing": 216.0, "wind_speed": 2.68 diff --git a/fixtures/m_adam_multiple_devices_per_zone/all_data.json b/fixtures/m_adam_multiple_devices_per_zone/all_data.json index ceec94c34..dae850b36 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/all_data.json @@ -571,11 +571,13 @@ "model_id": "smile_open_therm", "name": "Adam", "select_regulation_mode": "heating", + "sensors": { + "solar_irradiance": 157.5 + }, "vendor": "Plugwise", "weather": { "humidity": 75, "outdoor_temperature": 7.81, - "solar_irradiance": 157.5, "weather_description": "cloudy", "wind_bearing": 40.0, "wind_speed": 8.2 diff --git a/fixtures/m_anna_heatpump_cooling/all_data.json b/fixtures/m_anna_heatpump_cooling/all_data.json index 3eb9a4ffb..d9ead0227 100644 --- a/fixtures/m_anna_heatpump_cooling/all_data.json +++ b/fixtures/m_anna_heatpump_cooling/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 28.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 diff --git a/fixtures/m_anna_heatpump_idle/all_data.json b/fixtures/m_anna_heatpump_idle/all_data.json index da9cab163..d0c222ecb 100644 --- a/fixtures/m_anna_heatpump_idle/all_data.json +++ b/fixtures/m_anna_heatpump_idle/all_data.json @@ -12,11 +12,13 @@ "model": "Gateway", "model_id": "smile_thermo", "name": "Smile Anna", + "sensors": { + "solar_irradiance": 653.6 + }, "vendor": "Plugwise", "weather": { "humidity": 42, "outdoor_temperature": 28.2, - "solar_irradiance": 653.6, "weather_description": "clear", "wind_bearing": 50.0, "wind_speed": 4.1 From 9250fafb7af4692185f0d7f2ad727080865325bf Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sat, 21 Dec 2024 11:46:10 +0100 Subject: [PATCH 37/37] Bump to a1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 522f26631..a60df5ff5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.7.0a0" +version = "1.7.0a1" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md"