Skip to content

Commit

Permalink
Update base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
azerty9971 committed Sep 1, 2024
1 parent 7edb44b commit b53d881
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions homeassistant/components/tuya/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ def from_json(cls, data: str) -> Self:
def from_raw(cls, data: str) -> Self:
"""Decode base64 string and return a ElectricityTypeData object."""
raw = base64.b64decode(data)
if len(raw) < 8:
return cls(electriccurrent=None, power=None, voltage=None)
voltage = struct.unpack(">H", raw[0:2])[0] / 10.0
electriccurrent = struct.unpack(">L", b"\x00" + raw[2:5])[0] / 1000.0
power = struct.unpack(">L", b"\x00" + raw[5:8])[0] / 1000.0
Expand Down

0 comments on commit b53d881

Please sign in to comment.