Skip to content

Implement Level Move Mode Configuration for Switch Clusters - #553

Open
cmiguelcabral wants to merge 2 commits into
romasku:mainfrom
cmiguelcabral:button_move_direction
Open

cmiguelcabral wants to merge 2 commits into
romasku:mainfrom
cmiguelcabral:button_move_direction

Conversation

@cmiguelcabral

@cmiguelcabral cmiguelcabral commented Nov 14, 2026 •

Copy link
Copy Markdown

This PR implements support for configurable level move modes in switch clusters, enabling users to select between different movement behaviors when using level control functionality.

Changes included:

  1. NVM Structure Enhancement: Added level_move_mode field to zigbee_switch_cluster_config structure (9 bytes total)

  2. Configuration Support: Implemented three movement modes:

    • ALTERNATE (0x02): Current behavior - alternates between UP/DOWN (default)
    • ONLY_UP (0x00): Fixed direction - always moves UP
    • ONLY_DOWN (0x01): Fixed direction - always moves DOWN
  3. Migration Logic: Enhanced NVM migration to properly handle existing configurations

  4. Control Logic: Updated switch_cluster_level_control function to respect configured modes

  5. Initialization Fix: Corrected field initialization in config parser

Technical Details:

  • The new field is stored persistently in NVM
  • Migration logic handles both new installations and upgrades from previous versions
  • Zigbee attribute validation ensures mode values stay within valid range (0-2)
  • Backward compatibility maintained for existing deployments

Testing:

  • Verified persistence of level move mode across reboots
  • Tested all three movement modes function correctly
  • Confirmed migration works for existing installations

Usage: Users can now configure the level move behavior via Zigbee bind, allowing for more flexible control of switch clusters based on their specific requirements.

- Added level_move_mode field to zigbee_switch_cluster_config structure
- Implemented support for three movement modes: ALTERNATE, ONLY_UP, ONLY_DOWN
- Updated config parser to initialize level_move_mode correctly
- Modified switch_cluster_level_control function to respect configured movement mode
- Enhanced NVM migration logic to handle existing configurations
- Added proper validation for level move mode values
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