GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - puha-dev/claude-usage-meter: ESPHome Claude usage-limit gauge for the Spotpear Xiaozhi AI Ball (ESP32-S3, round GC9A01A) fed by Home Assistant

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
.gitignore
.gitignore
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
claude-usage-meter.yaml
claude-usage-meter.yaml
 
 
claude_meter.h
claude_meter.h
 
 
secrets.yaml.example
secrets.yaml.example
 
 

Repository files navigation

Claude Usage Meter (ESP32-S3 round display)

ESPHome firmware that turns a Spotpear "Xiaozhi AI Ball" (ESP32-S3 with a 1.28" round GC9A01A screen) into a desk gauge for your Claude usage limits, with data coming from Home Assistant.

The meter running on the Spotpear Xiaozhi Ball    Screen mockup: session and weekly usage arcs, clock, weather and Clawd

Left: the real device (photo taken before the labels switched from Polish to English). Right: screen mockup.

  • Outer arc: 5-hour session usage (blue).
  • Inner arc: weekly usage (mauve).
  • Arcs and percentages turn peach at ≥60% and red at ≥85%.
  • Countdown to each limit reset.
  • Clock, date, and current weather with temperature.
  • A pixel-art Clawd in the gap at the bottom.
  • Sound alerts through the built-in speaker:
    • one beep at 80%, a triple beep at 95%;
    • a short melody when the session limit renews;
    • quiet hours 23:00–07:00 and an on/off switch in HA.
  • The built-in RGB LED is exposed to Home Assistant as a regular light (color, brightness, pulse/strobe/rainbow effects) for your own automations.

On-screen text is in English; the two Home Assistant entity names ("Podświetlenie" = backlight, "Dźwięki alertów" = alert sounds) are Polish. Colors follow Catppuccin Mocha.

Hardware

Part Details
Board Spotpear Xiaozhi AI Ball V2 (AliExpress), the version without battery and touch
MCU ESP32-S3 N16R8: 16 MB flash, 8 MB octal PSRAM
Display GC9A01A 240x240 round, SPI: CLK 4, MOSI 2, CS 5, DC 47, RST 38, backlight GPIO42 (inverted)
Audio ES8311 codec, I2C SDA 15 / SCL 14; I2S LRCLK 45 / BCLK 9 / MCLK 16 / DOUT 8; amp enable GPIO46
RGB LED WS2812 (single LED), GPIO48

All pins are listed in substitutions: at the top of the YAML. The V1 board uses a different display pinout, noted in a comment there. Pin mapping is based on RealDeco/xiaozhi-esphome.

Requirements

  • Home Assistant with the ESPHome add-on (ESPHome ≥ 2025.5).
  • The hass-claude-usage integration. It provides these sensors:
    • sensor.<prefix>_session_usage
    • sensor.<prefix>_week_usage
    • sensor.<prefix>_session_reset_time
    • sensor.<prefix>_weekly_reset_time
  • Any weather.* entity.

Setup

  1. Copy claude-usage-meter.yaml and claude_meter.h into /config/esphome/ in Home Assistant.
  2. Add the keys from secrets.yaml.example to /config/esphome/secrets.yaml.
  3. Edit the substitutions: at the top of the YAML:
    • claude_prefix: your hass-claude-usage entity prefix, e.g. claude_usage_<account>.
    • weather_entity: your weather entity.
  4. In the ESPHome dashboard, press Install. Use USB for the first flash; later updates go over the air.
  5. Adopt the device in Settings → Devices & services.

From the CLI:

esphome run claude-usage-meter.yaml

Sounds

Event Sound
Session or weekly usage crosses 80% one short beep
Usage crosses 95% triple beep
Session usage drops below 10% after an alert renewal melody
  • Each threshold plays only once per limit window. The alert level is stored in flash, so a reboot does not replay alerts.
  • Thresholds, quiet hours and melodies are constants in claude_meter.h.

To play any RTTTL tune from Home Assistant (this ignores quiet hours and the switch):

action: esphome.esp32_ball_play_rtttl
data:
  song_str: "test:d=8,o=5,b=160:c,e,g,c6"

Files

File Purpose
claude-usage-meter.yaml Main ESPHome config: hardware, HA sensors, LVGL layout, audio
claude_meter.h C++ helpers: ISO 8601 parsing, countdowns, dates, colors, weather icons, alert logic
secrets.yaml.example Template for the secrets the config expects

License

MIT

About

ESPHome Claude usage-limit gauge for the Spotpear Xiaozhi AI Ball (ESP32-S3, round GC9A01A) fed by Home Assistant

Topics

claudeesp32-s3esphomegc9a01home-assistantlvglround-displayrtttl

Resources

Readme
MIT license
Activity

Stars

6 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.