Skip to content

Commit c8e287c

Browse files
committed
Move get_vendor_name() to util.py
1 parent 25b87b8 commit c8e287c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

plugwise/common.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,12 @@
55
from __future__ import annotations
66

77
from plugwise.constants import ModelData
8-
from plugwise.util import check_heater_central, check_model
8+
from plugwise.util import check_heater_central, check_model, get_vendor_name
99

1010
from defusedxml import ElementTree as etree
1111
from munch import Munch
1212

1313

14-
def get_vendor_name(module: etree, model_data: ModelData) -> ModelData:
15-
"""Helper-function for _get_model_data()."""
16-
if (vendor_name := module.find("vendor_name").text) is not None:
17-
model_data["vendor_name"] = vendor_name
18-
if "Plugwise" in vendor_name:
19-
model_data["vendor_name"] = vendor_name.split(" ", 1)[0]
20-
21-
return model_data
22-
23-
2414
class SmileCommon:
2515
"""The SmileCommon class."""
2616

plugwise/util.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
SPECIAL_FORMAT,
1414
TEMP_CELSIUS,
1515
DeviceData,
16+
ModelData,
1617
)
1718

1819
from defusedxml import ElementTree as etree
@@ -89,6 +90,16 @@ def format_measure(measure: str, unit: str) -> float | int:
8990
return result
9091

9192

93+
def get_vendor_name(module: etree, model_data: ModelData) -> ModelData:
94+
"""Helper-function for _get_model_data()."""
95+
if (vendor_name := module.find("vendor_name").text) is not None:
96+
model_data["vendor_name"] = vendor_name
97+
if "Plugwise" in vendor_name:
98+
model_data["vendor_name"] = vendor_name.split(" ", 1)[0]
99+
100+
return model_data
101+
102+
92103
def power_data_local_format(
93104
attrs: dict[str, str], key_string: str, val: str
94105
) -> float | int:

0 commit comments

Comments
 (0)