✨ Add capacity actuator helpers (pilot-wire, thermal-mode, set-point) #45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "capacity-actuators"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds the three missing capacity actuator helpers, wrapping documented
/api/capacities/{id}/...endpoints, and groups all capacity control in a dedicatedCapacitiesMixin:set_pilot_wire(capacity_id, state)→PUT /capacities/{id}/pilot-wire?state=set_thermal_mode(capacity_id, state)→PUT /capacities/{id}/thermal-mode?state=set_thermostat_set_point(capacity_id, value)→PUT /capacities/{id}/thermostat-set-point?value=switch_capacityis moved fromDevicesMixininto the newcomwatt_client/_capacities.pyCapacitiesMixin(behaviour unchanged) so all capacity control lives together, consistent with the domain-mixin split.⚠️ Verification caveat (please read)
These are write operations on real hardware, and the
stateenum values forpilot-wire/thermal-modeare backend-defined and unconfirmed (the API docs mark them TODO). The test account has no pilot-wire/thermostat device, so they could not be exercised against live hardware. Therefore:state/valueare passed through as-is — no client-side enum validation. Docstrings point users at the capacity'sselectValuesfield for valid values.responses), like the entire existing suite: they verify URL/param construction and error propagation, not hardware behaviour.Changes
comwatt_client/_capacities.py: newCapacitiesMixin(switch_capacitymoved in + 3 new helpers).comwatt_client/_devices.py:switch_capacityremoved.comwatt_client/client.py:ComwattClientnow also inheritsCapacitiesMixin.tests/test_capacities.py: new; theswitch_capacitytests moved here + success/error tests for the 3 new helpers.tests/test_devices.py:switch_capacitytests removed (moved).README.md: documentsswitch_capacity(previously undocumented) + the 3 new helpers, with the enum caveat.Test plan
pytest→ 99 passed.mypy comwatt_client→ clean (11 source files).client.switch_capacity(...)still works — it's still a method onComwattClient).Opened as a draft (WIP) — mark ready for review when you're happy.
Introduce a dedicated CapacitiesMixin (comwatt_client/_capacities.py) and add three write helpers that wrap the documented /capacities/{id}/... endpoints: - set_pilot_wire(capacity_id, state) -> PUT .../pilot-wire?state= - set_thermal_mode(capacity_id, state) -> PUT .../thermal-mode?state= - set_thermostat_set_point(capacity_id, v) -> PUT .../thermostat-set-point?value= switch_capacity is moved from DevicesMixin into the new CapacitiesMixin so all capacity control lives together (behaviour unchanged). state/value are passed through as-is: the pilot-wire/thermal-mode enum values are defined by the backend and could not be verified against a live device on the test account, so no client-side validation is imposed (see docstrings / capacity selectValues). Tests are HTTP-mocked (responses), like the rest of the suite: they assert URL/param construction and error propagation. 99 passed, mypy clean.WIP: ✨ Add capacity actuator helpers (pilot-wire, thermal-mode, set-point)to ✨ Add capacity actuator helpers (pilot-wire, thermal-mode, set-point)