Update nibe heatpump to 2.5.0 (#103788)
* Update nibe heatpump to 2.5.0 * Adjust for typing changes in lib * If we use float value, we assume it's valid
This commit is contained in:
parent
eda475fe25
commit
5ee62f2965
7 changed files with 12 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
"""The Nibe Heat Pump climate."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
from typing import Any
|
||||
|
||||
from nibe.coil import Coil
|
||||
|
@ -124,7 +125,7 @@ class NibeClimateEntity(CoordinatorEntity[Coordinator], ClimateEntity):
|
|||
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
def _get_value(coil: Coil) -> int | str | float | None:
|
||||
def _get_value(coil: Coil) -> int | str | float | date | None:
|
||||
return self.coordinator.get_coil_value(coil)
|
||||
|
||||
def _get_float(coil: Coil) -> float | None:
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable
|
||||
from datetime import timedelta
|
||||
from datetime import date, timedelta
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from nibe.coil import Coil, CoilData
|
||||
|
@ -123,7 +123,7 @@ class Coordinator(ContextCoordinator[dict[int, CoilData], int]):
|
|||
"""Return device information for the main device."""
|
||||
return DeviceInfo(identifiers={(DOMAIN, self.unique_id)})
|
||||
|
||||
def get_coil_value(self, coil: Coil) -> int | str | float | None:
|
||||
def get_coil_value(self, coil: Coil) -> int | str | float | date | None:
|
||||
"""Return a coil with data and check for validity."""
|
||||
if coil_with_data := self.data.get(coil.address):
|
||||
return coil_with_data.value
|
||||
|
@ -132,7 +132,7 @@ class Coordinator(ContextCoordinator[dict[int, CoilData], int]):
|
|||
def get_coil_float(self, coil: Coil) -> float | None:
|
||||
"""Return a coil with float and check for validity."""
|
||||
if value := self.get_coil_value(coil):
|
||||
return float(value)
|
||||
return float(value) # type: ignore[arg-type]
|
||||
return None
|
||||
|
||||
async def async_write_coil(self, coil: Coil, value: int | float | str) -> None:
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/nibe_heatpump",
|
||||
"iot_class": "local_polling",
|
||||
"requirements": ["nibe==2.4.0"]
|
||||
"requirements": ["nibe==2.5.0"]
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class Number(CoilEntity, NumberEntity):
|
|||
return
|
||||
|
||||
try:
|
||||
self._attr_native_value = float(data.value)
|
||||
self._attr_native_value = float(data.value) # type: ignore[arg-type]
|
||||
except ValueError:
|
||||
self._attr_native_value = None
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""The Nibe Heat Pump sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from nibe.coil import Coil
|
||||
from nibe.coil_groups import WATER_HEATER_COILGROUPS, WaterHeaterCoilGroup
|
||||
from nibe.exceptions import CoilNotFoundException
|
||||
|
@ -132,7 +134,7 @@ class WaterHeater(CoordinatorEntity[Coordinator], WaterHeaterEntity):
|
|||
return None
|
||||
return self.coordinator.get_coil_float(coil)
|
||||
|
||||
def _get_value(coil: Coil | None) -> int | str | float | None:
|
||||
def _get_value(coil: Coil | None) -> int | str | float | date | None:
|
||||
if coil is None:
|
||||
return None
|
||||
return self.coordinator.get_coil_value(coil)
|
||||
|
|
|
@ -1311,7 +1311,7 @@ nextcord==2.0.0a8
|
|||
nextdns==2.0.1
|
||||
|
||||
# homeassistant.components.nibe_heatpump
|
||||
nibe==2.4.0
|
||||
nibe==2.5.0
|
||||
|
||||
# homeassistant.components.niko_home_control
|
||||
niko-home-control==0.2.1
|
||||
|
|
|
@ -1025,7 +1025,7 @@ nextcord==2.0.0a8
|
|||
nextdns==2.0.1
|
||||
|
||||
# homeassistant.components.nibe_heatpump
|
||||
nibe==2.4.0
|
||||
nibe==2.5.0
|
||||
|
||||
# homeassistant.components.nfandroidtv
|
||||
notifications-android-tv==0.1.5
|
||||
|
|
Loading…
Add table
Reference in a new issue