Skip to content

Commit 6f279f3

Browse files
neneonlineclaude
andcommitted
Report release multistate value directly before not_pressed overwrite
On end-of-hold the switch cluster writes the *_release presentValue (6=single_release, 9=double_release, ...) and immediately overwrites it with not_pressed (0) in the same call, with no event-loop yield in between. The SDK's deferred reporting machinery reads the live attribute when it next runs, so it only ever sees the final 0: the release value never reaches the network, and coordinators never observe single_release/double_release actions. Send the report directly via hal_zigbee_send_report_attr while the attribute still holds the release value. The existing notify_attribute_changed call is kept so the SDK reporting bookkeeping is unchanged; the added direct send bypasses the deferred path entirely, so the fix holds regardless of SDK reporting internals on both the telink and silabs ports. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ebbcaf3 commit 6f279f3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/zigbee/switch_cluster.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,17 @@ void switch_cluster_on_button_release(zigbee_switch_cluster *cluster) {
495495
hal_zigbee_notify_attribute_changed(cluster->endpoint,
496496
ZCL_CLUSTER_MULTISTATE_INPUT_BASIC,
497497
ZCL_ATTR_MULTISTATE_INPUT_PRESENT_VALUE);
498+
// The release value is transient: it is overwritten with
499+
// MULTISTATE_NOT_PRESSED below, in this same call, before the SDK's
500+
// deferred reporting samples the attribute - so it never reaches the
501+
// network on its own. Send the report directly while the attribute
502+
// still holds the release value.
503+
hal_zigbee_send_report_attr(cluster->endpoint,
504+
ZCL_CLUSTER_MULTISTATE_INPUT_BASIC,
505+
ZCL_ATTR_MULTISTATE_INPUT_PRESENT_VALUE,
506+
ZCL_DATA_TYPE_UINT16,
507+
&cluster->multistate_state,
508+
sizeof(cluster->multistate_state));
498509
switch_cluster_level_stop(cluster);
499510
cluster->n_press = 0;
500511
cluster->in_hold = 0;

0 commit comments

Comments
 (0)