Open HarterHorst opened 2 years ago
Hi @HarterHorst,
Thanks for the nice analysis of the problem! That makes thing much easier to follow...
That is a strange problem. So it seems that the first chain of nodes (trigger, read register, ...) has impact on the second chain of nodes (button events, ...). Cannot immediately explain this. Because - unless things have changed recently - NR works like this when 3 wires are connected to an output:
Since the button-event event node will receive a copy of the original message, how on earth can there be a relation...
Could you do some extra experiments please:
And can you share: an export of this part of your flow. I am wondering what the trigger node does in your case?
Hopefully a bell will start ringing when I have extra feedback... Bart
Hi, glad to hear that you struggle with this in the same way. First I thought that I missed fundamentals regarding objects in flows.
Your interpretation of the flow is correct.
Here are the results from the additional test:
Since I don't use the gpiod nodes, it is not possible to reproduce your problem. So I have replaced your gpiod node by a trigger node, to simulate the behaviour:
[{"id":"99b05d5ec7a850ba","type":"i2c in","z":"b72068aa707669b0","name":"Read register 0x3f","busno":"1","address":"63","command":"","count":"1","x":710,"y":260,"wires":[["cf70786923288cba"]]},{"id":"cf70786923288cba","type":"debug","z":"b72068aa707669b0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":260,"wires":[]},{"id":"16f81ac983ae6d0a","type":"button-events","z":"b72068aa707669b0","name":"","outputs":2,"inputField":"payload","inputFieldType":"msg","outputField":"clickmode","outputFieldType":"msg","downValue":"0","downValueType":"num","upValue":"1","upValueType":"num","idleValue":"1","clickedInterval":200,"pressedInterval":200,"debounceInterval":30,"events":[{"type":"clicked"},{"type":"double_clicked"}],"x":480,"y":340,"wires":[["02013e600b986b47"],["2eace1ebe45a1e4e"]]},{"id":"2eace1ebe45a1e4e","type":"debug","z":"b72068aa707669b0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":360,"wires":[]},{"id":"d3d2db86c70a3c09","type":"trigger","z":"b72068aa707669b0","name":"","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"120","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"topic","topic":"AllBinary","outputs":1,"x":480,"y":260,"wires":[["99b05d5ec7a850ba"]]},{"id":"02013e600b986b47","type":"debug","z":"b72068aa707669b0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":320,"wires":[]},{"id":"a6f84e9dac9c30db","type":"trigger","z":"b72068aa707669b0","name":"","op1":"0","op2":"1","op1type":"num","op2type":"num","duration":"120","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"topic","topic":"AllBinary","outputs":1,"x":260,"y":260,"wires":[["16f81ac983ae6d0a","d3d2db86c70a3c09"]]},{"id":"576ea356da93195c","type":"inject","z":"b72068aa707669b0","name":"0","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":90,"y":260,"wires":[["a6f84e9dac9c30db"]]}]
But that still works for me, even when the 'read register' node is available. Could you please update the timings in my flow so that I can use it to reproduce the problem. Otherwise unfortunately I have no clue why it fails in your case...
First thanks for the node. This is exactly what I need in my project. I love the comprehensive documentation as well.
But I have a strange problem with the node when I try to read I2C registers in parallel.
Case: I have a PCF8574 attached to a raspberry PI. This chip has I/O Pins that can be used for switches etc. If anything changes on the I/O Pins an interrupt will be generated on a GPIO PIN (PIN 11 in my case). After the PI receives this interrupt, the register of the 8574 can be read via the I2C bus to determine which I/O port changed the status.
Flow: When I start the following flow by pressing a button, only the Read register part will be executed. The "Button events" node receives the msg object, but does not process the data as exepected. I checked that the node gets the msg object with the VSC remote debugger by setting a breakpoint in the input routine. But was not able to trace why the node is not working because the debugger goes way deep into several .js files and I was not able to follow.
In the following flow only the upper streams works. the 254 indicated that the I/O PIN 0 has been changed and brought back to normal after I released the button. The 0 and 1 come from the debug node at the bottom.
When i 'cut' the wire from the trigger to the read register, the "Button events" node works perfectly. Single and double clicks are recognized reliably.
I'd like to run the detection of the button press in parallel due to the requirement to read the I2C register as fast as possible and I'd like to avoid multiple nodes between the GPIO Node and Button events node.
Versions:
Expected behaviour: Node works as designed Behaviour: Node not working