Skip to content

Commit

Permalink
refactor: Removed unnecessary code from api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Aug 5, 2024
1 parent e3d93bd commit 4936d73
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions custom_components/solarman/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def available(self):
return self.status > -1

async def async_connect(self, loud = True) -> None:
if self.reader_task:
_LOGGER.debug(f"Reader Task done: {self.reader_task.done()}, cancelled: {self.reader_task.cancelled()}.")
if not self.reader_task: #if not self.reader_task or self.reader_task.done() or self.reader_task.cancelled():
if not self.reader_task:
if loud:
_LOGGER.info(f"Connecting to {self.address}:{self.port}")
await self.connect()
Expand Down Expand Up @@ -138,7 +136,7 @@ async def async_get(self, runtime = 0):
params = ParameterParser(self.parameter_definition)
requests = params.get_requests(runtime)
requests_count = len(requests)
results = [1] * requests_count
results = [0] * requests_count

_LOGGER.debug(f"Scheduling {requests_count} query requests. #{runtime}")

Expand All @@ -149,7 +147,6 @@ async def async_get(self, runtime = 0):
code = get_request_code(request)
start = get_request_start(request)
end = get_request_end(request)
results[i] = 0

_LOGGER.debug(f"Querying ({start} - {end}) ...")

Expand Down

0 comments on commit 4936d73

Please sign in to comment.