Skip to content

Commit

Permalink
special case for when the lowest slot is now.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerbzz committed Oct 9, 2021
1 parent 8cdd3f4 commit 66c2258
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions eco_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,14 @@ def update_inky(conf: dict, inky_data: dict, demo: bool):
min_slot_timedelta = datetime.strptime(
inky_data[low_slots_start_idx][0],
"%Y-%m-%d %H:%M:%S") - datetime.strptime(inky_data[0][0], "%Y-%m-%d %H:%M:%S")

draw.text((x_pos, y_pos), low_slots_start_time + "/" +
str(min_slot_timedelta.total_seconds() / 3600) +
"h ", inky_display.BLACK, font)

if min_slot_timedelta.total_seconds() > 1800:
draw.text((x_pos, y_pos), low_slots_start_time + "/" +
str(min_slot_timedelta.total_seconds() / 3600) +
"h ", inky_display.BLACK, font)
else:
font = ImageFont.truetype(RobotoMedium, size=int(16 * font_scale_factor))
draw.text((x_pos, y_pos), "NOW!", inky_display.RED, font)

# draw graph outline (last so it's over the top of everything else)
i = 0
Expand Down

0 comments on commit 66c2258

Please sign in to comment.