File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -519,8 +519,11 @@ def _get_actuator_functionalities(
519519 key = "setpoint"
520520
521521 act_key = cast (ActuatorDataType , key )
522- temp_dict [act_key ] = format_measure (pw_function .text , TEMP_CELSIUS )
523522 self ._count += 1
523+ try :
524+ temp_dict [act_key ] = format_measure (pw_function .text , TEMP_CELSIUS )
525+ except ValueError :
526+ temp_dict [act_key ] = str (pw_function .text )
524527
525528 if temp_dict :
526529 # If domestic_hot_water_setpoint is present as actuator,
Original file line number Diff line number Diff line change @@ -193,13 +193,9 @@ def escape_illegal_xml_characters(xmldata: str) -> str:
193193 return re .sub (r"&([^a-zA-Z#])" , r"&\1" , xmldata )
194194
195195
196- def format_measure (measure : str , unit : str ) -> float | int | str :
196+ def format_measure (measure : str , unit : str ) -> float | int :
197197 """Format measure to correct type."""
198- try :
199- float_measure = float (measure )
200- except ValueError :
201- return measure # return string
202-
198+ float_measure = float (measure )
203199 if unit == PERCENTAGE and 0 < float_measure <= 1 :
204200 return int (float_measure * 100 )
205201
You can’t perform that action at this time.
0 commit comments