mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add more typing to DSMR Reader (#118852)
This commit is contained in:
parent
357cc7d4cc
commit
985e42e50c
@ -25,14 +25,14 @@ PRICE_EUR_KWH: Final = f"EUR/{UnitOfEnergy.KILO_WATT_HOUR}"
|
||||
PRICE_EUR_M3: Final = f"EUR/{UnitOfVolume.CUBIC_METERS}"
|
||||
|
||||
|
||||
def dsmr_transform(value):
|
||||
def dsmr_transform(value: str) -> float | str:
|
||||
"""Transform DSMR version value to right format."""
|
||||
if value.isdigit():
|
||||
return float(value) / 10
|
||||
return value
|
||||
|
||||
|
||||
def tariff_transform(value):
|
||||
def tariff_transform(value: str) -> str:
|
||||
"""Transform tariff from number to description."""
|
||||
if value == "1":
|
||||
return "low"
|
||||
|
Loading…
x
Reference in New Issue
Block a user