This repository has been archived by the owner on May 17, 2021. It is now read-only.
[GPIO] Item state out of sync even with debounce set #5729
Comments
oktett-8
added a commit
to oktett-8/openhab1-addons
that referenced
this issue
Dec 8, 2018
* Fixes GPIO Binding Item state out of sync even with debounce set. Fixes openhab#5729 Signed-off-by: Ingo Schuck <ingo.schuck@oktett-8.de> (github: oktett-8)
kaikreuzer
pushed a commit
that referenced
this issue
Dec 8, 2019
Efus10n
added a commit
to Efus10n/openhab1-addons
that referenced
this issue
Jan 1, 2020
* moved legacy bindings to the correct feature (openhab#5893) Signed-off-by: Kai Kreuzer <kai@openhab.org> * removed Sen.se persistence service (openhab#5850) Signed-off-by: Kai Kreuzer <kai@openhab.org> * removed sense persistence service from distro pom (openhab#5894) Signed-off-by: Kai Kreuzer <kai@openhab.org> * Update README.md (openhab#5898) Add FritzBox TR064 Item configuration for events for active calls, present in the source code of the binding since 20.12.2015 Signed-off-by: Jan Hendriks <Jan.Hendriks@telekom.de> * Fix Serial binding where serial commands in rapid succession were not recognized (openhab#5891) Signed-off-by: Marek Halmo <halmomarek@gmail.com> * updated product links (openhab#5901) Signed-off-by: Kai Kreuzer <kai@openhab.org> * Typo lead to confusing instructions (openhab#5896) The address in the first example is 0x21, but the explenation under it statet the address as 0x20. The second example shows the right way * Update README.md adding FB 6490 (openhab#5900) Added Fritz Box 6490 Cable (v7.02) as working and supported model. Signed-off-by: dirkbe <8006572+dirkbe@users.noreply.github.com> * - Fixing a minor TYPO (openhab#5878) - Adding that no `things` file configuration required Signed-off-by: Soren Thorsen <st@debian-linux.dk> * Update org.apache.http dependencies (openhab#5887) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> * Fix empty reactor summary on newer Maven versions (openhab#5885) On newer Maven versions the reactor summary also contains the project name and version so the regexp needs to be adjusted for this. Also make sure grep treats binary data as text (-aE switch) so the pipe doesn't choke on this. Signed-off-by: Wouter Born <github@maindrain.net> * Fixed POM XML Shema Definition path (openhab#5903) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> * moved networkupstools to legacy addons (openhab#5904) Signed-off-by: Kai Kreuzer <kai@openhab.org> * [fritzboxtr0641] Improve docs (openhab#5908) * Translate log message * Wifi => Wi-Fi, see https://en.wikipedia.org/wiki/Wi-Fi * Use capital letter after bullet point Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com> * [KNX.Test] workaround for timezone in KNXCoreTypeMapperTest (openhab#5912) Signed-off-by: Slawomir Jaranowski <s.jaranowski@gmail.com> * Added utime (openhab#5910) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> * Fixed restriction on special characters in URLs (openhab#5868) Escaping special characters in URLs allows usage of calendar-ids with special characters, e.g. private-home --> private%2Dhome Signed-off-by: CSchlipp <christian@schlipp.de> * Novelan heatpump: Add output signals and additional state variables as items, add missing heatpump states (openhab#5883) Signed-off-by: Andre Heßling <andre@andrehessling.de> * little Mistake (openhab#5909) * [fatekplc] Serial port support (openhab#5877) Signed-off-by: Slawomir Jaranowski <s.jaranowski@gmail.com> * Update README.md with improved config info. (openhab#5841) * fixed typo * [swegon] Added throttle support (openhab#5685) Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com> * [oem] throttle support (openhab#5684) Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com> * Anel binding: mask pwd in log entries; issue openhab#5716 (openhab#5828) * Use stock OLA from OS by default (openhab#5696) * [GPIO] Fixes debounce Item state out of sync (openhab#5729) (openhab#5730) * Fixes GPIO Binding Item state out of sync even with debounce set. Fixes openhab#5729 Signed-off-by: Ingo Schuck <ingo.schuck@oktett-8.de> (github: oktett-8) * fixed compilation error (openhab#5919) Signed-off-by: Kai Kreuzer <kai@openhab.org> * Update README.md (openhab#5920) Tested myself on FB 7580 * [Davis] Formatting changes for README (openhab#5794) * [Daikin] Formatting changes for README (openhab#5793) * Update README.md changed pre to ``` for better readability on openhab.org * Update README.md Added empty line above code fences * [Diyonxbee] Formatting changes for README (openhab#5796) * [CalDAV-Command] Readability enhancements for README (openhab#5789) * Update README.md * [Cups] Update README with better sendCommand alternative (openhab#5792) * Fixed minor typo (openhab#5780) * fixed typo * [CalDAV-Personal] Minor cleanup for README (openhab#5790) * Update README.md * [SNMP] Update README.md for the version property (openhab#5779) * Update README.me according to openhab#2426, the binding supports at least also version v2c. I tested it to make a COUNTER64 OID work (https://community.openhab.org/t/synology-disk-usage-and-snmp-binding/65869) I wasn't able to test SET * Update bundles/binding/org.openhab.binding.snmp/README.md Co-Authored-By: on4tux <jan@tiri.be> * Update README.md * [http] Fixed NPE while executing background thread (openhab#5718) * Don't execute when the binding is shutting down. * Update README.md (openhab#5614) * [squeezebox action] linter errors pass 2 (openhab#5476) Signed-off-by: Brad Gilmer <brad@gilmer.tv> * [unleash-maven-plugin] Preparation for next development cycle. * update OpenWebNet link, current link is dead (openhab#5921) https://developer.legrand.com/uploads/2019/12/OWN_Intro_ENG.pdf Co-authored-by: Kai Kreuzer <kai@openhab.org> Co-authored-by: Jan Hendriks <Jan.Hendriks@telekom.de> Co-authored-by: marekhalmo <halmomarek@gmail.com> Co-authored-by: bitDealer <bitDealer@users.noreply.github.com> Co-authored-by: dirkbe <8006572+dirkbe@users.noreply.github.com> Co-authored-by: Søren Thorsen <st@debian-linux.dk> Co-authored-by: Christoph Weitkamp <github@christophweitkamp.de> Co-authored-by: Wouter Born <github@maindrain.net> Co-authored-by: mueller-ma <mueller-ma@users.noreply.github.com> Co-authored-by: Slawomir Jaranowski <s.jaranowski@gmail.com> Co-authored-by: CSchlipp <christian@schlipp.de> Co-authored-by: André Heßling <andre@andrehessling.de> Co-authored-by: Arut42 <Arut42@users.noreply.github.com> Co-authored-by: Amos Kittelson <amos.kittelson@sidewalktech.com> Co-authored-by: pali <pauli.anttila@gmail.com> Co-authored-by: paphko <git@paphko.de> Co-authored-by: Peter Newman <peternewman@users.noreply.github.com> Co-authored-by: oktett-8 <45500797+oktett-8@users.noreply.github.com> Co-authored-by: msimat <56175221+msimat@users.noreply.github.com> Co-authored-by: Sem <semperor@web.de> Co-authored-by: Michael Rumpf <michael@rumpfonline.de> Co-authored-by: on4tux <jan@tiri.be> Co-authored-by: Chris Carman <namraccr@gmail.com> Co-authored-by: aurelio1 <aureliocaliaro@yahoo.de> Co-authored-by: Brad Gilmer <bgilmer77@users.noreply.github.com> Co-authored-by: Thomas Manson <dev.mansonthomas@gmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Expected Behavior
openHAB Items bound to GPIO pins should always be in sync with the pin state reported by the OS after the debounce time. For Linux the value reading of the GPIO pin in the /sys filesystem (e.g. cat /sys/class/gpio/gpio123/value) should be in sync with the bound Item state.
Current Behavior
When connecting GPIO to a potential-free relay (e.g. for decoupling from a status signal of a different circuit) GPIO Binding shows an unreliable behavior. Item state sometimes does not change after the relay changes state and is then not in sync with the “value” reading of the GPIO pin in the Linux /sys filesystem. This is due to heavy bouncing of the relay contact and an implementation weakness in GPIO software debounce.
The current implementation places a blocking call on a GPIO pin that is unblocked as soon as the GPIO state changes. A few lines later it reads the actual state which might have bounced back to the original state again in the meantime (after the unblocking). With the read state it does the event handling that updates openHAB Items (which may not cause an Item Changed Event if the read state was a bounce back to the original state).
If the debounce parameter is set in the GPIO Binding it would now (after the first, potentially wrong read) cause the event handling to be skipped for the specified time. If the relay contact then is stable the blocking call on the GPIO pin will not receive an interrupt anymore and so the Item state will remain out of sync with the actual contact state and its value in /sys.
Possible Solution
GPIO software debounce can be made reliable by not reading the state just after being unblocked, but sleeping for the time specified in the debounce parameter and then reading the state and doing the event handling. I will provide a commit with the fix.
Steps to Reproduce (for bugs)
Context
Binding a GPIO pin to an Item is unreliable in the current implementation.
Your Environment
The text was updated successfully, but these errors were encountered: