MQTT Switch input rules not behaving as expected

Moderators: rtenklooster, Voyager, BertB, Stuntteam

Forum rules
You have entered the experimental forum, beware!!!
Post Reply
Message
Author
1968neil
New user
Posts: 8
Joined: 24 Jan 2018, 15:33

MQTT Switch input rules not behaving as expected

#1 Post by 1968neil » 10 Aug 2018, 11:52

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: MQTT Switch input rules not behaving as expected

#2 Post by grovkillen » 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?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Switch input rules not behaving as expected

#3 Post by TD-er » 10 Aug 2018, 22:22

And on what position in the Plugin/Devices list are these switch plugins set?
You should use one of the first few positions.

1968neil
New user
Posts: 8
Joined: 24 Jan 2018, 15:33

Re: MQTT Switch input rules not behaving as expected

#4 Post by 1968neil » 11 Aug 2018, 23:38

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: MQTT Switch input rules not behaving as expected

#5 Post by grovkillen » 12 Aug 2018, 09:38

Please update to latest version and test.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

1968neil
New user
Posts: 8
Joined: 24 Jan 2018, 15:33

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

#6 Post by 1968neil » 17 Aug 2018, 00:30

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

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests