diff --git a/homeassistant/components/bsblan/__init__.py b/homeassistant/components/bsblan/__init__.py index 6ee58989150..0ef3ed159a6 100644 --- a/homeassistant/components/bsblan/__init__.py +++ b/homeassistant/components/bsblan/__init__.py @@ -1,7 +1,7 @@ """The BSB-Lan integration.""" import dataclasses -from bsblan import BSBLAN, Device, Info, State +from bsblan import BSBLAN, Device, Info, State, StaticState from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -28,6 +28,7 @@ class HomeAssistantBSBLANData: client: BSBLAN device: Device info: Info + static: StaticState async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: @@ -54,11 +55,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: device = await bsblan.device() info = await bsblan.info() + static = await bsblan.static_values() hass.data.setdefault(DOMAIN, {})[entry.entry_id] = HomeAssistantBSBLANData( client=bsblan, coordinator=coordinator, device=device, info=info, + static=static, ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/bsblan/climate.py b/homeassistant/components/bsblan/climate.py index e9774055a85..acf9ee25c57 100644 --- a/homeassistant/components/bsblan/climate.py +++ b/homeassistant/components/bsblan/climate.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any -from bsblan import BSBLAN, BSBLANError, Device, Info, State +from bsblan import BSBLAN, BSBLANError, Device, Info, State, StaticState from homeassistant.components.climate import ( ATTR_HVAC_MODE, @@ -15,7 +15,7 @@ from homeassistant.components.climate import ( HVACMode, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT +from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import format_mac from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -56,6 +56,7 @@ async def async_setup_entry( data.client, data.device, data.info, + data.static, entry, ) ], @@ -83,20 +84,21 @@ class BSBLANClimate(BSBLANEntity, CoordinatorEntity, ClimateEntity): client: BSBLAN, device: Device, info: Info, + static: StaticState, entry: ConfigEntry, ) -> None: """Initialize BSBLAN climate device.""" - super().__init__(client, device, info, entry) + super().__init__(client, device, info, static, entry) CoordinatorEntity.__init__(self, coordinator) self._attr_unique_id = f"{format_mac(device.MAC)}-climate" - self._attr_min_temp = float(self.coordinator.data.min_temp.value) - self._attr_max_temp = float(self.coordinator.data.max_temp.value) - self._attr_temperature_unit = ( - TEMP_CELSIUS - if self.coordinator.data.current_temperature.unit == "°C" - else TEMP_FAHRENHEIT - ) + self._attr_min_temp = float(static.min_temp.value) + self._attr_max_temp = float(static.max_temp.value) + # check if self.coordinator.data.current_temperature.unit is "°C" or "°C" + if self.coordinator.data.current_temperature.unit in ("°C", "°C"): + self._attr_temperature_unit = UnitOfTemperature.CELSIUS + else: + self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT @property def current_temperature(self) -> float | None: diff --git a/homeassistant/components/bsblan/entity.py b/homeassistant/components/bsblan/entity.py index 3e8a493d53b..c9b2a2ae9ae 100644 --- a/homeassistant/components/bsblan/entity.py +++ b/homeassistant/components/bsblan/entity.py @@ -1,7 +1,7 @@ """Base entity for the BSBLAN integration.""" from __future__ import annotations -from bsblan import BSBLAN, Device, Info +from bsblan import BSBLAN, Device, Info, StaticState from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST @@ -19,6 +19,7 @@ class BSBLANEntity(Entity): client: BSBLAN, device: Device, info: Info, + static: StaticState, entry: ConfigEntry, ) -> None: """Initialize an BSBLAN entity.""" diff --git a/homeassistant/components/bsblan/manifest.json b/homeassistant/components/bsblan/manifest.json index 87fb7f8c08f..810e78872f3 100644 --- a/homeassistant/components/bsblan/manifest.json +++ b/homeassistant/components/bsblan/manifest.json @@ -3,7 +3,7 @@ "name": "BSB-Lan", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/bsblan", - "requirements": ["python-bsblan==0.5.7"], + "requirements": ["python-bsblan==0.5.8"], "codeowners": ["@liudger"], "iot_class": "local_polling", "loggers": ["bsblan"] diff --git a/requirements_all.txt b/requirements_all.txt index b074d8f6609..efd2532b1d7 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1970,7 +1970,7 @@ pythinkingcleaner==0.0.3 python-blockchain-api==0.0.2 # homeassistant.components.bsblan -python-bsblan==0.5.7 +python-bsblan==0.5.8 # homeassistant.components.clementine python-clementine-remote==1.0.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index dc787936298..3aa97a375c0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1390,7 +1390,7 @@ pytankerkoenig==0.0.6 pytautulli==21.11.0 # homeassistant.components.bsblan -python-bsblan==0.5.7 +python-bsblan==0.5.8 # homeassistant.components.ecobee python-ecobee-api==0.2.14 diff --git a/tests/components/bsblan/fixtures/diagnostics.json b/tests/components/bsblan/fixtures/diagnostics.json index b805a3b0b1b..bd05aca56d5 100644 --- a/tests/components/bsblan/fixtures/diagnostics.json +++ b/tests/components/bsblan/fixtures/diagnostics.json @@ -50,34 +50,6 @@ "value": "18.5", "dataType": 0 }, - "target_temperature_high": { - "name": "Komfortsollwert Maximum", - "unit": "°C", - "desc": "", - "value": "23.0", - "dataType": 0 - }, - "target_temperature_low": { - "name": "Room temp reduced setpoint", - "unit": "°C", - "desc": "", - "value": "17.0", - "dataType": 0 - }, - "min_temp": { - "name": "Room temp frost protection setpoint", - "unit": "°C", - "desc": "", - "value": "8.0", - "dataType": 0 - }, - "max_temp": { - "name": "Summer/winter changeover temp heat circuit 1", - "unit": "°C", - "desc": "", - "value": "20.0", - "dataType": 0 - }, "hvac_action": { "name": "Status heating circuit 1", "unit": "", @@ -98,13 +70,6 @@ "desc": "Kein Bedarf", "value": "0", "dataType": 1 - }, - "outside_temperature": { - "name": "Outside temp sensor local", - "unit": "°C", - "desc": "", - "value": "6.1", - "dataType": 0 } } }