How To: Driveway Swing Gate Automation (Shelly + BFT) - Working Perfectly with states!

How To: Driveway Swing Gate Automation (Shelly 1 + BFT) - Working Perfectly with states!

New Home Assistant user & first time poster. I’m posting this hoping to help anyone looking to set up an automated smart driveway gate. It also helps remind me if I need to redo something!

All you need is your gate & motor, access to the control board, and a Shelly 1. No need for a reed switch or to solder an existing remote. Firstly, thanks to the many others who have posted the guides, tips and tricks I’ve used to get this up and running.

Background: a couple of weeks ago I got sick of not knowing if our garage door and driveway gate were open or closed when out and about, and sick of the useless (slow, flaky, can’t add other users) implementation of BFT’s U-control App to control the driveway gate. It’s also helpful to open and close the gate remotely for tradesmen, and to know if the gate is open when we’re away. All the standard good stuff.

Anyway, after a bit of reading here and on other sites, and watching a few Youtube vids, I installed Home Assistant on a spare Pi 3B+ and wired the Shelly 1 and a reed switch into our garage door. Worked great!

Inspired, I then reinstalled Home Assistant on an NUC in a virtualbox. Even better than the Pi (faster, easier to backup the virtual disc than a microSD card). So far so good.

Further inspired, it was time to tackle the driveway gate. There are a few scattered tutorials here and elsewhere, but fewer for gates than for garages. Perhaps more folks have garage doors compared to driveway gates?

Anyway the gear is:

  1. Gate motor: BFT Kustos Ultra BT A40 (https://www.bft-automation.com/en_INT/family-detail/motors-and-kit-for-swing-gates-with-covered-worm-screw-and-u-link-technology-kustos-ultra-bt-a/)
  2. Gate control and power board: BFT Thalia (https://www.bft-automation.com/en_GB/family-detail/thalia/)
  3. Shelly 1 (powered from 12V in my case, but your board should also have 24V or 110/240V)

Steps:

  1. Wire your Shelly’s power terminals directly onto your gate control board’s power. Most have a 24V DC auxiliary output. I initially used a 240V feed, since something was wrong with my board’s voltage. I subsequently wired in a spare 12V DC adapter to the board’s 240V feed … either way - get that Shelly powered up!

  2. Using the Shelly app, integrate your new Shelly into your wifi and LAN. I kept mine on stock firmware rather than tasmota, and am using mqtt. I named the Shelly “Shelly-BFT” as a custom mqtt prefix using the Shelly’s on-board config page.

  3. You’ll also need to set the Shelly as a “detached switch”, power on default mode “Off”, Timer: “Auto Off” after 0.5 seconds, and in the Shelly App, set Input State to “Add input state identifier to the power button”.

  4. (Turn off the power). Wire the ‘0’ and ‘I’ terminals of the Shelly to the two terminals on your gate’s control board which are able to send a “start” command. In the Thalia’s case this is terminals #60 (COM) and #61 (IC 1). On the Thalia, the IC 1 can be user configured. I set mine to “Start I”, which closes the contact momentarily (0.5sec) and starts the motor.

  5. Finally, wire the ‘SW’ input of the Shelly to the terminal #26 of the Thalia (AUX output N.O) and terminal #27 to the L(-). You can also use terminals #20 and #21.

  6. (turn power back on). Using the Thalia’s controls, set terminals #26 and 27 (or #20 and 21 if you used those) to “Aux logic= 1 - SCA GATE OPEN LIGHT output”. This setting keeps the contact closed during gate opening and with the leaf open, intermittent during closing, and contact is open with leaf closed. In other words - it will tell you when the gate is open, closing and closed!

  7. To get the switch to register in HA (via mqtt), use the following in configuration.yaml:

# Driveway Gate
  - platform: mqtt
    name: "BFT-Gate"
    command_topic: "shellies/Shelly-BFT/relay/0/command"
    state_topic: "shellies/Shelly-BFT/input/0"
    qos: 1
    retain: false
    payload_open: "on"
    payload_close: "on"
    payload_stop: "on"
    state_open: "1"
    state_closed: "0"
  1. Add this to your customize.yaml file:
cover.bft_gate:
  device_class: gate
  1. You can then add the entity “cover.bft_gate” to your dashboard:

  2. To get a nice coloured switch, which opens the gate and holds it open (depending on the Logic you have your gate set to) and which changes to a red open-gate icon when the gate is open, and flashes open and closed as the gate closes (just like an alarm closing light would), use the following (with custom-button addon installed from HACS):

type: custom:button-card
entity: cover.bft_gate
name: Open Gate and Hold
icon: mdi:gate
styles:
  card:
    - height: 150px
show_state: true
show_name: true
show_icon: true
tap_action:
  action: call-service
  service: automation.trigger
  service_data:
    entity_id: automation.open_gate_and_hold
state:
  - value: closed
    color: rgb(72,116,156)  #sets the colour to the default Lovelace navy blue
    icon: mdi:gate
  - value: open
    color: red
    icon: mdi:gate-open
  1. Finally, you can set up a trigger for an automation to open the gate as you’re returning home, using a standard automation and trigger call with your cell phone(s’) location.

Enjoy!

10 Likes

Tnx,I will try it very soon and let you know,if it works.Sorry about my english!

Can you share wiring please?

Oh,I got BFT Zara,not Thalia.Zaras controller dont have programmabe AUX,so i used Sonoff ZBBasic,powered it with 5v,so i got dry contact,then i connected Thalias pins 60 and 61 to the Sonoffs input L and output L. Then i make automation,that turns off Sonoffs relay after 0,5sek.On the gates i put door and window sensor,and ewerithing works like a charm! Anyway,thanks for idea!! Again,sorry about my english !

Pleased to hear it worked out for you!

Hey Curtis,

Great write up! I was excited to read this, as I was considering buying BFT’s expensive wifi module for my BFT DEIMOS BT A400 motor. It seems to have all the same terminals you used as well. So I bought myself two Shelly Plus 1’s, and I’ve hooked one up to my garage door opener, which supplies 12v and works fine to control it.

I’ve now tried to get the Shelly Plus 1 working with the BFT motor, however it doesn’t seem to want to work with the 24v DC terminals. It doesn’t power up at all (no access point published). I’ve confirmed with a multimeter that power is running in to the Shelly (25.7v to be exact). I’ve also confirmed the same Shelly works on 12v and 240v. Is this the same problem you were having with your unit???

BFT400 Manual

Cheers,
David

Thanks Curtis,

Very helpful. I’d been looking at solutions for my BFT Ultra Ares 1500 for a while but hadn’t realised you could get the state from AUX3 as well.

I’ve set this up with the configuration you describe using a Z-Wave Fibaro Implant FBGS 222. I tried to be a bit too smart and took the power off the expansion port on the Ultra board (but I realised two issues - firstly I’d chosen the wrong pins and killed the gate controller board (an expensive error). The second issue is the output of ~34V DC (rectified from the transformer output of 24V AC RMS) was higher than the max for the Fibaro implant. (9-30V).

When using the Fibaro Implant you need to change the Local Protection State to NoOperationPossible this disconnects the output from the input.

I set one of the outputs from the Fibaro to open the gate fully and the second to operate the pedestrian mode. Let me know if you want more detail

All working well now. Can do Full open or Pedestrian, and the Input for the Fibaro is set as a Normal Open Alarm Input. Hence I see Home Security - Intrusion goes from Safe to Unsafe when opening and open and flashing between Safe and Unsafe as it closes.

One downside with AUX3 set to Mode 1, you can no longer use the second button on the remote control to activate Pedestrian mode.

Nex step is to copy some of the Lovelace stuff you used, and also setup some geolocation triggers to open the gate as you are ~200 meters away (and driving not walking).

One other issue I’ve found with the Fibaro Implants that are power from another power source (rather than the circuit you are connecting to) is that it is important to figure out if there are any ground connections when using the Inputs, and you need to make sure you use the ground on the Fibaro to connect to the ground on the other board you are controlling, otherwise you get unreliable inputs.

sos_nz tnks 4 sharing. maybe we could buy a shelly 1 + add on and read current bft status (open/closed) from addon wired to terminals #26 and 27 (or #20 and 21) ?


(https://www.shellyitalia.com/sensore-di-temperatura-addon-promo/?gclid=CjwKCAjwloCSBhAeEiwA3hVo_QGEIttekxt9vOCzNTzdwFIgy9nGHVHk1usiDokYDYZHoGVLlUuuixoC7fMQAvD_BwE )

I think I’ve answered my own question about this. I’ve re-measure the output from the 24v AUX terminals and it is AC not DC! So now I’ll look in to a small enough AC/DC converter or see if it’s possible to tap in to the 240v terminals.

Thank you @sos_nz for the great project! I adopted it and did some improvements:

  1. I used Shelly Uni instead of Shelly 1 - it has 2 outputs, 2 switch inputs and sensor inputs. The main benefit is you can have separate Open and Close actions - instead of single button, when you never can be sure of the current action (eg. after reset, activating safety). It also has an external antenna, which is great for a gate usually far from home. And it works off 24V. And is even smaller than the 1. And is just as cheap. The full package.
  2. Output 1 wired to terminal #61 (+#60 COM) - logic set to IC=2 : Open
  3. Output 2 wired to terminal #62 (+#60 COM) - logic set to IC=3 : Close
  4. Input 1 wired to terminal #20-21. Logic Aux=6. Normally I have a warning light attached here, which signals that the gate is moving. I can’t change it - but it’s actually very useful to read it, because I have information “gate is moving”. This is easier than detecting signal that goes on-off-on-off with Aux=1 logic.
  5. Input 2 wired to terminal #26-27. Logic Aux=8 - contact closed if gate is closed. So actually I have a reed sensor. But I’m experimenting with other options ATM.
  6. As a bonus, you can attach a temperature sensor to one of the dedicated inputs, eg. to detect frost.
    Below is how the module looks.

    Thanks again @sos_nz, I did all of this thanks to your post :smile:
2 Likes

As another way to skin a cat with HA. I use a mimolite with my Z-Wave network. Posted about it here: Swing Gate sensor - #2 by Markus99

This has been working great for me for a few years now.

Doesn’t require any soldering either. Just a couple of jumper cables into my gate ‘motherboard’, battery and open/close sensor.

Hi,

I am a software engineer and a bit uninformed regarding electrical circuits!

I am try to connect my BFT ultra sliding gate to Shelly uni!

First question.
@Khar how do you power your Shelly uni?

Second question.
@Khar you mentioned that you connect Shelly’s input 1 to BFT board AUX0 (20-21). Input 1 has only one wire connection, but connect two input pins on BFT board ? Where does the second one come from ? Is it the L pin on shelly uni?

Hi Curtis,

Thanks for sharing your great project! would be very useful if we can make it working…

I’ve got Shelly 1 and BFT and planning to replicate your project. Port 51 of my BFT board doesn’t have +24V, so when I check the voltage difference between Terminal# 51 and Terminal# 60 (COM), it shows almost -24V, that’s also the same with the voltage difference between 50 and 60. Did you face with the same issue that you decided to use AC to 12V DC converter?
Would you please share your wiring diagram? My concern is connecting SW to Terminal #27 and L(-) to Terminal #26. I need to make sure I’m wiring the Ground (or COM) correctly to L(-) so I don’t burn my BFT Control board.
Thanks!

I’ll try to help @vh13294.

how do you power your Shelly uni?

Terminals #50-51, it’s DC 24V. Shelly’s L (pin 1) goes to 24V+, shelly’s N (pin 2) goes to 24V-. Please double-check, you shouldn’t mix + and - when operating on DC, it can potentially damage the device.

you mentioned that you connect Shelly’s input 1 to BFT board AUX0 (20-21). Input 1 has only one wire connection, but connect two input pins on BFT board ? Where does the second one come from ? Is it the L pin on shelly uni?

You only connect one input wire of Shelly to terminal #20. It will be High/On when the contact is closed, Low/Off, when the contact is open.

Please note that while terminal #20-21 has its own power, terminal #26-27 is a “dry contact” - if you plan to use #26-27 as well, you have to:

  1. connect terminal #27 to #51 to get power (just get any short wire)
  2. connect shelly’s input wire to terminal #26

If you have any more questions, pls. let me know.

Thanks! @Khar, you are a life saver!

Sorry to bother you with more questions.

  • My 24V pins are already connected to two photocells, is it enough to power the Shelly uni as well ?

  • For the output pins of Shelly uni, does the order of +/- matter? Since it is powered by DC, the output must be DC as well?
    But I can’t determine which output terminal is +/-. Is it the one that label N / GND = Negative ?

  • Would you mind sharing me your yaml config ?

Yes, there will be enough power.
For shelly’s outputs the order doesn’t matter - they are “dry contacts”, meaning they are not connected to any power. When they close they just create a short between 2 wires. Actually, you can understand how it works with a simple test - take a paperclip and try connecting terminals 61-60 or 62-60, it should give the appropriate command to gate.
Sorry, can’t share the YAML with you because I decided to reprogram the Shelly with ESPHome, so there is no YAML in HA, but all logic is inside my program. I’m still not happy about it, I need more time to get finished - basically it works for simple open / close / monitor current position based on time. But scenarios when somebody uses remote externally during operation are tricky. I have to move to generic cover component, which means writing a lot of code in C++ (lambdas). In turn, this is not my strongest point, I’m much better at electronics :slight_smile:
Good luck @vh13294! If you need more info, just ask.

Hi. I grabbed a Shelly Uni also to try instead of an ACDC converter for the Shelly 1. I got the unit device and just tried to do a simple power load test to see if I could get a access point published.

I have a BFT Deimos Merak control board also, that outputs 24VAC from terminals 50-51, so I just connected the Shelly Uni Pin 1 and 2. (51 > 1, 50 > 2) while turned off.

When I powered the motor on, the Shelly Uni capacitor was smoking, and an led was blinking on it. I even briefly saw the access point appear. I powered off the gate, but when I powered it on again, the Shelly Uni was dead. Fried. So I’m back to the drawing board again. Hopefully someone with more electrical knowledge can tell me why this might have happened.

Hey @sos_nz.

Coming across this thread in May 2022, is there anything you’d change if you did it again? I’m looking to automate my twin driveway gates here (UK) and have a remotely accessible and very stable HA that I’d like to use. I’m happy enough making devices with ESP8266 and relays, so might go ESPHome rather than Shelly, but am not decided. I have power at the gate, but the motors and control board the previous owner of this house fitted are no longer happy. I’m not sure they’ve ever worked, so will buy the Kustos if you still rate it.

I have wifi reception down at the gatepost (so says my phone), but haven’t checked it with a Shelly inside an enclosure. Am feeling like @vh13294’s advice re the Shelly Uni might be an idea for its size, power and external antenna.

With your setup, do you just have access to the ‘open/closed’ state, or can you also see ‘moving’?
I’ve rigged my garage doors up with a SONOFF 4ch and they just show me ‘open’ as soon as the rollers start to lift, which is ok but could be improved.

Oh, and incase it changes things, I’ll probably add a video doorbell in the future.

Cheers for any advice you can give.

Hey @Andy_Allsopp, I did it using ESPHome. For device I used Shelly Uni - it’s very convenient, already powered by 24V, 2 inputs, 2 dry contact relays, external antenna already attached, protected from environment - see my posts above.

1 Like

Got you. Thanks for this. Am thinking I may want to read the photo sensors to flag to HA that it’s obstructed, so I’m thinking perhaps I need more inputs.

Also, I may be getting a Roger solution, with an Edge controller, so some different circuits to play with.