This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Python 100.0%
4 1 0

Clone this repository

https://tangled.org/liampallett.space/laundry-cli https://tangled.org/did:plc:5myuluxarbkpnmspgud7mg7o
git@tangled.org:liampallett.space/laundry-cli git@tangled.org:did:plc:5myuluxarbkpnmspgud7mg7o

For self-hosted knots, clone URLs may differ based on your setup.



README.md

Laundry CLI#

A lightweight, object-oriented CLI to ping WashPoint laundry API and display results in formatted text in the terminal


What the Project Is#

  • Queries unauthenticated WashPoint API for live data on machine information
  • Personal tool not really meant for anyone else
  • Solves issues with the existing web app

How It Works#

  • OOP Structure with Machine and TUI classes.

main.py#

Where HTTP networking occurs. Ping the endpoint, return the data, construct machines and render to the terminal, all lightning fast.

Machine class#

Translates JSON dictionaries into useful data about each machine, such as its type, status and time remaining on its cycle.

TUI class#

Iterates across machines and displays them informatted ASCII art and colours based on the status of the machine.


Engineering Decisions#

  • Refactored from one linear file into an OOP project with multiple classes

Tech Stack#

  • Languages used: Python, zsh
  • Frameworks/libraries: requests
  • Tools and platforms: WashPoint API

How to Run the Project#

  • Prerequisites: Python 3.8.
    • Access to WashPoint API endpoint.
  • Installation steps: Clone the Tangled repo.
git clone git@tangled.org/liampallett.space/laundry-cli.git
cd laundry-cli
  • How to start/run the project: Initialise venv and install dependencies.
python3 =m venv venv
source venv/bin/activate
pip install requests

Export your endpoint as an environment variable and launch the project.

export LAUNDRY_API_ENDPOINT="https://your-facility-endpoint.us-east-1.on.aws/rooms/XXXXX"
python main.py

Creating a permanent global terminal alias (Recommended) Add the following function to your ~/.zshrc or ~/.bashrc file to execute the dashboard from anywhere with a single keyword:

Bash
washing() {
  export LAUNDRY_API_ENDPOINT="https://your-facility-endpoint.us-east-1.on.aws/rooms/XXXXX"
  /absolute/path/to/laundry-tui/venv/bin/python -W ignore /absolute/path/to/laundry-tui/main.py
}

Project Structure#

laundry-cli/
│
├── main.py        # Gateway orchestrator; handles requests and manages workflow
├── machine.py     # Contains Machine model layer data processing and ASCII assets
├── tui.py         # Presentation logic; coordinates line building and ANSI styling
├── .gitignore     # Prevents committing local caching and venv files
├── LICENSE.md     # Project license
└── README.md      # Project documentation

Future Improvements#

  • Animation for active washing machines
  • Mutliple room support
  • Washing metrics