Skip to content

Improve WiButler 1 lights and button handling#13

Open
philw113 wants to merge 10 commits into
patrickweh:mainfrom
philw113:main
Open

Improve WiButler 1 lights and button handling#13
philw113 wants to merge 10 commits into
patrickweh:mainfrom
philw113:main

Conversation

@philw113

@philw113 philw113 commented Nov 4, 2025

Copy link
Copy Markdown

Summary

This PR improves support for WiButler 1:

  • Detect lights by components (SWT / BRI_LVL) instead of only type == "DimminActuators".
  • Skip devices with "taster" or "reconnect" in the name when creating light entities.
  • Ignore BTNRECON in binary_sensor setup so reconnect status is not exposed as an entity.

Motivation / Problem

With WiButler 1 all my light actuators showed up only as BTNRECON / binary_sensor in Home Assistant.
There were no usable light.* entities and a lot of “Reconnect” entities that don’t make sense in HA.

What changed (files)

  • custom_components/wibutler/light.py

    • create light entities when a device exposes SWT and/or BRI_LVL
    • skip by name: contains "taster" or "reconnect"
    • keep HA compatibility (SUPPORT_BRIGHTNESS)
  • custom_components/wibutler/binary_sensor.py

    • register BTN_* (real buttons) only
    • skip BTNRECON entirely

Result (tested on my setup)

  • WiButler 1 (not 2)

Outcome:

  • Lights appear as light.* and can be switched/dimmed.
  • Push buttons remain as binary_sensor.*.
  • Reconnect entities no longer created (old ones can be removed).

Breaking changes

None expected. Name-based skip is conservative and only filters obvious non-light devices.

Notes

Happy to adjust detection logic (e.g. component-only, stricter filters) if you prefer.

philw113 and others added 10 commits November 4, 2025 22:24
- Detect lights based on SWT/BRI_LVL components instead of only DimminActuators
- Skip devices with "taster" or "reconnect" in the name when creating lights
- Ignore BTNRECON in binary_sensor setup, keep only real button channels (BTN_0/BTN_1/BTN_A0/BTN_B0, …)
- Tested with WiButler 1: lights now appear as light.*, buttons as binary_sensor.*, reconnect entities are gone
- Only register real button channels (BTN_0, BTN_1, BTN_A0, BTN_B0, …) as binary_sensors
- Skip BTNRECON completely so reconnect status is not exposed as an entity
- Result: push buttons stay as binary_sensor.*, reconnect entities disappear and can be removed in Home Assistant
- Tested with WiButler 1: normal button behaviour is unchanged, UI is cleaner
CLAUDE.md, MODULES.md, FORK-NOTES.md added for integration with the
srv-homelab workspace. Fork-Notes documents the divergence from
upstream patrickweh/ha-wibutler (sync point cab4be0, two local commits,
uncommitted climate.py work, deferred upstream merge).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Local work that has been running on the production HA instance for some
time, now committed to the fork. Replaces the minimal climate.py with:

- Comfort/Eco preset support via PRESET_COMFORT / PRESET_ECO
- CTSP/ETSP setpoint discovery (with _prf_N_ profile variants)
- RTSPMODE bonus path tried first; falls back to TSP write when device
  rejects the mode component (many devices return 422)
- Eco fallback: TSP - 2.0 C when no ETSP component is exposed
- Comfort fallback: 21.0 C default
- FloorHeatingController added to supported device types
- Tolerance-based preset state heuristic (+/- 0.5 C)
- WebSocket update filtered by device_id (was missing)
- Helper functions for raw <-> degC conversion ((raw/2)+10)
- Clamp to MIN 5.0 / MAX 30.0 C

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Since HA Core 2026.5.x (Python 3.14 + newer aiohttp) the WibutlerHub
setup fails with JSONDecodeError around position 161320 when fetching
/api/devices on hubs with many devices. aiohttp's internal json()
decoder breaks the ~160 KB response. response.text() + json.loads
reads the whole body first and parses cleanly.

Symptom in HA logs:
  File "custom_components/wibutler/api.py", line 81, in _request
    return await response.json()
  json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 161321

Effect of bug: hub.get_devices() returns None -> all Wibutler entities
go unavailable on HA start.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SUPPORT_BRIGHTNESS was removed from homeassistant.components.light
in HA Core 2026.5, causing the wibutler light platform to crash on
import with:

  ImportError: cannot import name 'SUPPORT_BRIGHTNESS' from
  'homeassistant.components.light'

Replaced with the modern color_mode API:
- Class attributes _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
  and _attr_color_mode = ColorMode.BRIGHTNESS
- Removed the obsolete supported_features property

Surfaced after the api.py JSONDecodeError fix (d21626d); previously
hidden because the JSON crash aborted setup before light.py imports.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nachpflege nach Notion-REP-Anlage (Projekte-DB).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PROJEKT-PLAYBOOK §12.4 Schritt 4 verlangt notify-on-failure.yml +
Health-Check-Stub fuer service-Repos. Hier uebersprungen, da kein CI
und der Live-Stand in der HA-VM laeuft, nicht im Repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Setzt die in ADR-001 dokumentierte Strategie um:

- manifest.json: version 1.0.0 -> 1.0.1+philw113-fork-2026-05-19
  (PEP-440-Build-Metadata-Suffix, von Semver-Vergleich ignoriert),
  documentation auf Fork-URL umgehaengt, codeowners um @philw113 erweitert
- .github/workflows/upstream-watch.yml: Cron-Action (Mo 09:00 UTC) +
  workflow_dispatch. Fetcht patrickweh/main, vergleicht mit
  .github/upstream-last-seen, schickt ntfy bei neuen Commits, commited
  last-seen-SHA zurueck.
- .github/upstream-last-seen: initial cf8916b (Patrick's "Bump version
  to 1.2.0" vom 2026-03-07)
- docs/decisions/001-fork-pflege-strategie.md: ADR mit Optionen +
  Entscheidung + Implementierung + Konsequenzen
- FORK-NOTES.md: Strategie-Sektion + Sync-Prozess + ueberarbeitete
  Commit-Liste, Convention-Abweichung-Block angepasst

Naechster Schritt (User-Action): HACS-Custom-Repo von
patrickweh/ha-wibutler auf philw113/ha-wibutler umstellen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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