Skip to content

Add typed write helpers for valve-position actions #108

Description

@ronaldvdmeer

Summary

Add typed write helpers for valve-position actions so python-duco-connectivity exposes deliberate public methods for manual position control instead of requiring downstream consumers to call the generic node action API directly.

Why this issue exists

The library already exposes the low-level pieces needed to write valve position related actions:

  • KnownActionName.SET_POS_MAN
  • KnownActionName.SET_POS_MAN_CNT
  • generic async_set_node_action() execution
  • typed node read models such as NodeMotorStateInfo

That is enough for generic action execution, but downstream consumers still need to:

  • know which raw action name to call
  • decide which action applies to which use case
  • pass position values through the generic val parameter

For consumers like the Home Assistant Duco integration, that means write support for valve position would currently rely on a generic escape hatch instead of a deliberate typed client method.

Goal

Expose a small typed write surface for valve-position related node actions while keeping the library API-shaped and reusable outside Home Assistant.

Scope

In scope:

  • add dedicated client helpers for manual valve-position related actions
  • use the existing typed public concepts where possible, such as NodeMotorPosition
  • keep the generic async_set_node_action() method available for broader action coverage
  • add focused tests for the new helper methods
  • update README if the new methods become part of the intended public client surface

Out of scope:

  • Home Assistant entity design
  • deciding whether Home Assistant should expose percentage writes for Duco valves
  • adding Home Assistant-specific abstractions for presets or installers' configuration semantics
  • changing the generic action execution contract beyond what is needed for the new helpers

Proposed direction

Likely public methods:

  • async_set_manual_position(node_id, position) for SetPosMan
  • async_set_manual_continuous_position(node_id, position) for SetPosManCnt

The helpers should:

  • accept typed position input rather than an unstructured generic value where practical
  • delegate internally to async_set_node_action()
  • preserve the existing low-level action API for advanced or forward-compatible use cases

Acceptance criteria

  • Valve-position write actions have dedicated public helper methods on DucoClient
  • The helpers use typed input that matches the current public model surface as closely as the API allows
  • Tests cover the expected request payloads and action names
  • The generic node action route remains available for non-specialized actions

Related

  • This is library work for python-duco-connectivity
  • This supports future consumers that want a typed write path for valve-position actions without using raw action names directly

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsAction discovery and execution endpointsenhancementNew feature or requestfoundationCore API surface and foundational client capabilities

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions