Open narolinus opened 7 years ago
I think I found the source of the problem: The item changes it state to "ON" after pressing the switch button and keeps this state for around 2 seconds.
Adding a switch-node (checking for "ON") and a trigger-node (50ms) between the openhab2-in-node and the openhab2-out node fixes the repetition-problem. Sadly it adds around a second to the delay. I also tried to use a Node-RED instance on my pc, thinking the Pi could be to slow to interpret those rules. It did not change the delay. This is strange.
Adding a Node-RED-UI with buttons to trigger the openhab2-out-nodes, showed the switching itself works flawlessly and almost instantly (as MQTT-messages did).
hi narolinus, I've been mostly away from home the last 2 weeks. Sorry for the delay in answering. I'll try to reproduce the problem here and find out what the cause is.
Hi @narolinus, I did some tests with a virtual switch and a z-wave light switch and I don't experience any delays at all.
I use OpenHAB2 and Node-Red on a Raspberry Pi 3 with OpenHABian. My current setup is:
I wired up both in Node-RED via four OpenHAB2-nodes as follows:
openhab2-in (ItemName=PRESS_1_SHORT) --> openhab2-out (ItemName=STATE, Topic=ItemCommand, Payload=ON)
and
openhab2-in (ItemName=PRESS_2_SHORT) --> openhab2-out (ItemName=STATE, Topic=ItemCommand, Payload=OFF)
This works, but with a noticeable delay of 1 to 2 seconds. Sometimes the ON-Command is repeated and the wall plug turns ON, OFF and ON again. This habens allways, if both events (PRESS_1, PRESS_2) follow shortly after each other.
I can observe this in the OpenHAB-UI and on the device itself. Using debug-nodes in Node-RED does not show anything suspicious.
If I use OpenHAB-Rules or MQTT-messages via OpenHAB-MQTT-Binding, the switching works almost instantly and without repetitions, but I really want to use Node-RED with your Nodes, because it is much nicer and simpler to deploy rules with it.
What am I doing wrong?