mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add support for BSBLAN firmware v3 (#82288)
* bump python-bsblan version to 0.5.8 * add static_state this holds values that only needs retrieving once in a while * update diagnostics json with the right info
This commit is contained in:
parent
cad04bff99
commit
949dede16b
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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."""
|
||||
|
@ -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"]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user