diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89c7b96da..a1490ff6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ name: Test with HA-core env: - CACHE_VERSION: 1 + CACHE_VERSION: 2 DEFAULT_PYTHON: "3.11" on: @@ -44,18 +44,21 @@ jobs: ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-hacore ${{ env.CACHE_VERSION}}-${{ runner.os }} ${{ env.CACHE_VERSION}} - - name: Create HA-core Python virtual environment + - name: Test through core (full, not split) run: | - scripts/core-testing.sh core_prep - - name: Prepare HA-core Python virtual environment - run: | - scripts/core-testing.sh pip_prep - - name: Test - run: | - scripts/core-testing.sh testing - - name: Quality - run: | - scripts/core-testing.sh quality + GITHUB_ACTIONS="" scripts/core-testing.sh + # - name: Create HA-core Python virtual environment + # run: | + # scripts/core-testing.sh core_prep + # - name: Prepare HA-core Python virtual environment + # run: | + # scripts/core-testing.sh pip_prep + # - name: Test + # run: | + # scripts/core-testing.sh testing + # - name: Quality + # run: | + # scripts/core-testing.sh quality shellcheck: name: Shellcheck diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f2b9f82..70038a265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## Versions from 0.40 and up -### Ongoing / Unreleased +### 0.40.2 - CI improvements +- Implement strict typing, also via [plugwise v0.31.3](https://github.com/plugwise/python-plugwise/releases/tag/v0.31.3) +- Dynamic generated fixtures re-introduced ### 0.40.1 diff --git a/custom_components/plugwise/__init__.py b/custom_components/plugwise/__init__.py index 433d5aac8..6d8754a48 100644 --- a/custom_components/plugwise/__init__.py +++ b/custom_components/plugwise/__init__.py @@ -8,7 +8,7 @@ from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform -from homeassistant.core import HomeAssistant, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import device_registry as dr, entity_registry as er from plugwise.exceptions import PlugwiseError @@ -60,15 +60,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) async def delete_notification( - self, - ): # pragma: no cover # pw-beta: HA service - delete_notification + call: ServiceCall, + ) -> None: # pragma: no cover # pw-beta: HA service - delete_notification """Service: delete the Plugwise Notification.""" LOGGER.debug( - "Service delete PW Notification called for %s", coordinator.api.smile_name + "Service delete PW Notification called for %s", + coordinator.api.smile_name, ) try: - deleted = await coordinator.api.delete_notification() - LOGGER.debug("PW Notification deleted: %s", deleted) + await coordinator.api.delete_notification() + LOGGER.debug("PW Notification deleted") except PlugwiseError: LOGGER.debug( "Failed to delete the Plugwise Notification for %s", @@ -88,12 +89,12 @@ async def delete_notification( async def _update_listener( hass: HomeAssistant, entry: ConfigEntry -): # pragma: no cover # pw-beta +) -> None: # pragma: no cover # pw-beta """Handle options update.""" await hass.config_entries.async_reload(entry.entry_id) -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" if unload_ok := await hass.config_entries.async_unload_platforms( entry, PLATFORMS_GATEWAY diff --git a/custom_components/plugwise/binary_sensor.py b/custom_components/plugwise/binary_sensor.py index 3b90b9787..0057cb07a 100644 --- a/custom_components/plugwise/binary_sensor.py +++ b/custom_components/plugwise/binary_sensor.py @@ -30,13 +30,11 @@ async def async_setup_entry( entities: list[PlugwiseBinarySensorEntity] = [] for device_id, device in coordinator.data.devices.items(): + if "binary_sensors" not in device: + continue for description in PW_BINARY_SENSOR_TYPES: - if ( - "binary_sensors" not in device - or description.key not in device["binary_sensors"] - ): + if description.key not in device["binary_sensors"]: continue - entities.append( PlugwiseBinarySensorEntity( coordinator, @@ -45,6 +43,7 @@ async def async_setup_entry( ) ) LOGGER.debug("Add %s binary sensor", description.key) + async_add_entities(entities) @@ -66,17 +65,17 @@ def __init__( self._notification: dict[str, str] = {} # pw-beta @property - def is_on(self) -> bool | None: + def is_on(self) -> bool: """Return true if the binary sensor is on.""" - if ( - self._notification - ): # pw-beta: show Plugwise notifications as HA persistent notifications + # pw-beta: show Plugwise notifications as HA persistent notifications + if self._notification: for notify_id, message in self._notification.items(): self.hass.components.persistent_notification.async_create( message, "Plugwise Notification:", f"{DOMAIN}.{notify_id}" ) - return self.device["binary_sensors"].get(self.entity_description.key) + # return self.device["binary_sensors"][self.entity_description.key] # type: ignore [literal-required] + return self.entity_description.value_fn(self.device) @property def icon(self) -> str | None: diff --git a/custom_components/plugwise/climate.py b/custom_components/plugwise/climate.py index b3a72110c..6f7b8f506 100644 --- a/custom_components/plugwise/climate.py +++ b/custom_components/plugwise/climate.py @@ -95,9 +95,9 @@ def __init__( self._attr_min_temp = self.device["thermostat"]["lower_bound"] self._attr_max_temp = self.device["thermostat"]["upper_bound"] - # Ensure we don't drop below 0.1 + # Fix unpractical resolution provided by Plugwise self._attr_target_temperature_step = max( - self.device["thermostat"]["resolution"], 0.1 + self.device["thermostat"]["resolution"], 0.5 ) @property @@ -156,13 +156,13 @@ def hvac_action(self) -> HVACAction: # pw-beta add to Core if control_state == "off": return HVACAction.IDLE - hc_data = self.coordinator.data.devices[ - self.coordinator.data.gateway["heater_id"] - ] - if hc_data["binary_sensors"]["heating_state"]: - return HVACAction.HEATING - if hc_data["binary_sensors"].get("cooling_state", False): # pw-beta adds False - return HVACAction.COOLING + heater: str | None = self.coordinator.data.gateway["heater_id"] + if heater is not None: + heater_data = self.coordinator.data.devices[heater] + if heater_data["binary_sensors"]["heating_state"]: + return HVACAction.HEATING + if heater_data["binary_sensors"].get("cooling_state", False): + return HVACAction.COOLING return HVACAction.IDLE diff --git a/custom_components/plugwise/coordinator.py b/custom_components/plugwise/coordinator.py index 0e88515f1..928eade13 100644 --- a/custom_components/plugwise/coordinator.py +++ b/custom_components/plugwise/coordinator.py @@ -1,6 +1,5 @@ """DataUpdateCoordinator for Plugwise.""" from datetime import timedelta -from typing import NamedTuple, cast from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME @@ -10,8 +9,7 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.debounce import Debouncer from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed -from plugwise import Smile -from plugwise.constants import DeviceData, GatewayData +from plugwise import PlugwiseData, Smile from plugwise.exceptions import ( ConnectionFailedError, InvalidAuthentication, @@ -23,20 +21,17 @@ from .const import DEFAULT_PORT, DEFAULT_SCAN_INTERVAL, DEFAULT_USERNAME, DOMAIN, LOGGER -class PlugwiseData(NamedTuple): - """Plugwise data stored in the DataUpdateCoordinator.""" - - gateway: GatewayData - devices: dict[str, DeviceData] - - class PlugwiseDataUpdateCoordinator(DataUpdateCoordinator[PlugwiseData]): """Class to manage fetching Plugwise data from single endpoint.""" _connected: bool = False def __init__( - self, hass: HomeAssistant, entry: ConfigEntry, cooldown: float + self, + hass: HomeAssistant, + entry: ConfigEntry, + cooldown: float, + update_interval: timedelta = timedelta(seconds=60), ) -> None: # pw-beta cooldown """Initialize the coordinator.""" super().__init__( @@ -44,7 +39,7 @@ def __init__( LOGGER, name=DOMAIN, # Core directly updates from const's DEFAULT_SCAN_INTERVAL - update_interval=timedelta(seconds=60), + update_interval=update_interval, # Don't refresh immediately, give the device time to process # the change in state before we query it. request_refresh_debouncer=Debouncer( @@ -65,12 +60,12 @@ def __init__( ) self._entry = entry self._unavailable_logged = False + self.update_interval = update_interval async def _connect(self) -> None: """Connect to the Plugwise Smile.""" self._connected = await self.api.connect() self.api.get_all_devices() - self.name = self.api.smile_name self.update_interval = DEFAULT_SCAN_INTERVAL.get( self.api.smile_type, timedelta(seconds=60) @@ -88,9 +83,7 @@ async def _async_update_data(self) -> PlugwiseData: if not self._connected: await self._connect() data = await self.api.async_update() - LOGGER.debug( - f"{self.api.smile_name} data: %s", PlugwiseData(data[0], data[1]) - ) + LOGGER.debug(f"{self.api.smile_name} data: %s", data) if self._unavailable_logged: self._unavailable_logged = False except InvalidAuthentication as err: @@ -112,7 +105,4 @@ async def _async_update_data(self) -> PlugwiseData: self._unavailable_logged = True raise UpdateFailed("Failed to connect") from err - return PlugwiseData( - gateway=cast(GatewayData, data[0]), - devices=cast(dict[str, DeviceData], data[1]), - ) + return data diff --git a/custom_components/plugwise/entity.py b/custom_components/plugwise/entity.py index 8fe64b490..b11298339 100644 --- a/custom_components/plugwise/entity.py +++ b/custom_components/plugwise/entity.py @@ -66,7 +66,7 @@ def available(self) -> bool: """Return if entity is available.""" return ( self._dev_id in self.coordinator.data.devices - and ("available" not in self.device or self.device["available"]) + and ("available" not in self.device or self.device["available"] is True) and super().available ) diff --git a/custom_components/plugwise/manifest.json b/custom_components/plugwise/manifest.json index 57855e7d3..1c6cdc27f 100644 --- a/custom_components/plugwise/manifest.json +++ b/custom_components/plugwise/manifest.json @@ -8,6 +8,6 @@ "integration_type": "hub", "iot_class": "local_polling", "loggers": ["plugwise"], - "requirements": ["plugwise==0.31.0"], - "version": "0.40.1" + "requirements": ["plugwise==0.31.3"], + "version": "0.40.2" } diff --git a/custom_components/plugwise/models.py b/custom_components/plugwise/models.py index 4b9c580d7..39c3d3688 100644 --- a/custom_components/plugwise/models.py +++ b/custom_components/plugwise/models.py @@ -1,6 +1,7 @@ """Models for the Plugwise integration.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass from homeassistant.components.binary_sensor import BinarySensorEntityDescription @@ -22,22 +23,39 @@ UnitOfVolume, UnitOfVolumeFlowRate, ) +from plugwise import DeviceData @dataclass -class PlugwiseSensorEntityDescription(SensorEntityDescription): +class PlugwiseSensorBaseMixin: + """Mixin for required Plugwise sensor base description keys.""" + + value_fn: Callable[[DeviceData], float | int] + + +@dataclass +class PlugwiseSwitchBaseMixin: + """Mixin for required Plugwise switch base description keys.""" + + value_fn: Callable[[DeviceData], bool] + + +@dataclass +class PlugwiseSensorEntityDescription(SensorEntityDescription, PlugwiseSensorBaseMixin): """Describes Plugwise sensor entity.""" state_class: str | None = SensorStateClass.MEASUREMENT @dataclass -class PlugwiseSwitchEntityDescription(SwitchEntityDescription): +class PlugwiseSwitchEntityDescription(SwitchEntityDescription, PlugwiseSwitchBaseMixin): """Describes Plugwise switch entity.""" @dataclass -class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): +class PlugwiseBinarySensorEntityDescription( + BinarySensorEntityDescription, PlugwiseSwitchBaseMixin +): """Describes Plugwise binary sensor entity.""" icon_off: str | None = None @@ -50,6 +68,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["setpoint"], ), PlugwiseSensorEntityDescription( key="cooling_setpoint", @@ -57,6 +76,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["setpoint_high"], ), PlugwiseSensorEntityDescription( key="heating_setpoint", @@ -64,6 +84,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["setpoint_low"], ), PlugwiseSensorEntityDescription( key="temperature", @@ -71,6 +92,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["temperature"], ), PlugwiseSensorEntityDescription( key="intended_boiler_temperature", @@ -78,12 +100,14 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["intended_boiler_temperature"], ), PlugwiseSensorEntityDescription( key="temperature_difference", translation_key="temperature_difference", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.KELVIN, + value_fn=lambda data: data["sensors"]["temperature_difference"], icon="mdi:temperature-kelvin", ), PlugwiseSensorEntityDescription( @@ -91,6 +115,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="outdoor_temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["outdoor_temperature"], suggested_display_precision=1, ), PlugwiseSensorEntityDescription( @@ -99,6 +124,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["outdoor_air_temperature"], suggested_display_precision=1, ), PlugwiseSensorEntityDescription( @@ -107,6 +133,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["water_temperature"], ), PlugwiseSensorEntityDescription( key="return_temperature", @@ -114,18 +141,21 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["return_temperature"], ), PlugwiseSensorEntityDescription( key="electricity_consumed", translation_key="electricity_consumed", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_consumed"], ), PlugwiseSensorEntityDescription( key="electricity_produced", translation_key="electricity_produced", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_produced"], entity_registry_enabled_default=False, ), # Does not exist in Core - related to P1v2 @@ -134,6 +164,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="electricity_consumed_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_consumed_point"], ), # Does not exist in Core PlugwiseSensorEntityDescription( @@ -141,30 +172,35 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="electricity_produced_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_produced_point"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_interval", translation_key="electricity_consumed_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_consumed_interval"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_peak_interval", translation_key="electricity_consumed_peak_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_consumed_peak_interval"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_off_peak_interval", translation_key="electricity_consumed_off_peak_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_consumed_off_peak_interval"], ), PlugwiseSensorEntityDescription( key="electricity_produced_interval", translation_key="electricity_produced_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_produced_interval"], entity_registry_enabled_default=False, ), PlugwiseSensorEntityDescription( @@ -172,30 +208,37 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="electricity_produced_peak_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_produced_peak_interval"], ), PlugwiseSensorEntityDescription( key="electricity_produced_off_peak_interval", translation_key="electricity_produced_off_peak_interval", icon="mdi:lightning-bolt", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_produced_off_peak_interval"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_off_peak_point", translation_key="electricity_consumed_off_peak_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_consumed_off_peak_point"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_peak_point", translation_key="electricity_consumed_peak_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_consumed_peak_point"], ), PlugwiseSensorEntityDescription( key="electricity_consumed_off_peak_cumulative", translation_key="electricity_consumed_off_peak_cumulative", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + value_fn=lambda data: data["sensors"][ + "electricity_consumed_off_peak_cumulative" + ], state_class=SensorStateClass.TOTAL_INCREASING, ), PlugwiseSensorEntityDescription( @@ -203,6 +246,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="electricity_consumed_peak_cumulative", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_consumed_peak_cumulative"], state_class=SensorStateClass.TOTAL_INCREASING, ), PlugwiseSensorEntityDescription( @@ -210,24 +254,30 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="electricity_produced_off_peak_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_produced_off_peak_point"], ), PlugwiseSensorEntityDescription( key="electricity_produced_peak_point", translation_key="electricity_produced_peak_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_produced_peak_point"], ), PlugwiseSensorEntityDescription( key="electricity_produced_off_peak_cumulative", translation_key="electricity_produced_off_peak_cumulative", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + value_fn=lambda data: data["sensors"][ + "electricity_produced_off_peak_cumulative" + ], state_class=SensorStateClass.TOTAL_INCREASING, ), PlugwiseSensorEntityDescription( key="electricity_produced_peak_cumulative", translation_key="electricity_produced_peak_cumulative", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + value_fn=lambda data: data["sensors"]["electricity_produced_peak_cumulative"], device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), @@ -237,42 +287,49 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): name="Electricity phase one consumed", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_one_consumed"], ), PlugwiseSensorEntityDescription( key="electricity_phase_two_consumed", translation_key="electricity_phase_two_consumed", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_two_consumed"], ), PlugwiseSensorEntityDescription( key="electricity_phase_three_consumed", translation_key="electricity_phase_three_consumed", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_three_consumed"], ), PlugwiseSensorEntityDescription( key="electricity_phase_one_produced", translation_key="electricity_phase_one_produced", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_one_produced"], ), PlugwiseSensorEntityDescription( key="electricity_phase_two_produced", translation_key="electricity_phase_two_produced", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_two_produced"], ), PlugwiseSensorEntityDescription( key="electricity_phase_three_produced", translation_key="electricity_phase_three_produced", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["electricity_phase_three_produced"], ), PlugwiseSensorEntityDescription( key="voltage_phase_one", translation_key="voltage_phase_one", device_class=SensorDeviceClass.VOLTAGE, native_unit_of_measurement=UnitOfElectricPotential.VOLT, + value_fn=lambda data: data["sensors"]["voltage_phase_one"], entity_registry_enabled_default=False, ), PlugwiseSensorEntityDescription( @@ -280,6 +337,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="voltage_phase_two", device_class=SensorDeviceClass.VOLTAGE, native_unit_of_measurement=UnitOfElectricPotential.VOLT, + value_fn=lambda data: data["sensors"]["voltage_phase_two"], entity_registry_enabled_default=False, ), PlugwiseSensorEntityDescription( @@ -287,6 +345,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="voltage_phase_three", device_class=SensorDeviceClass.VOLTAGE, native_unit_of_measurement=UnitOfElectricPotential.VOLT, + value_fn=lambda data: data["sensors"]["voltage_phase_three"], entity_registry_enabled_default=False, ), PlugwiseSensorEntityDescription( @@ -294,12 +353,14 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="gas_consumed_interval", icon="mdi:meter-gas", native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, + value_fn=lambda data: data["sensors"]["gas_consumed_interval"], ), PlugwiseSensorEntityDescription( key="gas_consumed_cumulative", translation_key="gas_consumed_cumulative", device_class=SensorDeviceClass.GAS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, + value_fn=lambda data: data["sensors"]["gas_consumed_cumulative"], state_class=SensorStateClass.TOTAL_INCREASING, ), PlugwiseSensorEntityDescription( @@ -307,12 +368,14 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): translation_key="net_electricity_point", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda data: data["sensors"]["net_electricity_point"], ), PlugwiseSensorEntityDescription( key="net_electricity_cumulative", translation_key="net_electricity_cumulative", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + value_fn=lambda data: data["sensors"]["net_electricity_cumulative"], state_class=SensorStateClass.TOTAL, ), PlugwiseSensorEntityDescription( @@ -321,18 +384,21 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.BATTERY, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: data["sensors"]["battery"], ), PlugwiseSensorEntityDescription( key="illuminance", translation_key="illuminance", device_class=SensorDeviceClass.ILLUMINANCE, native_unit_of_measurement=LIGHT_LUX, + value_fn=lambda data: data["sensors"]["illuminance"], ), PlugwiseSensorEntityDescription( key="modulation_level", translation_key="modulation_level", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: data["sensors"]["modulation_level"], icon="mdi:percent", ), PlugwiseSensorEntityDescription( @@ -341,6 +407,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:valve", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: data["sensors"]["valve_position"], ), PlugwiseSensorEntityDescription( key="water_pressure", @@ -348,12 +415,14 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.PRESSURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfPressure.BAR, + value_fn=lambda data: data["sensors"]["water_pressure"], ), PlugwiseSensorEntityDescription( key="relative_humidity", translation_key="relative_humidity", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: data["sensors"]["humidity"], ), PlugwiseSensorEntityDescription( key="dhw_temperature", @@ -361,6 +430,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["dhw_temperature"], ), PlugwiseSensorEntityDescription( key="domestic_hot_water_setpoint", @@ -368,6 +438,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["sensors"]["domestic_hot_water_setpoint"], ), PlugwiseSensorEntityDescription( key="maximum_boiler_temperature", @@ -375,6 +446,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: data["maximum_boiler_temperature"]["setpoint"], # type: ignore [index] ), ) @@ -385,6 +457,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:water-plus", device_class=SwitchDeviceClass.SWITCH, entity_category=EntityCategory.CONFIG, + value_fn=lambda data: data["switches"]["dhw_cm_switch"], ), PlugwiseSwitchEntityDescription( key="lock", @@ -392,11 +465,13 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:lock", device_class=SwitchDeviceClass.SWITCH, entity_category=EntityCategory.CONFIG, + value_fn=lambda data: data["switches"]["lock"], ), PlugwiseSwitchEntityDescription( key="relay", translation_key="relay", device_class=SwitchDeviceClass.SWITCH, + value_fn=lambda data: data["switches"]["relay"], ), PlugwiseSwitchEntityDescription( key="cooling_enabled", @@ -404,6 +479,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:snowflake-thermometer", device_class=SwitchDeviceClass.SWITCH, entity_category=EntityCategory.CONFIG, + value_fn=lambda data: data["switches"]["cooling_ena_switch"], ), ) @@ -414,12 +490,14 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:hvac", icon_off="mdi:hvac-off", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["compressor_state"], ), PlugwiseBinarySensorEntityDescription( key="cooling_enabled", translation_key="cooling_enabled", icon="mdi:snowflake-thermometer", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["cooling_enabled"], ), PlugwiseBinarySensorEntityDescription( key="dhw_state", @@ -427,6 +505,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:water-pump", icon_off="mdi:water-pump-off", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["dhw_state"], ), PlugwiseBinarySensorEntityDescription( key="flame_state", @@ -434,6 +513,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:fire", icon_off="mdi:fire-off", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["flame_state"], ), PlugwiseBinarySensorEntityDescription( key="heating_state", @@ -441,6 +521,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:radiator", icon_off="mdi:radiator-off", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["heating_state"], ), PlugwiseBinarySensorEntityDescription( key="cooling_state", @@ -448,6 +529,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:snowflake", icon_off="mdi:snowflake-off", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["cooling_state"], ), PlugwiseBinarySensorEntityDescription( key="slave_boiler_state", @@ -455,6 +537,7 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:fire", icon_off="mdi:circle-off-outline", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["slave_boiler_state"], ), PlugwiseBinarySensorEntityDescription( key="plugwise_notification", @@ -462,5 +545,6 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:mailbox-up-outline", icon_off="mdi:mailbox-outline", entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda data: data["binary_sensors"]["plugwise_notification"], ), ) diff --git a/custom_components/plugwise/number.py b/custom_components/plugwise/number.py index a7374ee36..66d6e552e 100644 --- a/custom_components/plugwise/number.py +++ b/custom_components/plugwise/number.py @@ -14,7 +14,7 @@ from homeassistant.const import TEMP_CELSIUS, EntityCategory from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback -from plugwise import Smile +from plugwise import DeviceData, Smile from .const import COORDINATOR # pw-beta from .const import DOMAIN, LOGGER @@ -23,23 +23,20 @@ @dataclass -class PlugwiseEntityDescriptionMixin: +class PlugwiseNumberMixin: """Mixin values for Plugwse entities.""" command: Callable[[Smile, str, float], Awaitable[None]] + native_max_value_fn: Callable[[DeviceData], float] + native_min_value_fn: Callable[[DeviceData], float] + native_step_key_fn: Callable[[DeviceData], float] + native_value_fn: Callable[[DeviceData], float] @dataclass -class PlugwiseNumberEntityDescription( - NumberEntityDescription, PlugwiseEntityDescriptionMixin -): +class PlugwiseNumberEntityDescription(NumberEntityDescription, PlugwiseNumberMixin): """Class describing Plugwise Number entities.""" - native_max_value_key: str | None = None - native_min_value_key: str | None = None - native_step_key: str | None = None - native_value_key: str | None = None - NUMBER_TYPES = ( PlugwiseNumberEntityDescription( @@ -48,23 +45,23 @@ class PlugwiseNumberEntityDescription( command=lambda api, number, value: api.set_number_setpoint(number, value), device_class=NumberDeviceClass.TEMPERATURE, entity_category=EntityCategory.CONFIG, - native_max_value_key="upper_bound", - native_min_value_key="lower_bound", - native_step_key="resolution", + native_max_value_fn=lambda data: data["maximum_boiler_temperature"]["upper_bound"], # type: ignore [index] + native_min_value_fn=lambda data: data["maximum_boiler_temperature"]["lower_bound"], # type: ignore [index] + native_step_key_fn=lambda data: data["maximum_boiler_temperature"]["resolution"], # type: ignore [index] + native_value_fn=lambda data: data["maximum_boiler_temperature"]["setpoint"], # type: ignore [index] native_unit_of_measurement=TEMP_CELSIUS, - native_value_key="setpoint", ), PlugwiseNumberEntityDescription( - key="domestic_hot_water_setpoint", - translation_key="domestic_hot_water_setpoint", + key="max_dhw_temperature", + translation_key="max_dhw_temperature", command=lambda api, number, value: api.set_number_setpoint(number, value), device_class=NumberDeviceClass.TEMPERATURE, entity_category=EntityCategory.CONFIG, - native_max_value_key="upper_bound", - native_min_value_key="lower_bound", - native_step_key="resolution", + native_max_value_fn=lambda data: data["max_dhw_temperature"]["upper_bound"], # type: ignore [index] + native_min_value_fn=lambda data: data["max_dhw_temperature"]["lower_bound"], # type: ignore [index] + native_step_key_fn=lambda data: data["max_dhw_temperature"]["resolution"], # type: ignore [index] + native_value_fn=lambda data: data["max_dhw_temperature"]["setpoint"], # type: ignore [index] native_unit_of_measurement=TEMP_CELSIUS, - native_value_key="setpoint", ), ) @@ -83,7 +80,7 @@ async def async_setup_entry( entities: list[PlugwiseNumberEntity] = [] for device_id, device in coordinator.data.devices.items(): for description in NUMBER_TYPES: - if description.key in device and "setpoint" in device[description.key]: + if description.key in device and "setpoint" in device[description.key]: # type: ignore [literal-required] entities.append( PlugwiseNumberEntity(coordinator, device_id, description) ) @@ -112,33 +109,23 @@ def __init__( @property def native_step(self) -> float: """Return the setpoint step value.""" - return max( - self.device[self.entity_description.key][ - self.entity_description.native_step_key - ], - 1, - ) + # Fix unpractical resolution provided by Plugwise + return max(self.entity_description.native_step_key_fn(self.device), 0.5) @property def native_value(self) -> float: """Return the present setpoint value.""" - return self.device[self.entity_description.key][ - self.entity_description.native_value_key - ] + return self.entity_description.native_value_fn(self.device) @property def native_min_value(self) -> float: """Return the setpoint min. value.""" - return self.device[self.entity_description.key][ - self.entity_description.native_min_value_key - ] + return self.entity_description.native_min_value_fn(self.device) @property def native_max_value(self) -> float: """Return the setpoint max. value.""" - return self.device[self.entity_description.key][ - self.entity_description.native_max_value_key - ] + return self.entity_description.native_max_value_fn(self.device) async def async_set_native_value(self, value: float) -> None: """Change to the new setpoint value.""" diff --git a/custom_components/plugwise/select.py b/custom_components/plugwise/select.py index 97dd4b83a..8d999c9c3 100644 --- a/custom_components/plugwise/select.py +++ b/custom_components/plugwise/select.py @@ -10,7 +10,7 @@ from homeassistant.const import STATE_ON, EntityCategory from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback -from plugwise import Smile +from plugwise import DeviceData, Smile from .const import COORDINATOR # pw-beta from .const import DOMAIN, LOGGER @@ -25,6 +25,8 @@ class PlugwiseSelectDescriptionMixin: """Mixin values for Plugwise Select entities.""" command: Callable[[Smile, str, str], Awaitable[Any]] + value_fn: Callable[[DeviceData], str] + values_fn: Callable[[DeviceData], list[str]] current_option_key: str options_key: str @@ -44,6 +46,8 @@ class PlugwiseSelectEntityDescription( command=lambda api, loc, opt: api.set_schedule_state(loc, opt, STATE_ON), current_option_key="selected_schedule", options_key="available_schedules", + value_fn=lambda data: data["selected_schedule"], + values_fn=lambda data: data["available_schedules"], ), PlugwiseSelectEntityDescription( key="select_regulation_mode", @@ -53,6 +57,8 @@ class PlugwiseSelectEntityDescription( command=lambda api, loc, opt: api.set_regulation_mode(opt), current_option_key="regulation_mode", options_key="regulation_modes", + value_fn=lambda data: data["regulation_mode"], + values_fn=lambda data: data["regulation_modes"], ), PlugwiseSelectEntityDescription( key="select_dhw_mode", @@ -62,6 +68,8 @@ class PlugwiseSelectEntityDescription( command=lambda api, loc, opt: api.set_dhw_mode(opt), current_option_key="dhw_mode", options_key="dhw_modes", + value_fn=lambda data: data["dhw_mode"], + values_fn=lambda data: data["dhw_modes"], ), ) @@ -81,7 +89,7 @@ async def async_setup_entry( for description in SELECT_TYPES: if ( description.options_key in device - and len(device[description.options_key]) > 1 + and len(device[description.options_key]) > 1 # type: ignore [literal-required] ): entities.append( PlugwiseSelectEntity(coordinator, device_id, description) @@ -110,12 +118,14 @@ def __init__( @property def current_option(self) -> str: """Return the selected entity option to represent the entity state.""" - return self.device[self.entity_description.current_option_key] + # return self.device[self.entity_description.current_option_key] # type: ignore [literal-required] + return self.entity_description.value_fn(self.device) @property def options(self) -> list[str]: """Return the selectable entity options.""" - return self.device[self.entity_description.options_key] + # return self.device[self.entity_description.options_key] # type: ignore [literal-required] + return self.entity_description.values_fn(self.device) async def async_select_option(self, option: str) -> None: """Change to the selected entity option.""" diff --git a/custom_components/plugwise/sensor.py b/custom_components/plugwise/sensor.py index 1b63a445f..e5c24eb6f 100644 --- a/custom_components/plugwise/sensor.py +++ b/custom_components/plugwise/sensor.py @@ -25,13 +25,11 @@ async def async_setup_entry( entities: list[PlugwiseSensorEntity] = [] for device_id, device in coordinator.data.devices.items(): + if "sensors" not in device: + continue for description in PW_SENSOR_TYPES: - if ( - "sensors" not in device - or device["sensors"].get(description.key) is None - ): + if description.key not in device["sensors"]: continue - entities.append( PlugwiseSensorEntity( coordinator, @@ -47,6 +45,8 @@ async def async_setup_entry( class PlugwiseSensorEntity(PlugwiseEntity, SensorEntity): """Represent Plugwise Sensors.""" + entity_description: PlugwiseSensorEntityDescription + def __init__( self, coordinator: PlugwiseDataUpdateCoordinator, @@ -59,6 +59,6 @@ def __init__( self._attr_unique_id = f"{device_id}-{description.key}" @property - def native_value(self) -> int | float | None: + def native_value(self) -> int | float: """Return the value reported by the sensor.""" - return self.device["sensors"].get(self.entity_description.key) + return self.entity_description.value_fn(self.device) diff --git a/custom_components/plugwise/strings.json b/custom_components/plugwise/strings.json index fc29356d4..63abaee47 100644 --- a/custom_components/plugwise/strings.json +++ b/custom_components/plugwise/strings.json @@ -75,7 +75,7 @@ "maximum_boiler_temperature": { "name": "Maximum boiler temperature setpoint" }, - "domestic_hot_water_setpoint": { "name": "Domestic hot water setpoint" } + "max_dhw_temperature": { "name": "Domestic hot water setpoint" } }, "select": { "dhw_mode": { diff --git a/custom_components/plugwise/switch.py b/custom_components/plugwise/switch.py index a65ff9565..172b9d07f 100644 --- a/custom_components/plugwise/switch.py +++ b/custom_components/plugwise/switch.py @@ -25,17 +25,22 @@ async def async_setup_entry( coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] entities: list[PlugwiseSwitchEntity] = [] for device_id, device in coordinator.data.devices.items(): + if "switches" not in device: + continue for description in PW_SWITCH_TYPES: - if "switches" not in device or description.key not in device["switches"]: + if description.key not in device["switches"]: continue entities.append(PlugwiseSwitchEntity(coordinator, device_id, description)) LOGGER.debug("Add %s switch", description.key) + async_add_entities(entities) class PlugwiseSwitchEntity(PlugwiseEntity, SwitchEntity): """Representation of a Plugwise plug.""" + entity_description: PlugwiseSwitchEntityDescription + def __init__( self, coordinator: PlugwiseDataUpdateCoordinator, @@ -48,9 +53,9 @@ def __init__( self._attr_unique_id = f"{device_id}-{description.key}" @property - def is_on(self) -> bool | None: + def is_on(self) -> bool: """Return True if entity is on.""" - return self.device["switches"].get(self.entity_description.key) + return self.entity_description.value_fn(self.device) @plugwise_command async def async_turn_on(self, **kwargs: Any) -> None: diff --git a/custom_components/plugwise/translations/en.json b/custom_components/plugwise/translations/en.json index ec43e8596..63abaee47 100644 --- a/custom_components/plugwise/translations/en.json +++ b/custom_components/plugwise/translations/en.json @@ -19,13 +19,6 @@ "config": { "step": { "user": { - "title": "Plugwise connection type", - "description": "Please select:", - "data": { - "flow_type": "Connection type" - } - }, - "user_gateway": { "title": "Connect to the Plugwise Adam/Smile/Stretch", "description": "Please enter:", "data": { @@ -34,18 +27,6 @@ "host": "IP-address", "port": "Port number" } - }, - "user_usb": { - "title": "Connect to Plugwise Stick", - "description": "Please enter:", - "data": { - "usb_path": "USB-path" - } - }, - "manual_path": { - "data": { - "usb_path": "USB-path" - } } }, "error": { @@ -94,7 +75,7 @@ "maximum_boiler_temperature": { "name": "Maximum boiler temperature setpoint" }, - "domestic_hot_water_setpoint": { "name": "Domestic hot water setpoint" } + "max_dhw_temperature": { "name": "Domestic hot water setpoint" } }, "select": { "dhw_mode": { diff --git a/custom_components/plugwise/translations/nl.json b/custom_components/plugwise/translations/nl.json index c458bb061..9d470756d 100644 --- a/custom_components/plugwise/translations/nl.json +++ b/custom_components/plugwise/translations/nl.json @@ -19,13 +19,6 @@ "config": { "step": { "user": { - "title": "Plugwise connectie-type", - "description": "Selecteer aub:", - "data": { - "flow_type": "Connectie-type" - } - }, - "user_gateway": { "title": "Verbinden met de Plugwise Adam/Smile/Stretch", "description": "Aub invoeren:", "data": { @@ -34,18 +27,6 @@ "host": "IP-adres", "port": "Poortnummer" } - }, - "user_usb": { - "title": "Verbinden met de Plugwise Stick", - "description": "Aub invoeren:", - "data": { - "usb_path": "USB-pad" - } - }, - "manual_path": { - "data": { - "usb_path": "USB-pad" - } } }, "error": { @@ -92,7 +73,7 @@ }, "number": { "maximum_boiler_temperature": { "name": "Max cv-ketel temperatuur" }, - "domestic_hot_water_setpoint": { + "max_dhw_temperature": { "name": "Max huishoudelijk warm water temperatuur" } }, diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 000000000..6b2249106 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,40 @@ +[mypy] +python_version = 3.11 +plugins = pydantic.mypy +show_error_codes = true +follow_imports = silent +ignore_missing_imports = true +local_partial_types = true +strict_equality = true +no_implicit_optional = true +warn_incomplete_stub = true +warn_redundant_casts = true +warn_unused_configs = true +warn_unused_ignores = true +enable_error_code = ignore-without-code, redundant-self, truthy-iterable +disable_error_code = annotation-unchecked +strict_concatenate = false +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true + +[pydantic-mypy] +init_forbid_extra = true +init_typed = true +warn_required_dynamic_aliases = true +warn_untyped_fields = true + +[mypy-homeassistant.components.plugwise.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true diff --git a/scripts/core-testing.sh b/scripts/core-testing.sh index 3b69df4c5..3a4d28221 100755 --- a/scripts/core-testing.sh +++ b/scripts/core-testing.sh @@ -212,6 +212,17 @@ if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "quality" ] ; then ruff tests/components/plugwise/*py || exit echo "... black-ing ..." black homeassistant/components/plugwise/*py tests/components/plugwise/*py || exit + echo "... Prepping strict without hassfest ... (for mypy)" + echo "homeassistant.components.plugwise.*" >> .strict-typing + echo "[mypy-homeassistant.components.plugwise.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true" >> mypy.ini echo "... mypy ..." script/run-in-env.sh mypy homeassistant/components/plugwise/*.py || exit cd .. @@ -239,8 +250,12 @@ if [ -z "${GITHUB_ACTIONS}" ]; then # shellcheck disable=SC2090 sed -i".sedbck" 's/http.*test-files.pythonhosted.*#//g' ./homeassistant/components/plugwise/manifest.json ) - echo "Running hassfest for plugwise" - python3 -m script.hassfest --requirements --action validate + + # Hassfest already runs on Github + if [ -n "${GITHUB_ACTIONS}" ] ; then + echo "Running hassfest for plugwise" + python3 -m script.hassfest --requirements --action validate + fi fi # pylint was removed from 'quality' some time ago diff --git a/tests/components/plugwise/conftest.py b/tests/components/plugwise/conftest.py index 880715820..cf16b2c4d 100644 --- a/tests/components/plugwise/conftest.py +++ b/tests/components/plugwise/conftest.py @@ -17,6 +17,7 @@ CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from plugwise import PlugwiseData from tests.common import MockConfigEntry, load_fixture @@ -89,7 +90,10 @@ def mock_smile_adam() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -115,7 +119,10 @@ def mock_smile_adam_2() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -141,7 +148,10 @@ def mock_smile_adam_3() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -166,7 +176,10 @@ def mock_smile_anna() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -191,7 +204,10 @@ def mock_smile_anna_2() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -216,7 +232,10 @@ def mock_smile_anna_3() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -241,7 +260,10 @@ def mock_smile_p1() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -249,7 +271,7 @@ def mock_smile_p1() -> Generator[None, MagicMock, None]: @pytest.fixture def mock_smile_p1_2() -> Generator[None, MagicMock, None]: """Create a Mock P1 3-phase DSMR environment for testing exceptions.""" - chosen_env = "p1v4_3ph" + chosen_env = "p1v4_442_triple" with patch( "homeassistant.components.plugwise.coordinator.Smile", autospec=True ) as smile_mock: @@ -266,7 +288,10 @@ def mock_smile_p1_2() -> Generator[None, MagicMock, None]: smile.connect.return_value = True smile.notifications = _read_json(chosen_env, "notifications") - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile @@ -289,7 +314,10 @@ def mock_stretch() -> Generator[None, MagicMock, None]: smile.smile_name = "Stretch" smile.connect.return_value = True - smile.async_update.return_value = _read_json(chosen_env, "all_data") + all_data = _read_json(chosen_env, "all_data") + smile.async_update.return_value = PlugwiseData( + all_data["gateway"], all_data["devices"] + ) yield smile diff --git a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json index d62ff0e24..ffc2ca8ab 100644 --- a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -1,103 +1,106 @@ -[ - { - "smile_name": "Adam", - "gateway_id": "fe799307f1624099878210aa0b9f1475", - "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "cooling_present": false, - "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." - } - } - }, - { - "df4a4a8169904cdb9c03d61a21f42140": { - "dev_class": "zone_thermostat", - "firmware": "2016-10-27T02:00:00+02:00", - "hardware": "255", - "location": "12493538af164a409c6a1c79e38afe1c", - "model": "Lisa", - "name": "Zone Lisa Bios", - "zigbee_mac_address": "ABCD012345670A06", - "vendor": "Plugwise", - "thermostat": { - "setpoint": 13.0, - "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 +{ + "devices": { + "02cf28bfec924855854c544690a609ef": { + "available": true, + "dev_class": "vcr", + "firmware": "2019-06-21T02:00:00+02:00", + "location": "cd143c07248f491493cea0533bc3d669", + "model": "Plug", + "name": "NVR", + "sensors": { + "electricity_consumed": 34.0, + "electricity_consumed_interval": 9.15, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 }, + "switches": { + "lock": true, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A15" + }, + "21f2b542c49845e6bb416884c55778d6": { "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "away", - "available_schedules": [ - "CV Roan", - "Bios Schema met Film Avond", - "GF7 Woonkamer", - "Badkamer Schema", - "CV Jessie" - ], - "selected_schedule": "None", - "last_used": "Badkamer Schema", - "mode": "heat", + "dev_class": "game_console", + "firmware": "2019-06-21T02:00:00+02:00", + "location": "cd143c07248f491493cea0533bc3d669", + "model": "Plug", + "name": "Playstation Smart Plug", "sensors": { - "temperature": 16.5, - "setpoint": 13.0, - "battery": 67 - } + "electricity_consumed": 82.6, + "electricity_consumed_interval": 8.6, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A12" }, - "b310b72a0e354bfab43089919b9a88bf": { - "dev_class": "thermo_sensor", - "firmware": "2019-03-27T01:00:00+01:00", - "hardware": "1", - "location": "c50f167537524366a5af7aa3942feb1e", - "model": "Tom/Floor", - "name": "Floor kraan", - "zigbee_mac_address": "ABCD012345670A02", + "4a810418d5394b3f82727340b91ba740": { + "available": true, + "dev_class": "router", + "firmware": "2019-06-21T02:00:00+02:00", + "location": "cd143c07248f491493cea0533bc3d669", + "model": "Plug", + "name": "USG Smart Plug", + "sensors": { + "electricity_consumed": 8.5, + "electricity_consumed_interval": 0.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": true, + "relay": true + }, "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A16" + }, + "675416a629f343c495449970e2ca37b5": { "available": true, + "dev_class": "router", + "firmware": "2019-06-21T02:00:00+02:00", + "location": "cd143c07248f491493cea0533bc3d669", + "model": "Plug", + "name": "Ziggo Modem", "sensors": { - "temperature": 26.0, - "setpoint": 21.5, - "temperature_difference": 3.5, - "valve_position": 100 - } + "electricity_consumed": 12.2, + "electricity_consumed_interval": 2.97, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": true, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A01" }, - "a2c3583e0a6349358998b760cea82d2a": { + "680423ff840043738f42cc7f1ff97a36": { + "available": true, "dev_class": "thermo_sensor", "firmware": "2019-03-27T01:00:00+01:00", "hardware": "1", - "location": "12493538af164a409c6a1c79e38afe1c", + "location": "08963fec7c53423ca5680aa4cb502c63", "model": "Tom/Floor", - "name": "Bios Cv Thermostatic Radiator ", - "zigbee_mac_address": "ABCD012345670A09", - "vendor": "Plugwise", - "available": true, + "name": "Thermostatic Radiator Badkamer", "sensors": { - "temperature": 17.2, - "setpoint": 13.0, - "battery": 62, - "temperature_difference": -0.2, + "battery": 51, + "setpoint": 14.0, + "temperature": 19.1, + "temperature_difference": -0.4, "valve_position": 0.0 - } - }, - "b59bcebaf94b499ea7d46e4a66fb62d8": { - "dev_class": "zone_thermostat", - "firmware": "2016-08-02T02:00:00+02:00", - "hardware": "255", - "location": "c50f167537524366a5af7aa3942feb1e", - "model": "Lisa", - "name": "Zone Lisa WK", - "zigbee_mac_address": "ABCD012345670A07", - "vendor": "Plugwise", - "thermostat": { - "setpoint": 21.5, - "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A17" + }, + "6a3bf693d05e48e0b460c815a4fdd09d": { + "active_preset": "asleep", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "home", "available_schedules": [ "CV Roan", "Bios Schema met Film Avond", @@ -105,80 +108,37 @@ "Badkamer Schema", "CV Jessie" ], - "selected_schedule": "GF7 Woonkamer", - "last_used": "GF7 Woonkamer", + "dev_class": "zone_thermostat", + "firmware": "2016-10-27T02:00:00+02:00", + "hardware": "255", + "last_used": "CV Jessie", + "location": "82fa13f017d240daa0d0ea1775420f24", "mode": "auto", + "model": "Lisa", + "name": "Zone Thermostat Jessie", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "CV Jessie", "sensors": { - "temperature": 20.9, - "setpoint": 21.5, - "battery": 34 - } - }, - "fe799307f1624099878210aa0b9f1475": { - "dev_class": "gateway", - "firmware": "3.0.15", - "hardware": "AME Smile 2.0 board", - "location": "1f9dcf83fd4e4b66b72ff787957bfe5d", - "mac_address": "012345670001", - "model": "Gateway", - "name": "Adam", - "zigbee_mac_address": "ABCD012345670101", - "vendor": "Plugwise", - "regulation_mode": "heating", - "binary_sensors": { - "plugwise_notification": true + "battery": 37, + "setpoint": 15.0, + "temperature": 17.2 }, - "sensors": { - "outdoor_temperature": 7.81 - } - }, - "d3da73bde12a47d5a6b8f9dad971f2ec": { - "dev_class": "thermo_sensor", - "firmware": "2019-03-27T01:00:00+01:00", - "hardware": "1", - "location": "82fa13f017d240daa0d0ea1775420f24", - "model": "Tom/Floor", - "name": "Thermostatic Radiator Jessie", - "zigbee_mac_address": "ABCD012345670A10", - "vendor": "Plugwise", - "available": true, - "sensors": { - "temperature": 17.1, + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, "setpoint": 15.0, - "battery": 62, - "temperature_difference": 0.1, - "valve_position": 0.0 - } - }, - "21f2b542c49845e6bb416884c55778d6": { - "dev_class": "game_console", - "firmware": "2019-06-21T02:00:00+02:00", - "location": "cd143c07248f491493cea0533bc3d669", - "model": "Plug", - "name": "Playstation Smart Plug", - "zigbee_mac_address": "ABCD012345670A12", - "vendor": "Plugwise", - "available": true, - "sensors": { - "electricity_consumed": 82.6, - "electricity_consumed_interval": 8.6, - "electricity_produced": 0.0, - "electricity_produced_interval": 0.0 + "upper_bound": 99.9 }, - "switches": { - "relay": true, - "lock": false - } + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A03" }, "78d1126fc4c743db81b61c20e88342a7": { + "available": true, "dev_class": "central_heating_pump", "firmware": "2019-06-21T02:00:00+02:00", "location": "c50f167537524366a5af7aa3942feb1e", "model": "Plug", "name": "CV Pomp", - "zigbee_mac_address": "ABCD012345670A05", - "vendor": "Plugwise", - "available": true, "sensors": { "electricity_consumed": 35.6, "electricity_consumed_interval": 7.37, @@ -187,120 +147,154 @@ }, "switches": { "relay": true - } + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A05" }, "90986d591dcd426cae3ec3e8111ff730": { + "binary_sensors": { + "heating_state": true + }, "dev_class": "heater_central", "location": "1f9dcf83fd4e4b66b72ff787957bfe5d", "model": "Unknown", "name": "OnOff", - "binary_sensors": { - "heating_state": true - }, "sensors": { - "water_temperature": 70.0, "intended_boiler_temperature": 70.0, - "modulation_level": 1 + "modulation_level": 1, + "water_temperature": 70.0 } }, - "cd0ddb54ef694e11ac18ed1cbce5dbbd": { - "dev_class": "vcr", + "a28f588dc4a049a483fd03a30361ad3a": { + "available": true, + "dev_class": "settop", "firmware": "2019-06-21T02:00:00+02:00", "location": "cd143c07248f491493cea0533bc3d669", "model": "Plug", - "name": "NAS", - "zigbee_mac_address": "ABCD012345670A14", - "vendor": "Plugwise", - "available": true, + "name": "Fibaro HC2", "sensors": { - "electricity_consumed": 16.5, - "electricity_consumed_interval": 0.5, + "electricity_consumed": 12.5, + "electricity_consumed_interval": 3.8, "electricity_produced": 0.0, "electricity_produced_interval": 0.0 }, "switches": { - "relay": true, - "lock": true - } - }, - "4a810418d5394b3f82727340b91ba740": { - "dev_class": "router", - "firmware": "2019-06-21T02:00:00+02:00", - "location": "cd143c07248f491493cea0533bc3d669", - "model": "Plug", - "name": "USG Smart Plug", - "zigbee_mac_address": "ABCD012345670A16", + "lock": true, + "relay": true + }, "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A13" + }, + "a2c3583e0a6349358998b760cea82d2a": { "available": true, + "dev_class": "thermo_sensor", + "firmware": "2019-03-27T01:00:00+01:00", + "hardware": "1", + "location": "12493538af164a409c6a1c79e38afe1c", + "model": "Tom/Floor", + "name": "Bios Cv Thermostatic Radiator ", "sensors": { - "electricity_consumed": 8.5, - "electricity_consumed_interval": 0.0, - "electricity_produced": 0.0, - "electricity_produced_interval": 0.0 + "battery": 62, + "setpoint": 13.0, + "temperature": 17.2, + "temperature_difference": -0.2, + "valve_position": 0.0 }, - "switches": { - "relay": true, - "lock": true - } + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A09" }, - "02cf28bfec924855854c544690a609ef": { - "dev_class": "vcr", - "firmware": "2019-06-21T02:00:00+02:00", - "location": "cd143c07248f491493cea0533bc3d669", - "model": "Plug", - "name": "NVR", - "zigbee_mac_address": "ABCD012345670A15", + "b310b72a0e354bfab43089919b9a88bf": { + "available": true, + "dev_class": "thermo_sensor", + "firmware": "2019-03-27T01:00:00+01:00", + "hardware": "1", + "location": "c50f167537524366a5af7aa3942feb1e", + "model": "Tom/Floor", + "name": "Floor kraan", + "sensors": { + "setpoint": 21.5, + "temperature": 26.0, + "temperature_difference": 3.5, + "valve_position": 100 + }, "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A02" + }, + "b59bcebaf94b499ea7d46e4a66fb62d8": { + "active_preset": "home", "available": true, + "available_schedules": [ + "CV Roan", + "Bios Schema met Film Avond", + "GF7 Woonkamer", + "Badkamer Schema", + "CV Jessie" + ], + "dev_class": "zone_thermostat", + "firmware": "2016-08-02T02:00:00+02:00", + "hardware": "255", + "last_used": "GF7 Woonkamer", + "location": "c50f167537524366a5af7aa3942feb1e", + "mode": "auto", + "model": "Lisa", + "name": "Zone Lisa WK", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "GF7 Woonkamer", "sensors": { - "electricity_consumed": 34.0, - "electricity_consumed_interval": 9.15, - "electricity_produced": 0.0, - "electricity_produced_interval": 0.0 + "battery": 34, + "setpoint": 21.5, + "temperature": 20.9 }, - "switches": { - "relay": true, - "lock": true - } + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint": 21.5, + "upper_bound": 99.9 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A07" }, - "a28f588dc4a049a483fd03a30361ad3a": { - "dev_class": "settop", + "cd0ddb54ef694e11ac18ed1cbce5dbbd": { + "available": true, + "dev_class": "vcr", "firmware": "2019-06-21T02:00:00+02:00", "location": "cd143c07248f491493cea0533bc3d669", "model": "Plug", - "name": "Fibaro HC2", - "zigbee_mac_address": "ABCD012345670A13", - "vendor": "Plugwise", - "available": true, + "name": "NAS", "sensors": { - "electricity_consumed": 12.5, - "electricity_consumed_interval": 3.8, + "electricity_consumed": 16.5, + "electricity_consumed_interval": 0.5, "electricity_produced": 0.0, "electricity_produced_interval": 0.0 }, "switches": { - "relay": true, - "lock": true - } + "lock": true, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A14" }, - "6a3bf693d05e48e0b460c815a4fdd09d": { - "dev_class": "zone_thermostat", - "firmware": "2016-10-27T02:00:00+02:00", - "hardware": "255", + "d3da73bde12a47d5a6b8f9dad971f2ec": { + "available": true, + "dev_class": "thermo_sensor", + "firmware": "2019-03-27T01:00:00+01:00", + "hardware": "1", "location": "82fa13f017d240daa0d0ea1775420f24", - "model": "Lisa", - "name": "Zone Thermostat Jessie", - "zigbee_mac_address": "ABCD012345670A03", - "vendor": "Plugwise", - "thermostat": { + "model": "Tom/Floor", + "name": "Thermostatic Radiator Jessie", + "sensors": { + "battery": 62, "setpoint": 15.0, - "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 + "temperature": 17.1, + "temperature_difference": 0.1, + "valve_position": 0.0 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A10" + }, + "df4a4a8169904cdb9c03d61a21f42140": { + "active_preset": "away", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "asleep", "available_schedules": [ "CV Roan", "Bios Schema met Film Avond", @@ -308,51 +302,33 @@ "Badkamer Schema", "CV Jessie" ], - "selected_schedule": "CV Jessie", - "last_used": "CV Jessie", - "mode": "auto", - "sensors": { - "temperature": 17.2, - "setpoint": 15.0, - "battery": 37 - } - }, - "680423ff840043738f42cc7f1ff97a36": { - "dev_class": "thermo_sensor", - "firmware": "2019-03-27T01:00:00+01:00", - "hardware": "1", - "location": "08963fec7c53423ca5680aa4cb502c63", - "model": "Tom/Floor", - "name": "Thermostatic Radiator Badkamer", - "zigbee_mac_address": "ABCD012345670A17", - "vendor": "Plugwise", - "available": true, - "sensors": { - "temperature": 19.1, - "setpoint": 14.0, - "battery": 51, - "temperature_difference": -0.4, - "valve_position": 0.0 - } - }, - "f1fee6043d3642a9b0a65297455f008e": { "dev_class": "zone_thermostat", "firmware": "2016-10-27T02:00:00+02:00", "hardware": "255", - "location": "08963fec7c53423ca5680aa4cb502c63", + "last_used": "Badkamer Schema", + "location": "12493538af164a409c6a1c79e38afe1c", + "mode": "heat", "model": "Lisa", - "name": "Zone Thermostat Badkamer", - "zigbee_mac_address": "ABCD012345670A08", - "vendor": "Plugwise", + "name": "Zone Lisa Bios", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "None", + "sensors": { + "battery": 67, + "setpoint": 13.0, + "temperature": 16.5 + }, "thermostat": { - "setpoint": 14.0, "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 + "resolution": 0.01, + "setpoint": 13.0, + "upper_bound": 99.9 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A06" + }, + "e7693eb9582644e5b865dba8d4447cf1": { + "active_preset": "no_frost", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "away", "available_schedules": [ "CV Roan", "Bios Schema met Film Avond", @@ -360,53 +336,35 @@ "Badkamer Schema", "CV Jessie" ], - "selected_schedule": "Badkamer Schema", - "last_used": "Badkamer Schema", - "mode": "auto", - "sensors": { - "temperature": 18.9, - "setpoint": 14.0, - "battery": 92 - } - }, - "675416a629f343c495449970e2ca37b5": { - "dev_class": "router", - "firmware": "2019-06-21T02:00:00+02:00", - "location": "cd143c07248f491493cea0533bc3d669", - "model": "Plug", - "name": "Ziggo Modem", - "zigbee_mac_address": "ABCD012345670A01", - "vendor": "Plugwise", - "available": true, - "sensors": { - "electricity_consumed": 12.2, - "electricity_consumed_interval": 2.97, - "electricity_produced": 0.0, - "electricity_produced_interval": 0.0 - }, - "switches": { - "relay": true, - "lock": true - } - }, - "e7693eb9582644e5b865dba8d4447cf1": { "dev_class": "thermostatic_radiator_valve", "firmware": "2019-03-27T01:00:00+01:00", "hardware": "1", + "last_used": "Badkamer Schema", "location": "446ac08dd04d4eff8ac57489757b7314", + "mode": "heat", "model": "Tom/Floor", "name": "CV Kraan Garage", - "zigbee_mac_address": "ABCD012345670A11", - "vendor": "Plugwise", - "thermostat": { + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "None", + "sensors": { + "battery": 68, "setpoint": 5.5, + "temperature": 15.6, + "temperature_difference": 0.0, + "valve_position": 0.0 + }, + "thermostat": { "lower_bound": 0.0, - "upper_bound": 100.0, - "resolution": 0.01 + "resolution": 0.01, + "setpoint": 5.5, + "upper_bound": 100.0 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A11" + }, + "f1fee6043d3642a9b0a65297455f008e": { + "active_preset": "away", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "no_frost", "available_schedules": [ "CV Roan", "Bios Schema met Film Avond", @@ -414,16 +372,58 @@ "Badkamer Schema", "CV Jessie" ], - "selected_schedule": "None", + "dev_class": "zone_thermostat", + "firmware": "2016-10-27T02:00:00+02:00", + "hardware": "255", "last_used": "Badkamer Schema", - "mode": "heat", + "location": "08963fec7c53423ca5680aa4cb502c63", + "mode": "auto", + "model": "Lisa", + "name": "Zone Thermostat Badkamer", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "Badkamer Schema", "sensors": { - "temperature": 15.6, - "setpoint": 5.5, - "battery": 68, - "temperature_difference": 0.0, - "valve_position": 0.0 - } + "battery": 92, + "setpoint": 14.0, + "temperature": 18.9 + }, + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint": 14.0, + "upper_bound": 99.9 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A08" + }, + "fe799307f1624099878210aa0b9f1475": { + "binary_sensors": { + "plugwise_notification": true + }, + "dev_class": "gateway", + "firmware": "3.0.15", + "hardware": "AME Smile 2.0 board", + "location": "1f9dcf83fd4e4b66b72ff787957bfe5d", + "mac_address": "012345670001", + "model": "Gateway", + "name": "Adam", + "regulation_mode": "heating", + "sensors": { + "outdoor_temperature": 7.81 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670101" } + }, + "gateway": { + "cooling_present": false, + "gateway_id": "fe799307f1624099878210aa0b9f1475", + "heater_id": "90986d591dcd426cae3ec3e8111ff730", + "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." + } + }, + "smile_name": "Adam" } -] +} diff --git a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json index f00293a65..52d76a5b4 100644 --- a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json +++ b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json @@ -1,90 +1,90 @@ -[ - { - "smile_name": "Smile Anna", - "gateway_id": "015ae9ea3f964e668e490fa39da3870b", - "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "cooling_present": false, - "notifications": {} - }, - { - "1cbf783bb11e4a7c8a6843dee3a86927": { - "dev_class": "heater_central", +{ + "devices": { + "015ae9ea3f964e668e490fa39da3870b": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "4.0.15", + "hardware": "AME Smile 2.0 board", "location": "a57efe5f145f498c9be62a9b63626fbf", - "model": "Generic heater/cooler", - "name": "OpenTherm", - "vendor": "Techneco", - "maximum_boiler_temperature": { - "setpoint": 60.0, - "lower_bound": 0.0, - "upper_bound": 100.0, - "resolution": 1.0 + "mac_address": "012345670001", + "model": "Gateway", + "name": "Smile Anna", + "sensors": { + "outdoor_temperature": 20.2 }, + "vendor": "Plugwise" + }, + "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, "binary_sensors": { + "compressor_state": true, "cooling_enabled": false, "dhw_state": false, + "flame_state": false, "heating_state": true, - "compressor_state": true, - "slave_boiler_state": false, - "flame_state": false + "slave_boiler_state": false + }, + "dev_class": "heater_central", + "location": "a57efe5f145f498c9be62a9b63626fbf", + "maximum_boiler_temperature": { + "lower_bound": 0.0, + "resolution": 1.0, + "setpoint": 60.0, + "upper_bound": 100.0 }, + "model": "Generic heater", + "name": "OpenTherm", "sensors": { - "water_temperature": 29.1, - "domestic_hot_water_setpoint": 60.0, "dhw_temperature": 46.3, + "domestic_hot_water_setpoint": 60.0, "intended_boiler_temperature": 35.0, "modulation_level": 52, + "outdoor_air_temperature": 3.0, "return_temperature": 25.1, "water_pressure": 1.57, - "outdoor_air_temperature": 3.0 + "water_temperature": 29.1 }, "switches": { "dhw_cm_switch": false - } - }, - "015ae9ea3f964e668e490fa39da3870b": { - "dev_class": "gateway", - "firmware": "4.0.15", - "hardware": "AME Smile 2.0 board", - "location": "a57efe5f145f498c9be62a9b63626fbf", - "mac_address": "012345670001", - "model": "Gateway", - "name": "Smile Anna", - "vendor": "Plugwise", - "binary_sensors": { - "plugwise_notification": false }, - "sensors": { - "outdoor_temperature": 20.2 - } + "vendor": "Techneco" }, "3cb70739631c4d17a86b8b12e8a5161b": { + "active_preset": "home", + "available_schedules": ["standaard"], "dev_class": "thermostat", "firmware": "2018-02-08T11:15:53+01:00", "hardware": "6539-1301-5002", + "last_used": "standaard", "location": "c784ee9fdab44e1395b8dee7d7a497d5", + "mode": "auto", "model": "ThermoTouch", "name": "Anna", - "vendor": "Plugwise", - "thermostat": { - "setpoint": 20.5, - "lower_bound": 4.0, - "upper_bound": 30.0, - "resolution": 0.1 - }, "preset_modes": ["no_frost", "home", "away", "asleep", "vacation"], - "active_preset": "home", - "available_schedules": ["standaard"], "selected_schedule": "standaard", - "last_used": "standaard", - "mode": "auto", "sensors": { - "temperature": 19.3, - "setpoint": 20.5, - "illuminance": 86.0, "cooling_activation_outdoor_temperature": 21.0, - "cooling_deactivation_threshold": 4.0 - } + "cooling_deactivation_threshold": 4.0, + "illuminance": 86.0, + "setpoint": 20.5, + "temperature": 19.3 + }, + "thermostat": { + "lower_bound": 4.0, + "resolution": 0.1, + "setpoint": 20.5, + "upper_bound": 30.0 + }, + "vendor": "Plugwise" } + }, + "gateway": { + "cooling_present": false, + "gateway_id": "015ae9ea3f964e668e490fa39da3870b", + "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", + "notifications": {}, + "smile_name": "Smile Anna" } -] +} diff --git a/tests/components/plugwise/fixtures/m_adam_cooling/all_data.json b/tests/components/plugwise/fixtures/m_adam_cooling/all_data.json index 06a3fa400..4f7de13d9 100644 --- a/tests/components/plugwise/fixtures/m_adam_cooling/all_data.json +++ b/tests/components/plugwise/fixtures/m_adam_cooling/all_data.json @@ -1,88 +1,79 @@ -[ - { - "smile_name": "Adam", - "gateway_id": "da224107914542988a88561b4452b0f6", - "heater_id": "056ee145a816487eaa69243c3280f8bf", - "cooling_present": true, - "notifications": {} - }, - { - "ad4838d7d35c4d6ea796ee12ae5aedf8": { - "dev_class": "thermostat", - "location": "f2bf9048bef64cc5b6d5110154e33c81", - "model": "ThermoTouch", - "name": "Anna", - "vendor": "Plugwise", - "thermostat": { - "setpoint_low": 4.0, - "setpoint_high": 23.5, - "lower_bound": 1.0, - "upper_bound": 35.0, - "resolution": 0.01 - }, +{ + "devices": { + "056ee145a816487eaa69243c3280f8bf": { "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "asleep", - "available_schedules": ["Weekschema", "Badkamer", "Test"], - "selected_schedule": "None", - "last_used": "Weekschema", - "control_state": "cooling", - "mode": "heat_cool", + "binary_sensors": { + "cooling_state": true, + "dhw_state": false, + "flame_state": false, + "heating_state": false + }, + "dev_class": "heater_central", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "maximum_boiler_temperature": { + "lower_bound": 25.0, + "resolution": 0.01, + "setpoint": 60.0, + "upper_bound": 95.0 + }, + "model": "Generic heater", + "name": "OpenTherm", "sensors": { - "temperature": 25.8, - "setpoint_low": 4.0, - "setpoint_high": 23.5 + "intended_boiler_temperature": 17.5, + "water_temperature": 19.0 + }, + "switches": { + "dhw_cm_switch": false } }, "1772a4ea304041adb83f357b751341ff": { + "available": true, "dev_class": "thermo_sensor", "firmware": "2020-11-04T01:00:00+01:00", "hardware": "1", "location": "f871b8c4d63549319221e294e4f88074", "model": "Tom/Floor", "name": "Tom Badkamer", - "zigbee_mac_address": "ABCD012345670A01", - "vendor": "Plugwise", - "available": true, "sensors": { - "temperature": 21.6, "battery": 99, + "temperature": 21.6, "temperature_difference": 2.3, "valve_position": 0.0 - } - }, - "e2f4322d57924fa090fbbc48b3a140dc": { - "dev_class": "zone_thermostat", - "firmware": "2016-10-10T02:00:00+02:00", - "hardware": "255", - "location": "f871b8c4d63549319221e294e4f88074", - "model": "Lisa", - "name": "Lisa Badkamer", - "zigbee_mac_address": "ABCD012345670A04", - "vendor": "Plugwise", - "thermostat": { - "setpoint_low": 19.0, - "setpoint_high": 25.0, - "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A01" + }, + "ad4838d7d35c4d6ea796ee12ae5aedf8": { + "active_preset": "asleep", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "home", "available_schedules": ["Weekschema", "Badkamer", "Test"], - "selected_schedule": "Badkamer", - "last_used": "Badkamer", - "control_state": "off", - "mode": "auto", + "control_state": "cooling", + "dev_class": "thermostat", + "last_used": "Weekschema", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "mode": "heat_cool", + "model": "ThermoTouch", + "name": "Anna", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "None", "sensors": { - "temperature": 239, - "battery": 56, - "setpoint_low": 20.0, - "setpoint_high": 23.5 - } + "setpoint_high": 23.5, + "setpoint_low": 4.0, + "temperature": 25.8 + }, + "thermostat": { + "lower_bound": 1.0, + "resolution": 0.01, + "setpoint_high": 23.5, + "setpoint_low": 4.0, + "upper_bound": 35.0 + }, + "vendor": "Plugwise" }, "da224107914542988a88561b4452b0f6": { + "binary_sensors": { + "plugwise_notification": false + }, "dev_class": "gateway", "firmware": "3.6.4", "hardware": "AME Smile 2.0 board", @@ -90,60 +81,69 @@ "mac_address": "012345670001", "model": "Gateway", "name": "Adam", - "zigbee_mac_address": "ABCD012345670101", - "vendor": "Plugwise", "regulation_mode": "cooling", "regulation_modes": [ - "cooling", "heating", "off", "bleeding_cold", - "bleeding_hot" + "bleeding_hot", + "cooling" ], - "binary_sensors": { - "plugwise_notification": false - }, "sensors": { "outdoor_temperature": 29.65 - } - }, - "056ee145a816487eaa69243c3280f8bf": { - "dev_class": "heater_central", - "location": "bc93488efab249e5bc54fd7e175a6f91", - "model": "Generic heater", - "name": "OpenTherm", - "maximum_boiler_temperature": { - "setpoint": 60.0, - "lower_bound": 25.0, - "upper_bound": 95.0, - "resolution": 0.01 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670101" + }, + "e2f4322d57924fa090fbbc48b3a140dc": { + "active_preset": "home", "available": true, - "binary_sensors": { - "cooling_state": true, - "dhw_state": false, - "heating_state": false, - "flame_state": false - }, + "available_schedules": ["Weekschema", "Badkamer", "Test"], + "control_state": "off", + "dev_class": "zone_thermostat", + "firmware": "2016-10-10T02:00:00+02:00", + "hardware": "255", + "last_used": "Badkamer", + "location": "f871b8c4d63549319221e294e4f88074", + "mode": "auto", + "model": "Lisa", + "name": "Lisa Badkamer", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "Badkamer", "sensors": { - "water_temperature": 19.0, - "intended_boiler_temperature": 17.5 + "battery": 56, + "setpoint_high": 23.5, + "setpoint_low": 20.0, + "temperature": 239 }, - "switches": { - "dhw_cm_switch": false - } + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint_high": 25.0, + "setpoint_low": 19.0, + "upper_bound": 99.9 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A04" }, "e8ef2a01ed3b4139a53bf749204fe6b4": { "dev_class": "switching", - "model": "Switchgroup", - "name": "Test", "members": [ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], + "model": "Switchgroup", + "name": "Test", "switches": { "relay": true } } + }, + "gateway": { + "cooling_present": true, + "gateway_id": "da224107914542988a88561b4452b0f6", + "heater_id": "056ee145a816487eaa69243c3280f8bf", + "notifications": {}, + "smile_name": "Adam" } -] +} diff --git a/tests/components/plugwise/fixtures/m_adam_heating/all_data.json b/tests/components/plugwise/fixtures/m_adam_heating/all_data.json index 8ee3df544..3afb112fb 100644 --- a/tests/components/plugwise/fixtures/m_adam_heating/all_data.json +++ b/tests/components/plugwise/fixtures/m_adam_heating/all_data.json @@ -1,81 +1,82 @@ -[ - { - "smile_name": "Adam", - "gateway_id": "da224107914542988a88561b4452b0f6", - "heater_id": "056ee145a816487eaa69243c3280f8bf", - "cooling_present": false, - "notifications": {} - }, - { - "ad4838d7d35c4d6ea796ee12ae5aedf8": { - "dev_class": "thermostat", - "location": "f2bf9048bef64cc5b6d5110154e33c81", - "model": "ThermoTouch", - "name": "Anna", - "vendor": "Plugwise", - "thermostat": { - "setpoint": 20.0, - "lower_bound": 1.0, - "upper_bound": 35.0, - "resolution": 0.01 - }, +{ + "devices": { + "056ee145a816487eaa69243c3280f8bf": { "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "asleep", - "available_schedules": ["Weekschema", "Badkamer", "Test"], - "selected_schedule": "None", - "last_used": "Weekschema", - "control_state": "heating", - "mode": "heat", - "sensors": { "temperature": 19.1, "setpoint": 20.0 } + "binary_sensors": { + "dhw_state": false, + "flame_state": false, + "heating_state": true + }, + "dev_class": "heater_central", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "max_dhw_temperature": { + "lower_bound": 40.0, + "resolution": 0.01, + "setpoint": 60.0, + "upper_bound": 60.0 + }, + "maximum_boiler_temperature": { + "lower_bound": 25.0, + "resolution": 0.01, + "setpoint": 60.0, + "upper_bound": 95.0 + }, + "model": "Generic heater", + "name": "OpenTherm", + "sensors": { + "intended_boiler_temperature": 38.1, + "water_temperature": 37.0 + }, + "switches": { + "dhw_cm_switch": false + } }, "1772a4ea304041adb83f357b751341ff": { + "available": true, "dev_class": "thermo_sensor", "firmware": "2020-11-04T01:00:00+01:00", "hardware": "1", "location": "f871b8c4d63549319221e294e4f88074", "model": "Tom/Floor", "name": "Tom Badkamer", - "zigbee_mac_address": "ABCD012345670A01", - "vendor": "Plugwise", - "available": true, "sensors": { - "temperature": 18.6, "battery": 99, + "temperature": 18.6, "temperature_difference": 2.3, "valve_position": 0.0 - } - }, - "e2f4322d57924fa090fbbc48b3a140dc": { - "dev_class": "zone_thermostat", - "firmware": "2016-10-10T02:00:00+02:00", - "hardware": "255", - "location": "f871b8c4d63549319221e294e4f88074", - "model": "Lisa", - "name": "Lisa Badkamer", - "zigbee_mac_address": "ABCD012345670A04", - "vendor": "Plugwise", - "thermostat": { - "setpoint": 15.0, - "lower_bound": 0.0, - "upper_bound": 99.9, - "resolution": 0.01 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A01" + }, + "ad4838d7d35c4d6ea796ee12ae5aedf8": { + "active_preset": "asleep", "available": true, - "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], - "active_preset": "home", "available_schedules": ["Weekschema", "Badkamer", "Test"], - "selected_schedule": "Badkamer", - "last_used": "Badkamer", - "control_state": "off", - "mode": "auto", + "control_state": "heating", + "dev_class": "thermostat", + "last_used": "Weekschema", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "mode": "heat", + "model": "ThermoTouch", + "name": "Anna", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "None", "sensors": { - "temperature": 17.9, - "battery": 56, - "setpoint": 15.0 - } + "setpoint": 20.0, + "temperature": 19.1 + }, + "thermostat": { + "lower_bound": 1.0, + "resolution": 0.01, + "setpoint": 20.0, + "upper_bound": 35.0 + }, + "vendor": "Plugwise" }, "da224107914542988a88561b4452b0f6": { + "binary_sensors": { + "plugwise_notification": false + }, "dev_class": "gateway", "firmware": "3.6.4", "hardware": "AME Smile 2.0 board", @@ -83,59 +84,61 @@ "mac_address": "012345670001", "model": "Gateway", "name": "Adam", - "zigbee_mac_address": "ABCD012345670101", - "vendor": "Plugwise", "regulation_mode": "heating", "regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"], - "binary_sensors": { - "plugwise_notification": false - }, "sensors": { "outdoor_temperature": -1.25 - } - }, - "056ee145a816487eaa69243c3280f8bf": { - "dev_class": "heater_central", - "location": "bc93488efab249e5bc54fd7e175a6f91", - "model": "Generic heater", - "name": "OpenTherm", - "maximum_boiler_temperature": { - "setpoint": 60.0, - "lower_bound": 25.0, - "upper_bound": 95.0, - "resolution": 0.01 - }, - "domestic_hot_water_setpoint": { - "setpoint": 60.0, - "lower_bound": 40.0, - "upper_bound": 60.0, - "resolution": 0.01 }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670101" + }, + "e2f4322d57924fa090fbbc48b3a140dc": { + "active_preset": "home", "available": true, - "binary_sensors": { - "dhw_state": false, - "heating_state": true, - "flame_state": false - }, + "available_schedules": ["Weekschema", "Badkamer", "Test"], + "control_state": "off", + "dev_class": "zone_thermostat", + "firmware": "2016-10-10T02:00:00+02:00", + "hardware": "255", + "last_used": "Badkamer", + "location": "f871b8c4d63549319221e294e4f88074", + "mode": "auto", + "model": "Lisa", + "name": "Lisa Badkamer", + "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "selected_schedule": "Badkamer", "sensors": { - "water_temperature": 37.0, - "intended_boiler_temperature": 38.1 + "battery": 56, + "setpoint": 15.0, + "temperature": 17.9 }, - "switches": { - "dhw_cm_switch": false - } + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint": 15.0, + "upper_bound": 99.9 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A04" }, "e8ef2a01ed3b4139a53bf749204fe6b4": { "dev_class": "switching", - "model": "Switchgroup", - "name": "Test", "members": [ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], + "model": "Switchgroup", + "name": "Test", "switches": { "relay": true } } + }, + "gateway": { + "cooling_present": false, + "gateway_id": "da224107914542988a88561b4452b0f6", + "heater_id": "056ee145a816487eaa69243c3280f8bf", + "notifications": {}, + "smile_name": "Adam" } -] +} diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json index ba980a7fc..52cd5d381 100644 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json +++ b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json @@ -1,93 +1,93 @@ -[ - { - "smile_name": "Smile Anna", - "gateway_id": "015ae9ea3f964e668e490fa39da3870b", - "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "cooling_present": true, - "notifications": {} - }, - { - "1cbf783bb11e4a7c8a6843dee3a86927": { - "dev_class": "heater_central", +{ + "devices": { + "015ae9ea3f964e668e490fa39da3870b": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "4.0.15", + "hardware": "AME Smile 2.0 board", "location": "a57efe5f145f498c9be62a9b63626fbf", - "model": "Generic heater/cooler", - "name": "OpenTherm", - "vendor": "Techneco", - "maximum_boiler_temperature": { - "setpoint": 60.0, - "lower_bound": 0.0, - "upper_bound": 100.0, - "resolution": 1.0 + "mac_address": "012345670001", + "model": "Gateway", + "name": "Smile Anna", + "sensors": { + "outdoor_temperature": 28.2 }, + "vendor": "Plugwise" + }, + "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, "binary_sensors": { + "compressor_state": true, "cooling_enabled": true, + "cooling_state": true, "dhw_state": false, + "flame_state": false, "heating_state": false, - "compressor_state": true, - "cooling_state": true, - "slave_boiler_state": false, - "flame_state": false + "slave_boiler_state": false }, + "dev_class": "heater_central", + "location": "a57efe5f145f498c9be62a9b63626fbf", + "maximum_boiler_temperature": { + "lower_bound": 0.0, + "resolution": 1.0, + "setpoint": 60.0, + "upper_bound": 100.0 + }, + "model": "Generic heater/cooler", + "name": "OpenTherm", "sensors": { - "water_temperature": 22.7, - "domestic_hot_water_setpoint": 60.0, "dhw_temperature": 41.5, + "domestic_hot_water_setpoint": 60.0, "intended_boiler_temperature": 0.0, "modulation_level": 40, + "outdoor_air_temperature": 28.0, "return_temperature": 23.8, "water_pressure": 1.57, - "outdoor_air_temperature": 28.0 + "water_temperature": 22.7 }, "switches": { "dhw_cm_switch": false - } - }, - "015ae9ea3f964e668e490fa39da3870b": { - "dev_class": "gateway", - "firmware": "4.0.15", - "hardware": "AME Smile 2.0 board", - "location": "a57efe5f145f498c9be62a9b63626fbf", - "mac_address": "012345670001", - "model": "Gateway", - "name": "Smile Anna", - "vendor": "Plugwise", - "binary_sensors": { - "plugwise_notification": false }, - "sensors": { - "outdoor_temperature": 28.2 - } + "vendor": "Techneco" }, "3cb70739631c4d17a86b8b12e8a5161b": { + "active_preset": "home", + "available_schedules": ["standaard"], "dev_class": "thermostat", "firmware": "2018-02-08T11:15:53+01:00", "hardware": "6539-1301-5002", + "last_used": "standaard", "location": "c784ee9fdab44e1395b8dee7d7a497d5", + "mode": "auto", "model": "ThermoTouch", "name": "Anna", - "vendor": "Plugwise", - "thermostat": { - "setpoint_low": 20.5, - "setpoint_high": 24.0, - "lower_bound": 4.0, - "upper_bound": 30.0, - "resolution": 0.1 - }, "preset_modes": ["no_frost", "home", "away", "asleep", "vacation"], - "active_preset": "home", - "available_schedules": ["standaard"], "selected_schedule": "standaard", - "last_used": "standaard", - "mode": "auto", "sensors": { - "temperature": 26.3, - "illuminance": 86.0, "cooling_activation_outdoor_temperature": 21.0, "cooling_deactivation_threshold": 4.0, + "illuminance": 86.0, + "setpoint_high": 24.0, "setpoint_low": 20.5, - "setpoint_high": 24.0 - } + "temperature": 26.3 + }, + "thermostat": { + "lower_bound": 4.0, + "resolution": 0.1, + "setpoint_high": 24.0, + "setpoint_low": 20.5, + "upper_bound": 30.0 + }, + "vendor": "Plugwise" } + }, + "gateway": { + "cooling_present": true, + "gateway_id": "015ae9ea3f964e668e490fa39da3870b", + "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", + "notifications": {}, + "smile_name": "Smile Anna" } -] +} diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json index 0a421be53..e9d9d70d3 100644 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json +++ b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json @@ -1,92 +1,93 @@ -[ - { - "smile_name": "Smile Anna", - "gateway_id": "015ae9ea3f964e668e490fa39da3870b", - "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "cooling_present": true, - "notifications": {} - }, - { - "1cbf783bb11e4a7c8a6843dee3a86927": { - "dev_class": "heater_central", +{ + "devices": { + "015ae9ea3f964e668e490fa39da3870b": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "4.0.15", + "hardware": "AME Smile 2.0 board", "location": "a57efe5f145f498c9be62a9b63626fbf", - "model": "Generic heater/cooler", - "name": "OpenTherm", - "vendor": "Techneco", - "maximum_boiler_temperature": { - "setpoint": 60.0, - "lower_bound": 0.0, - "upper_bound": 100.0, - "resolution": 1.0 + "mac_address": "012345670001", + "model": "Gateway", + "name": "Smile Anna", + "sensors": { + "outdoor_temperature": 28.2 }, + "vendor": "Plugwise" + }, + "1cbf783bb11e4a7c8a6843dee3a86927": { "available": true, "binary_sensors": { + "compressor_state": false, "cooling_enabled": true, + "cooling_state": false, "dhw_state": false, + "flame_state": false, "heating_state": false, - "compressor_state": false, - "cooling_state": false, - "slave_boiler_state": false, - "flame_state": false + "slave_boiler_state": false }, + "dev_class": "heater_central", + "location": "a57efe5f145f498c9be62a9b63626fbf", + "maximum_boiler_temperature": { + "lower_bound": 0.0, + "resolution": 1.0, + "setpoint": 60.0, + "upper_bound": 100.0 + }, + "model": "Generic heater/cooler", + "name": "OpenTherm", "sensors": { - "water_temperature": 19.1, "dhw_temperature": 46.3, + "domestic_hot_water_setpoint": 60.0, "intended_boiler_temperature": 18.0, "modulation_level": 0, + "outdoor_air_temperature": 28.2, "return_temperature": 22.0, "water_pressure": 1.57, - "outdoor_air_temperature": 28.2 + "water_temperature": 19.1 }, "switches": { "dhw_cm_switch": false - } - }, - "015ae9ea3f964e668e490fa39da3870b": { - "dev_class": "gateway", - "firmware": "4.0.15", - "hardware": "AME Smile 2.0 board", - "location": "a57efe5f145f498c9be62a9b63626fbf", - "mac_address": "012345670001", - "model": "Gateway", - "name": "Smile Anna", - "vendor": "Plugwise", - "binary_sensors": { - "plugwise_notification": false }, - "sensors": { - "outdoor_temperature": 28.2 - } + "vendor": "Techneco" }, "3cb70739631c4d17a86b8b12e8a5161b": { + "active_preset": "home", + "available_schedules": ["standaard"], "dev_class": "thermostat", "firmware": "2018-02-08T11:15:53+01:00", "hardware": "6539-1301-5002", + "last_used": "standaard", "location": "c784ee9fdab44e1395b8dee7d7a497d5", + "mode": "auto", "model": "ThermoTouch", "name": "Anna", - "vendor": "Plugwise", - "thermostat": { - "setpoint_low": 20.5, - "setpoint_high": 24.0, - "lower_bound": 4.0, - "upper_bound": 30.0, - "resolution": 0.1 - }, "preset_modes": ["no_frost", "home", "away", "asleep", "vacation"], - "active_preset": "home", - "available_schedules": ["standaard"], "selected_schedule": "standaard", - "last_used": "standaard", - "mode": "auto", "sensors": { - "temperature": 23.0, - "illuminance": 86.0, "cooling_activation_outdoor_temperature": 25.0, "cooling_deactivation_threshold": 4.0, + "illuminance": 86.0, + "setpoint_high": 24.0, "setpoint_low": 20.5, - "setpoint_high": 24.0 - } + "temperature": 23.0 + }, + "thermostat": { + "lower_bound": 4.0, + "resolution": 0.1, + "setpoint_high": 24.0, + "setpoint_low": 20.5, + "upper_bound": 30.0 + }, + "vendor": "Plugwise" } + }, + "gateway": { + "cooling_present": true, + "gateway_id": "015ae9ea3f964e668e490fa39da3870b", + "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", + "notifications": {}, + "smile_name": "Smile Anna" } -] +} diff --git a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json b/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json index c52f33e63..0e0b3c51a 100644 --- a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json +++ b/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json @@ -1,11 +1,9 @@ -[ - { - "smile_name": "Smile P1", - "gateway_id": "cd3e822288064775a7c4afcdd70bdda2", - "notifications": {} - }, - { +{ + "devices": { "cd3e822288064775a7c4afcdd70bdda2": { + "binary_sensors": { + "plugwise_notification": false + }, "dev_class": "gateway", "firmware": "3.3.9", "hardware": "AME Smile 2.0 board", @@ -13,36 +11,38 @@ "mac_address": "012345670001", "model": "Gateway", "name": "Smile P1", - "vendor": "Plugwise", - "binary_sensors": { - "plugwise_notification": false - } + "vendor": "Plugwise" }, "e950c7d5e1ee407a858e2a8b5016c8b3": { + "available": true, "dev_class": "smartmeter", "location": "cd3e822288064775a7c4afcdd70bdda2", "model": "2M550E-1012", "name": "P1", - "vendor": "ISKRAEMECO", - "available": true, "sensors": { - "net_electricity_point": -2816, - "electricity_consumed_peak_point": 0, + "electricity_consumed_off_peak_cumulative": 551.09, + "electricity_consumed_off_peak_interval": 0, "electricity_consumed_off_peak_point": 0, - "net_electricity_cumulative": 442.972, "electricity_consumed_peak_cumulative": 442.932, - "electricity_consumed_off_peak_cumulative": 551.09, "electricity_consumed_peak_interval": 0, - "electricity_consumed_off_peak_interval": 0, - "electricity_produced_peak_point": 2816, + "electricity_consumed_peak_point": 0, + "electricity_produced_off_peak_cumulative": 154.491, + "electricity_produced_off_peak_interval": 0, "electricity_produced_off_peak_point": 0, "electricity_produced_peak_cumulative": 396.559, - "electricity_produced_off_peak_cumulative": 154.491, "electricity_produced_peak_interval": 0, - "electricity_produced_off_peak_interval": 0, + "electricity_produced_peak_point": 2816, "gas_consumed_cumulative": 584.85, - "gas_consumed_interval": 0.0 - } + "gas_consumed_interval": 0.0, + "net_electricity_cumulative": 442.972, + "net_electricity_point": -2816 + }, + "vendor": "ISKRAEMECO" } + }, + "gateway": { + "gateway_id": "cd3e822288064775a7c4afcdd70bdda2", + "notifications": {}, + "smile_name": "Smile P1" } -] +} diff --git a/tests/components/plugwise/fixtures/p1v4_3ph/all_data.json b/tests/components/plugwise/fixtures/p1v4_442_triple/all_data.json similarity index 88% rename from tests/components/plugwise/fixtures/p1v4_3ph/all_data.json rename to tests/components/plugwise/fixtures/p1v4_442_triple/all_data.json index 852ca2857..e9a3b4c68 100644 --- a/tests/components/plugwise/fixtures/p1v4_3ph/all_data.json +++ b/tests/components/plugwise/fixtures/p1v4_442_triple/all_data.json @@ -1,11 +1,9 @@ -[ - { - "smile_name": "Smile P1", - "gateway_id": "03e65b16e4b247a29ae0d75a78cb492e", - "notifications": {} - }, - { +{ + "devices": { "03e65b16e4b247a29ae0d75a78cb492e": { + "binary_sensors": { + "plugwise_notification": false + }, "dev_class": "gateway", "firmware": "4.4.2", "hardware": "AME Smile 2.0 board", @@ -13,45 +11,47 @@ "mac_address": "012345670001", "model": "Gateway", "name": "Smile P1", - "vendor": "Plugwise", - "binary_sensors": { - "plugwise_notification": false - } + "vendor": "Plugwise" }, "b82b6b3322484f2ea4e25e0bd5f3d61f": { + "available": true, "dev_class": "smartmeter", "location": "03e65b16e4b247a29ae0d75a78cb492e", "model": "XMX5LGF0010453051839", "name": "P1", - "vendor": "XEMEX NV", - "available": true, "sensors": { - "net_electricity_point": 5553, - "electricity_consumed_peak_point": 0, + "electricity_consumed_off_peak_cumulative": 70537.898, + "electricity_consumed_off_peak_interval": 314, "electricity_consumed_off_peak_point": 5553, - "net_electricity_cumulative": 231866.539, "electricity_consumed_peak_cumulative": 161328.641, - "electricity_consumed_off_peak_cumulative": 70537.898, "electricity_consumed_peak_interval": 0, - "electricity_consumed_off_peak_interval": 314, - "electricity_produced_peak_point": 0, - "electricity_produced_off_peak_point": 0, - "electricity_produced_peak_cumulative": 0.0, - "electricity_produced_off_peak_cumulative": 0.0, - "electricity_produced_peak_interval": 0, - "electricity_produced_off_peak_interval": 0, + "electricity_consumed_peak_point": 0, "electricity_phase_one_consumed": 1763, - "electricity_phase_two_consumed": 1703, - "electricity_phase_three_consumed": 2080, "electricity_phase_one_produced": 0, - "electricity_phase_two_produced": 0, + "electricity_phase_three_consumed": 2080, "electricity_phase_three_produced": 0, + "electricity_phase_two_consumed": 1703, + "electricity_phase_two_produced": 0, + "electricity_produced_off_peak_cumulative": 0.0, + "electricity_produced_off_peak_interval": 0, + "electricity_produced_off_peak_point": 0, + "electricity_produced_peak_cumulative": 0.0, + "electricity_produced_peak_interval": 0, + "electricity_produced_peak_point": 0, "gas_consumed_cumulative": 16811.37, "gas_consumed_interval": 0.06, + "net_electricity_cumulative": 231866.539, + "net_electricity_point": 5553, "voltage_phase_one": 233.2, - "voltage_phase_two": 234.4, - "voltage_phase_three": 234.7 - } + "voltage_phase_three": 234.7, + "voltage_phase_two": 234.4 + }, + "vendor": "XEMEX NV" } + }, + "gateway": { + "gateway_id": "03e65b16e4b247a29ae0d75a78cb492e", + "notifications": {}, + "smile_name": "Smile P1" } -] +} diff --git a/tests/components/plugwise/fixtures/p1v4_3ph/notifications.json b/tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json similarity index 100% rename from tests/components/plugwise/fixtures/p1v4_3ph/notifications.json rename to tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json diff --git a/tests/components/plugwise/fixtures/stretch_v31/all_data.json b/tests/components/plugwise/fixtures/stretch_v31/all_data.json index 1ce34e376..c336a9cb9 100644 --- a/tests/components/plugwise/fixtures/stretch_v31/all_data.json +++ b/tests/components/plugwise/fixtures/stretch_v31/all_data.json @@ -1,10 +1,5 @@ -[ - { - "smile_name": "Stretch", - "gateway_id": "0000aaaa0000aaaa0000aaaa0000aa00", - "notifications": {} - }, - { +{ + "devices": { "0000aaaa0000aaaa0000aaaa0000aa00": { "dev_class": "gateway", "firmware": "3.1.11", @@ -12,8 +7,27 @@ "mac_address": "01:23:45:67:89:AB", "model": "Gateway", "name": "Stretch", - "zigbee_mac_address": "ABCD012345670101", - "vendor": "Plugwise" + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670101" + }, + "059e4d03c7a34d278add5c7a4a781d19": { + "dev_class": "washingmachine", + "firmware": "2011-06-27T10:52:18+02:00", + "hardware": "0000-0440-0107", + "location": "0000aaaa0000aaaa0000aaaa0000aa00", + "model": "Circle type F", + "name": "Wasmachine (52AC1)", + "sensors": { + "electricity_consumed": 0.0, + "electricity_consumed_interval": 0.0, + "electricity_produced": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A01" }, "5871317346d045bc9f6b987ef25ee638": { "dev_class": "water_heater_vessel", @@ -22,35 +36,25 @@ "location": "0000aaaa0000aaaa0000aaaa0000aa00", "model": "Circle type F", "name": "Boiler (1EB31)", - "zigbee_mac_address": "ABCD012345670A07", - "vendor": "Plugwise", "sensors": { "electricity_consumed": 1.19, "electricity_consumed_interval": 0.0, "electricity_produced": 0.0 }, "switches": { - "relay": true, - "lock": false - } - }, - "e1c884e7dede431dadee09506ec4f859": { - "dev_class": "refrigerator", - "firmware": "2011-06-27T10:47:37+02:00", - "hardware": "6539-0700-7330", - "location": "0000aaaa0000aaaa0000aaaa0000aa00", - "model": "Circle+ type F", - "name": "Koelkast (92C4A)", - "zigbee_mac_address": "0123456789AB", - "vendor": "Plugwise", - "sensors": { - "electricity_consumed": 50.5, - "electricity_consumed_interval": 0.08, - "electricity_produced": 0.0 + "lock": false, + "relay": true }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A07" + }, + "71e1944f2a944b26ad73323e399efef0": { + "dev_class": "switching", + "members": ["5ca521ac179d468e91d772eeeb8a2117"], + "model": "Switchgroup", + "name": "Test", "switches": { - "relay": true, - "lock": false + "relay": true } }, "aac7b735042c4832ac9ff33aae4f453b": { @@ -60,17 +64,17 @@ "location": "0000aaaa0000aaaa0000aaaa0000aa00", "model": "Circle type F", "name": "Vaatwasser (2a1ab)", - "zigbee_mac_address": "ABCD012345670A02", - "vendor": "Plugwise", "sensors": { "electricity_consumed": 0.0, "electricity_consumed_interval": 0.71, "electricity_produced": 0.0 }, "switches": { - "relay": true, - "lock": false - } + "lock": false, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A02" }, "cfe95cf3de1948c0b8955125bf754614": { "dev_class": "dryer", @@ -79,50 +83,32 @@ "location": "0000aaaa0000aaaa0000aaaa0000aa00", "model": "Circle type F", "name": "Droger (52559)", - "zigbee_mac_address": "ABCD012345670A04", - "vendor": "Plugwise", "sensors": { "electricity_consumed": 0.0, "electricity_consumed_interval": 0.0, "electricity_produced": 0.0 }, "switches": { - "relay": true, - "lock": false - } - }, - "059e4d03c7a34d278add5c7a4a781d19": { - "dev_class": "washingmachine", - "firmware": "2011-06-27T10:52:18+02:00", - "hardware": "0000-0440-0107", - "location": "0000aaaa0000aaaa0000aaaa0000aa00", - "model": "Circle type F", - "name": "Wasmachine (52AC1)", - "zigbee_mac_address": "ABCD012345670A01", - "vendor": "Plugwise", - "sensors": { - "electricity_consumed": 0.0, - "electricity_consumed_interval": 0.0, - "electricity_produced": 0.0 + "lock": false, + "relay": true }, - "switches": { - "relay": true, - "lock": false - } + "vendor": "Plugwise", + "zigbee_mac_address": "ABCD012345670A04" }, - "71e1944f2a944b26ad73323e399efef0": { + "d03738edfcc947f7b8f4573571d90d2d": { "dev_class": "switching", + "members": [ + "059e4d03c7a34d278add5c7a4a781d19", + "cfe95cf3de1948c0b8955125bf754614" + ], "model": "Switchgroup", - "name": "Test", - "members": ["5ca521ac179d468e91d772eeeb8a2117"], + "name": "Schakel", "switches": { "relay": true } }, "d950b314e9d8499f968e6db8d82ef78c": { "dev_class": "report", - "model": "Switchgroup", - "name": "Stroomvreters", "members": [ "059e4d03c7a34d278add5c7a4a781d19", "5871317346d045bc9f6b987ef25ee638", @@ -130,21 +116,35 @@ "cfe95cf3de1948c0b8955125bf754614", "e1c884e7dede431dadee09506ec4f859" ], + "model": "Switchgroup", + "name": "Stroomvreters", "switches": { "relay": true } }, - "d03738edfcc947f7b8f4573571d90d2d": { - "dev_class": "switching", - "model": "Switchgroup", - "name": "Schakel", - "members": [ - "059e4d03c7a34d278add5c7a4a781d19", - "cfe95cf3de1948c0b8955125bf754614" - ], + "e1c884e7dede431dadee09506ec4f859": { + "dev_class": "refrigerator", + "firmware": "2011-06-27T10:47:37+02:00", + "hardware": "6539-0700-7330", + "location": "0000aaaa0000aaaa0000aaaa0000aa00", + "model": "Circle+ type F", + "name": "Koelkast (92C4A)", + "sensors": { + "electricity_consumed": 50.5, + "electricity_consumed_interval": 0.08, + "electricity_produced": 0.0 + }, "switches": { + "lock": false, "relay": true - } + }, + "vendor": "Plugwise", + "zigbee_mac_address": "0123456789AB" } + }, + "gateway": { + "gateway_id": "0000aaaa0000aaaa0000aaaa0000aa00", + "notifications": {}, + "smile_name": "Stretch" } -] +} diff --git a/tests/components/plugwise/test_climate.py b/tests/components/plugwise/test_climate.py index 881d3fd27..a20830e8c 100644 --- a/tests/components/plugwise/test_climate.py +++ b/tests/components/plugwise/test_climate.py @@ -35,7 +35,7 @@ async def test_adam_climate_entity_attributes( assert state.attributes["temperature"] == 21.5 assert state.attributes["min_temp"] == 0.0 assert state.attributes["max_temp"] == 99.9 - assert state.attributes["target_temp_step"] == 0.1 + assert state.attributes["target_temp_step"] == 0.5 state = hass.states.get("climate.zone_thermostat_jessie") assert state @@ -52,7 +52,7 @@ async def test_adam_climate_entity_attributes( assert state.attributes["temperature"] == 15.0 assert state.attributes["min_temp"] == 0.0 assert state.attributes["max_temp"] == 99.9 - assert state.attributes["target_temp_step"] == 0.1 + assert state.attributes["target_temp_step"] == 0.5 async def test_adam_2_climate_entity_attributes( @@ -200,7 +200,7 @@ async def test_anna_climate_entity_attributes( assert state.attributes["temperature"] == 20.5 assert state.attributes["min_temp"] == 4.0 assert state.attributes["max_temp"] == 30.0 - assert state.attributes["target_temp_step"] == 0.1 + assert state.attributes["target_temp_step"] == 0.5 async def test_anna_2_climate_entity_attributes( diff --git a/tests/components/plugwise/test_number.py b/tests/components/plugwise/test_number.py index f2a42bb1d..3f70e3a64 100644 --- a/tests/components/plugwise/test_number.py +++ b/tests/components/plugwise/test_number.py @@ -58,5 +58,5 @@ async def test_adam_dhw_setpoint_change( assert mock_smile_adam_2.set_number_setpoint.call_count == 1 mock_smile_adam_2.set_number_setpoint.assert_called_with( - "domestic_hot_water_setpoint", 55.0 + "max_dhw_temperature", 55.0 )