Skip to content

Commit

Permalink
Merge pull request #468 from WillCodeForCats/new-entity-checks
Browse files Browse the repository at this point in the history
Raise TypeError from struct.error in helper
  • Loading branch information
WillCodeForCats authored Nov 15, 2023
2 parents 6e549f2 + f08890d commit 6c205f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/solaredge_modbus_multi/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ def scale_factor(value: int, sf: int):


def float_to_hex(f):
return hex(struct.unpack("<I", struct.pack("<f", f))[0])
try:
return hex(struct.unpack("<I", struct.pack("<f", f))[0])
except struct.error as e:
raise TypeError(e)


def parse_modbus_string(s: str) -> str:
Expand Down

0 comments on commit 6c205f9

Please sign in to comment.