File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed
Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 2020 DEVICE_MEASUREMENTS ,
2121 DHW_SETPOINT ,
2222 DOMAIN_OBJECTS ,
23- ENERGY_KILO_WATT_HOUR ,
2423 ENERGY_WATT_HOUR ,
2524 HEATER_CENTRAL_MEASUREMENTS ,
2625 LIMITS ,
3029 OBSOLETE_MEASUREMENTS ,
3130 OFF ,
3231 P1_MEASUREMENTS ,
33- POWER_WATT ,
3432 SENSORS ,
3533 SPECIAL_PLUG_TYPES ,
3634 SPECIALS ,
6159 ResponseError ,
6260)
6361from plugwise .util import (
62+ check_model ,
6463 escape_illegal_xml_characters ,
6564 format_measure ,
6665 power_data_local_format ,
67- version_to_model ,
6866)
6967
7068# This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts)
7775from munch import Munch
7876
7977
80- def check_model (name : str | None , vendor_name : str | None ) -> str | None :
81- """Model checking before using version_to_model."""
82- if vendor_name == "Plugwise" and ((model := version_to_model (name )) != "Unknown" ):
83- return model
84-
85- return name
86-
87-
8878class SmileComm :
8979 """The SmileComm class."""
9080
Original file line number Diff line number Diff line change 1717 BINARY_SENSORS ,
1818 DATA ,
1919 DEVICE_MEASUREMENTS ,
20- ENERGY_KILO_WATT_HOUR ,
2120 ENERGY_WATT_HOUR ,
2221 FAKE_APPL ,
2322 FAKE_LOC ,
2625 NONE ,
2726 OBSOLETE_MEASUREMENTS ,
2827 P1_LEGACY_MEASUREMENTS ,
29- POWER_WATT ,
3028 SENSORS ,
3129 SPECIAL_PLUG_TYPES ,
3230 SPECIALS ,
Original file line number Diff line number Diff line change 44import re
55
66from plugwise .constants import (
7+ ATTR_UNIT_OF_MEASUREMENT ,
78 ELECTRIC_POTENTIAL_VOLT ,
89 ENERGY_KILO_WATT_HOUR ,
910 HW_MODELS ,
1011 PERCENTAGE ,
12+ POWER_WATT ,
1113 SPECIAL_FORMAT ,
1214 TEMP_CELSIUS ,
1315 DeviceData ,
1416)
1517
1618
19+ def check_model (name : str | None , vendor_name : str | None ) -> str | None :
20+ """Model checking before using version_to_model."""
21+ if vendor_name == "Plugwise" and ((model := version_to_model (name )) != "Unknown" ):
22+ return model
23+
24+ return name
25+
26+
1727def escape_illegal_xml_characters (xmldata : str ) -> str :
1828 """Replace illegal &-characters."""
1929 return re .sub (r"&([^a-zA-Z#])" , r"&\1" , xmldata )
You can’t perform that action at this time.
0 commit comments