Page 1 of 1

MQTT Switch input rules not behaving as expected

Posted: 10 Aug 2018, 11:52
by 1968neil
Hi Guys,
This is driving me insane !
I have three switch inputs, all pulled high by a 10k resistor.
If taken low they should publish an MQTT message to openhab.
They are all set up the same with a different message.

Only one works ?
The rules are as follows :

On Security#DoorSensor6 do
If [Security#DoorSensor6]=0
Publish Landing/Security/DoorSensor6,CLOSED
Else
Publish Landing/Security/DoorSensor6,OPEN
Endif
Endon

The problem appears to be that the open doesn't get sent, the closed one does.
This only happens on the 2nd and third switch.
I have tried separate rules for all three switches (rules set 1,2,3) and all in one rule to no avail ?
Is this a bug or am i missing something ?
The switch inputs are D1,D2,D3 on a wemos d1 mini

If i view whats happening in MQTT.fx it appears that the 2nd & Third switches send closed when they should send open ?
Any help appreciated :)

Regards
Neil

Re: MQTT Switch input rules not behaving as expected

Posted: 10 Aug 2018, 19:12
by grovkillen
What GPIOs are you connecting these switches to? Are the switches behaving okay, as in are they 1 on high and 0 on low etc?

Re: MQTT Switch input rules not behaving as expected

Posted: 10 Aug 2018, 22:22
by TD-er
And on what position in the Plugin/Devices list are these switch plugins set?
You should use one of the first few positions.

Re: MQTT Switch input rules not behaving as expected

Posted: 11 Aug 2018, 23:38
by 1968neil
grovkillen wrote: 10 Aug 2018, 19:12 What GPIOs are you connecting these switches to? Are the switches behaving okay, as in are they 1 on high and 0 on low etc?
GPIO 0
GPIO 4
GPIO 5
They are switches 1 2 3 in the device list and all show one and zero as expected when switch pressed, but the mqtt message on two of the switches is always closed.......ie: its sends closed either way if i press switch is says closed and when i let go it says closed rather than open etc.

Using mega-20180606

Cheers
Neil

Re: MQTT Switch input rules not behaving as expected

Posted: 12 Aug 2018, 09:38
by grovkillen
Please update to latest version and test.

Re: MQTT Switch input rules not behaving as expected {solved}

Posted: 17 Aug 2018, 00:30
by 1968neil
By adding 1, 2, 3 after the word security.....
Works fine now....



Thanks for the reply,

Updated to latest firmware as recommended.
Exactly the same.......

My rules are as follows :

On Security#DoorSensor6 do
If [Security#DoorSensor6]=0
Publish Landing/Security/DoorSensor6,CLOSED
Else
Publish Landing/Security/DoorSensor6,OPEN
Endif
Endon

On Security#DoorSensor7 do
If [Security#DoorSensor7]=0
Publish Landing/Security/DoorSensor7,CLOSED
Else
Publish Landing/Security/DoorSensor7,OPEN
Endif
Endon

On Security#DoorSensor8 do
If [Security#DoorSensor8]=0
Publish Landing/Security/DoorSensor8,CLOSED
Else
Publish Landing/Security/DoorSensor8,OPEN
Endif
Endon

Door sensor 8 is the only one that behaves as expected
Running mega-20180815

Regards
Neil