Repository navigation
Conversation
A release edge missed by the GPIO interrupt (possible while the contact bounces: the pin can change between arming the edge and enabling the IRQ) left the button 'pressed' until the next real edge. On a short press this showed up as a spurious long_press 800 ms later, a late 'released', and a missing 'press' on the next click. - button: re-read the pin level in the debounce task and keep polling while the button is held (50 ms until the long press fires, 250 ms after), so a missed release is picked up instead of turning into a long press. - telink gpio_interrupts: after enabling the IRQs, re-check the pin levels against the ones the edges were armed for and re-run the dispatch if they differ. - stub: add set_pin_silent to simulate a missed edge; regression tests. - z2m converter template: add romasku.switchActions, exposing the standard 'action' property (press/release/long_press/long_release/position_on/ position_off per switch endpoint) derived from genMultistateInput reports, so Z2M publishes every press type to <device>/action and creates Home Assistant device triggers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Problem
On a BSEED TS0726 (
SWITCH_BSEED_TS0726_1GANG, router) a quick short press sometimes registered as a long press:long_pressarrived ~800 ms after the click, followed by a latereleased, and thepressof the next click went missing.Cause: the GPIO interrupt can miss a release edge while the contact bounces. The pin can change between arming the edge and enabling the IRQ, so the button stays "pressed" until the next real edge.
Changes
Firmware
button.c: the debounce task re-reads the pin level, and while the button is held it keeps polling (every 50 ms until the long press fires, then every 250 ms). A missed release gets picked up instead of turning into a long press.telink/hal/gpio_interrupts.c: after enabling the IRQs, the pin levels are checked again against the levels the edges were armed for. If they differ, the dispatch runs again.Z2M converter
romasku.switchActionsmodern extend that exposes the standardactionproperty (press,release,long_press,long_release,position_on,position_off, suffixed with the switch endpoint name, e.g.long_press_switch_1), derived fromgenMultistateInputreports. Zigbee2MQTT publishes it to<device>/actionand creates Home Assistant device triggers for every press type, not only short presses.<switch>_press_actionis unchanged.Tests / stub
set_pin_silentsimulates a missed edge.tests/test_switch_cluster_momentary_mode.py.Testing
make stub/build && make tests).SWITCH_BSEED_TS0726_1GANG(router), flashed over OTA and used on a real device. The spurious long presses are gone, andactionevents (includinglong_press_*/long_release_*) show up in Z2M and Home Assistant.🤖 Generated with Claude Code