Skip to content

feat: add brush coverage image entity with tooth diagram visualization#88

Open
deniskie wants to merge 3 commits into
mainfrom
feat/brush-coverage-image
Open

feat: add brush coverage image entity with tooth diagram visualization#88
deniskie wants to merge 3 commits into
mainfrom
feat/brush-coverage-image

Conversation

@deniskie
Copy link
Copy Markdown
Owner

Add an image platform entity that renders a colour-coded dental arch diagram showing which zones were brushed and how much pressure was applied. Uses pre-rendered WebP assets (dental_cast8 overlays on a background) from the official Oclean app, composited server-side via PIL with dynamic tinting (green/orange/red by pressure level).

  • New: image.py with OcleanBrushCoverageImage entity
  • New: assets/ with 10 WebP files (~226 KB)
  • New: tests/test_image.py (26 tests)
  • Register Platform.IMAGE in init.py
  • Add translations (en/de/es)
  • Add ImageEntity stub to test conftest

@deniskie deniskie force-pushed the feat/brush-coverage-image branch 11 times, most recently from 00ff9f6 to a4bb6ac Compare April 2, 2026 14:42
deniskie and others added 3 commits April 2, 2026 19:01
Add an image platform entity that renders a colour-coded dental arch
SVG showing which zones were brushed and how much pressure was applied.
The diagram is generated entirely in Python using math-based scalloped
arcs — no external assets, no PIL dependency, no copyright concerns.

Colour coding by pressure:
- Grey: not brushed (0)
- Green: light pressure (1-80)
- Orange: medium pressure (81-160)
- Red: high pressure (161-255)

- New: image.py — OcleanBrushCoverageImage entity + SVG generation
- New: tests/test_image.py — 27 tests
- Register Platform.IMAGE in __init__.py
- Add translations (en/de/es)
- Add ImageEntity stub to test conftest

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extend the integration to support both 8-zone and 12-zone dental
layouts. YD-series devices (YD000C/D/F/10) use 12 zones with an
additional center column between left and right for each jaw.

- const.py: TOOTH_AREA_NAMES_12, DATA_DENTAL_CAST, area_names_for_count()
- protocol.py: dental_cast field on DeviceProtocol, TYPE1_12Z profile
- parser.py: _build_area_stats accepts variable zone count, dental_cast
  parameter threaded through parse_notification to area parsers
- coordinator.py: passes dental_cast to notification handler
- sensor.py: creates 12 zone sensors (center zones unavailable on 8-zone)
- image.py: SVG supports 3-section layout for 12-zone devices
- translations: center zone names in en/de/es

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ImageEntity.__init__(self) instead of passing coordinator.hass; modern
  HA dropped the hass parameter, causing access_token to never be set up
  and the image proxy URL to render token=undefined in the frontend
- Remove the available override on OcleanBrushCoverageImage so the entity
  stays reachable even when last_brush_areas is absent (OCLEANY3M never
  sends 2604 area enrichment pushes in paginated mode); async_image still
  returns None until real area data arrives
- Update conftest ImageEntity stub and test expectations to match

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@deniskie deniskie force-pushed the feat/brush-coverage-image branch from a4bb6ac to 09bd0ed Compare April 2, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant