Skip to content

feat: group handling (WebUI + NVS + HA cover entities) #42

Description

@manuschillerdev

Goal

User can define groups of blinds, persist them in NVS, and control them as a single cover entity in Home Assistant.

Depends on #41 (TX multi-dest).

Design

What is a group?

A named set of device references (by address or slot) that share "open/close together" behavior. Stored in NVS. Exposed as a single cover entity via MQTT / native API.

Native multi-dest vs. sequential TX

If all members share src_address (same emulated remote), emit one multi-dest 0x44 packet (#41). Otherwise fall back to sequential single-dest commands. Detect at group creation time, cache the decision.

Position / state derivation

Group position derived from member states (e.g. average of member positions). Group state: if any member is moving, group is moving.

Changes

1. Group definition in NVS

Group NVS struct (or reuse slot system with DeviceType::GROUP). Each group stores:

  • Name
  • List of member addresses (up to 10)
  • src_address (shared remote address for native multi-dest)

2. DeviceRegistry group CRUD

  • add_group(name, member_addresses[]) -> Group*
  • remove_group(address)
  • command_group(group, command_byte) — calls multi-dest TX or falls back to sequential

3. MQTT adapter: group cover discovery

Publish HA MQTT discovery for each group as a cover entity.

  • state_topic derived from group address/name
  • command_topic routes through DeviceRegistry::command_group()
  • Position support only if ALL members have durations configured

4. Web UI: group management

  • CRUD for groups (create, rename, delete, add/remove members)
  • Display group state derived from member states
  • Send group commands (open/close/stop)

5. Native API adapter

Expose groups as ESPHome cover::Cover entities for native mode (if applicable).

Validation

  • Create a 2-blind group in NVS, verify MQTT discovery
  • Send open/close via HA, verify both blinds move
  • Verify position updates in HA reflect member states
  • Remove one member, verify group still works

Not in scope

  • "all" broadcast — just a group containing all blinds
  • Tilt support for groups (revisit later)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions