Skip to content

Commit 7e594a8

Browse files
Fix bad print statements
1 parent 0012240 commit 7e594a8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

pwmon.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ def run_from_cli():
319319
start = time.time()
320320
try:
321321
data = get_data()
322-
ret = post_metrics(data)
322+
#ret = post_metrics(data)
323323

324324
print('Submitted at', dt.now())
325325
except APIError as apiEx:
326-
print('Powerwall API Error: %s', apiEx)
326+
print(apiEx)
327327
# If this is an HTTP 429, back off immediately for at least 5 minutes
328328
if str(apiEx).find('429: Too Many Requests') > 0:
329329
FIVE_MINUTES = 5 * 60
@@ -332,17 +332,16 @@ def run_from_cli():
332332
backoffInterval = POLL_INTERVAL * 3
333333
if backoffInterval < FIVE_MINUTES:
334334
backoffInterval = FIVE_MINUTES
335-
print('Backing off for %s seconds because of HTTP 429...', backoffInterval - elapsed)
335+
print('Backing off for', round(backoffInterval - elapsed, 0), 'seconds because of HTTP 429.')
336336
time.sleep(backoffInterval - elapsed)
337337
# Determine if we need to wait until the start of the minute again
338338
if POLL_INTERVAL % 60 == 0 and AS_SERVICE:
339339
wait_time = 60 - time.localtime().tm_sec
340340
time.sleep(wait_time)
341341
# Reset the start time to coincide with the top of the minute
342342
start = time.time()
343-
print(' Done.')
344343
except Exception as ex:
345-
print('Failed to gather data: %s', ex)
344+
print('Failed to gather data:', ex)
346345

347346
if not AS_SERVICE:
348347
run_from_cli()

0 commit comments

Comments
 (0)