Add Interlock Mode - #463
Open
gui9394 wants to merge 1 commit into
Open
Conversation
|
@gui9394 thank you. I am soo looking forward to see this included in the main build. @andrei-lazarov 🙏 I need it in order not to kill my kichen hood turbine, which never must be supplied with live over more that 1 speed at a time. May I test the build somehow on a 4ch Avatto ZWSM16-4-ZIGBEE? I guess the definitions need to be adjusted to cover that module? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces an Interlock Mode (mutually exclusive switch mode) for multi-channel switches (devices with 2 or more relay channels).
When active, it ensures only one relay channel is active at a time. If another channel is commanded to turn on, the previously active channel is turned off first, followed by a configurable delay (in milliseconds) before the requested channel is activated.
Key Changes
1. Firmware Logic (
src/zigbee/relay_cluster.c,relay_cluster.h)relay_cluster_on.hal_tasks_scheduleto implement the delay without blocking the CPU.pending_onstate tracking variable to handle race conditions under rapid sequential toggling, canceling pending relay activations when a different channel is selected.OFFreports (hal_zigbee_send_report_attr) when a pending channel activation is canceled, keeping the controller's UI in sync with the hardware.report_handlerexecution outside of ZCL message processing callbacks to prevent report packet drops inside command handlers.2. Zigbee Custom Attributes (
src/zigbee/consts.h,basic_cluster.c,basic_cluster.h)0xFF03(ZCL_ATTR_BASIC_INTERLOCK_MODE) - Boolean.0xFF04(ZCL_ATTR_BASIC_INTERLOCK_DELAY) - Uint16 (in milliseconds).3. Integrations & Generators
switch_custom.js.jinja) to automatically exposeinterlockModeandinterlockDelayon devices with 2+ relays.zha_quirk.py.jinja.make_homed_extension.py.