Sonoff SV Gate controller with remote wifi button

I have a Sliding Gate to my Rear Garage. I used the ALEKO AC1400NOR Chain Driven Sliding Gate Opener

I have sucessfully gotten it working using digiblurDIY Guide to "Smart Garage Door Solutions", I just need to work out my open / close reed setup.

The 2nd part of this is where i'm having issues, I would like to be able to place a simple doorbell button(or 2), to be able to control the gate.
This way I could either Use the HA App on the phone, or simply push the button in the garage (or the house) and have it trigger my already working HA setup to open and or close the gate. I was hoping that i could use gpio14 on a secondary sonoff sv to register the push button, and pass that to the HA switch that controls the gate.

I entered the following Rule
Rule1 on switch2#state=0 do publish2 stat/%topic%/status ON endon on switch2#state=1 do publish2 stat/%topic%/status OFF endon

06:46:30 MQT: stat/Opener/status = ON (retained) When I push the button
06:46:34 RUL: SWITCH2#STATE=1 performs "publish2 stat/Opener/status OFF"
06:46:34 MQT: stat/Opener/status = OFF (retained) When I release the button

My idea for the sequence would be as follows

Button pushed reads stat/Opener/status = ON(or OFF) (I see that happen real time in Node-Red)
Which should send "ON" to cmnd/Gate/STATE

I assume I need some If / then Statement, But that's where I get lost...

Can anyone help me complete this flow?

My very simple code for that is below

[{"id":"29ead169.7df9be","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"c3ddd7b4.c344c","type":"debug","z":"29ead169.7df9be","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":550,"y":80,"wires":[]},{"id":"3f8a9b66.124bcc","type":"mqtt in","z":"29ead169.7df9be","name":"Garage Button","topic":"stat/Opener/status","qos":"0","datatype":"auto","broker":"3deb09ba.4feca6","x":100,"y":100,"wires":[["c3ddd7b4.c344c"]]},{"id":"55ccb95e.ffc8a","type":"mqtt out","z":"29ead169.7df9be","name":"Gate Control","topic":"cmnd/Gate/STATE","qos":"0","retain":"false","broker":"3deb09ba.4feca6","x":550,"y":200,"wires":[]},{"id":"3deb09ba.4feca6","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"192.168.33.61","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

What you posted isn't really telling anyone anything.

How about you post the node/s with those rules you mentioned?

You don't need to include the MQTTnodes. But rather a debug node should suffice.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.