Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
laundry-cli machine.py
1.0 kB · 33 lines
Python
at main
12345678910111213141516171819202122232425262728293031323334class Machine: def __init__(self, index, machine_id, data): self.index = index self.is_dryer = bool(data.get("canTopOff", False)) self.type_str = "Dryer" if self.is_dryer else "Washer" self.status_id = data.get("statusId", "UNKNOWN") self.cycle_name = data.get("selectedCycle", {}).get("name", "UNKNOWN") self.minutes_left = data.get("remainingSeconds", 0) // 60
@property def is_free(self): return self.status_id != "IN_USE"
@property def ascii(self): if self.is_dryer: return [ " __________ ", "| :: |", "| ________ |", "| | | |", "| |______| |", "|__________|", ] else: return [ " __________ ", "| :: |", "| __ |", "| / \\ |", "| \\__/ |", "|__________|", ]