v1.11.0 — Unified command path and MQTT dispatch refactor
Changed
- Command path unified in the entity base classes.
valve.py,switch.py,lawn_mower.py,automower_button.py,automower_switch.py,automower_select.py,automower_number.py, andautomower_lawn_mower.pypreviously each duplicated the same throttle → budget-increment → try/except-auth/exception → raise-translated-error boilerplate around every API call — ~25 lines per call site, ten call sites. The shared pattern now lives inGardenaEntity._async_execute_command(Gardena side) andAutomowerEntity._async_execute_command(Automower side), with per-platform exception mapping. Call sites now read as a single line:await self._async_execute_command(client_method, *args, **kwargs). Net change: ~180 lines of duplication removed. Behaviour is unchanged — the pessimistic budget-increment-before-await guarantee from v1.10.4 is preserved. - MQTT command handler rewritten as a dispatch table.
GardenaCoordinator._async_handle_mqtt_commandused a six-branchif/elifcascade with near-identicalawait self._client.async_send_command(…)calls. Replaced with_MQTT_DISPATCH: dict[str, tuple[control_type, command, needs_duration]]and a single dispatch call — adding a new MQTT action is now a single-line change. The redundant_MQTT_ACTIONSset is removed. automower_lawn_mower.pycommand handler also gets the same treatment: the five-branchif/elifinside the try/except is replaced with_COMMAND_METHODS: dict[str, str]and agetattrlookup against the client.
Developer Notes
Pure refactor release. No functional or UI-visible change; all existing tests pass unchanged as the behavioural contract (throttle first, count second, dispatch third, on-success state update) is identical to v1.10.4.
Net diff: +187 / −306 (−119 lines). All 725 tests pass.