[SOLVED] Dry contact switch items in OH2

hi all

ive managed to get my sliding gate working fine in OH2 with the following items and site map using a Sonoff on Tasmota.

The issue I have is the switch type, i have to press it a few times before it triggers - i believe becasue its not a push button or some other type. The switch item can’t be monitored I believe because the relay in the Sonoff is just connecting two wires, I use a camera to check if the gate is open or closed. But it would be nice to actually have the switch item/sitemap work correctly

Can anyone suggest a resolution?

ITEMS

Switch GateFully “Gate Fully Open” (gLight)
{ mqtt=">[broker:cmnd/gate/POWER1:command:*:default],
<[broker:stat/gate/POWER:state:default]" }

Switch GatePartial “Gate Partially Open” (gLight)
{ mqtt=">[broker:cmnd/gate/POWER2:command:*:default],
<[broker:stat/gate/POWER:state:default]" }

Switch Garage “Garage Open/Close” (gLight)
{ mqtt=">[broker:cmnd/gate/POWER3:command:*:default],
<[broker:stat/gate/POWER:state:default]" }

SITEMAP

 Frame label="Garage & Gate" {
           Switch item=GateFully         label="Gate Fully Open" icon="door"
           Switch item=GatePartial       label="Gate Partially Open" icon="door"
           Switch item=Garage            label="Garage Open/Close" icon="garagedoor"
           Switch item=GarageAVReceiver  label="Garage AV Receiver" icon="switch" 

}
}

What sonoff are you using?

1 Like

Im using the 4Channel PRO R2, with RF remote.

OK, and what is connected to what and how?
I am trying to understand what your items do command and how do you get feedback from the sonoff

So, on Channel 1 is the fully open setting for the Gate motor (2 wires). Channel 2 is the partially open setting for the Gate motor (another 2 wires). Channel 3 is for the garage door, which is currently unused
Basically when Channel 1 or Channel 2 wires are connected via the Sonoff, it opens the gate. If it connects again, it will close the gate.

Good, OK, the channel 1 to 4, the relays are output only. You will not get feedback from them. The information the sonoff sends back is more an acknowledgement that the relay has been triggered.
To get real feedback, you will need to wire a switch (or two) on each side your gate opening to the switches in the sonoff to act as contact sensors. then when the gate is fully closed or closed the switch will trigger the GPIO and the sonoff will send a payload according to which GPIO has been triggered.
Mode wiring and a more hardware I am afraid to get real feedback.

Thank you, understand now. I could wire a contact switch where the gate motor is - its right next to the Sonoff WIFI unit and I have one spare channel.

Would a single contact sensor do it? Can you recommend one thats black in color? and small? I also have ZWave if that helps

Could I use the 4th input of my Sonoff for this? Amazon.com

In terms of just the configuration of the item, is my setup fine?

Your set-up is fine, your item definitions will need some work.
I would contact the gate installer for the switch because you will need something weather proof and maintenance free.

I have a gate motor by Key Automation, ill drop them a line.

What do you mean, use some work? :smiley:

You will need another item to detect the switch, you don’t need the input mqtt in your binding.

So, I called my gate company, they went onsite and made some changes to the wiring and configuration and have ran me two new wires. They said that when the gate opens it triggers a light that stays on when open - he’s using the signal from that to two wires he’s ran into to my Sonoff.

Its setup as Normally Closed. Now all i need to do is detect the presense of that using the 4th free channel on my Sonoff Pro R2.

Can anyone suggest how? Basically I want to make the icon on in the site map show the Garage open or closed depending on the switch.

Have you made sure of the voltage of the two wires that is going into the sonoff?
It should be 3.3v max, anything more than 5v will probably fry your device…
What pins are the wires connected to?

Nothing is connected to the Sonoff yet. There will be no voltage on those wires from the motor.

What is the voltage on these wires when the light is on?

I dont know, this isnt a Sonoff basic. Remember this ia 4CH Pro, it has 240Volt AC input.

The 240VDC is for the power of the sonoff and what the relays can handle, NOT the digital input pins, these remain 3.3v because the heart of the device is still an ESP. You will need to step down that voltage before connecting it to the sonoff

OK, well as I mentioned its a dry contact from the gate motor. Ive connected the open/close wires from the motor into the sonoff and there was no issue. I dont see why this isnt the same

The wires to the motor are connected to the relays, they are designed to handle 240VDC and are electrically isolated from the electronics. The wires from the light, your open/closed feedback will be connected to the board directly. On this pin:

That looks like the 5 PIN header that I soldered onto to program.

Can you tell me more about what I need to configure Vincent? Thank you for helping me!

I can solder on some pins and place them onto those pins. Is it the first two?

The top pin, the one that I circled, badly, is GPIO9.
Before we connect anything we need to configure your tasmotta to use that pin as an input switch

can you send the following command to your device:
stat/gate/Gpios

And post what comes back, please?