Skip to content

Commit

Permalink
formated everything using black
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouni committed Apr 12, 2022
1 parent 4add370 commit cf66031
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion luxtronik/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def parse(self, raw_data):
calculation.value = calculation.from_heatpump(data)
continue
if calculation is not False and index in range(81, 91):
calculation.value = calculation.from_heatpump(raw_data[index : index + 9])
calculation.value = calculation.from_heatpump(
raw_data[index : index + 9]
)
continue
if calculation is False and index not in range(81, 91):
LOGGER.warning("Calculation '%d' not in list of calculationss", index)
Expand Down
11 changes: 5 additions & 6 deletions luxtronik/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ class IPAddress(Base):

def from_heatpump(self, value):
if value < 0:
return str(ipaddress.IPv4Address(value + 2 ** 32))
if value > 2 ** 32:
return str(ipaddress.IPv4Address(value - 2 ** 32))
return str(ipaddress.IPv4Address(value + 2**32))
if value > 2**32:
return str(ipaddress.IPv4Address(value - 2**32))
return str(ipaddress.IPv4Address(value))

def to_heatpump(self, value):
result = int(ipaddress.IPv4Address(value))
if result > 2 ** 32:
return result - 2 ** 32
if result > 2**32:
return result - 2**32
return result


Expand All @@ -121,7 +121,6 @@ def from_heatpump(self, value):
return datetime.datetime.fromtimestamp(value)
return datetime.datetime.fromtimestamp(0)


def to_heatpump(self, value):
return datetime.datetime.timestamp(value)

Expand Down

0 comments on commit cf66031

Please sign in to comment.