Videx Buzzer alert/Automatic door opening switch on pressing Buzzer

Was asked by @ Bikhs to share this

This is another Videx 3011 intercom project to open door/gate remotely and Buzzer/doorbell (used interchangeably to confuse) sensor and automation to open door when Buzzer sounds.

Parts

ESP32 development board

5 V Relay Module

INA219 DC current sensor

Dupont wires Female to female (20cm) x7

Other wire with no end connector about 60cm

5 v USB power supply for ESP32

When you open up the intercom there is a lot of room to fit components but you don’t want electrical shorts so I place parts accordingly.

I made a previous version of this that sensed the Buzzer by sound but there were a lot of false positives due to just closing doors a few feet away.

Probably easiest to program your ESP32 first using ESPhome addon.

esphome:
  name: intercom
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "Yourssid"
  password: "YourPa55word"
  fast_connect: false
  manual_ip:
    static_ip: 192.168.1.4
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
    dns2: 8.8.8.8
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Intercom Fallback Hotspot"
    password: "ReDaCtEd"


switch:
  - platform: gpio
    pin: 15
    id: relay
  - platform: template
    name: "Door Remote"
    icon: "mdi:door"
    turn_on_action:
    - switch.turn_on: relay
    - delay: 500ms
    - switch.turn_off: relay
    
  - platform: restart
    name: "Intercom.Node Restart"

i2c:
  sda: 21
  scl: 22
  scan: True
  id: bus_a

sensor:
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    shunt_voltage:
      name: "INA219 Shunt Voltage"
      filters:
        - multiply: 100
    max_voltage: 18.0V
    max_current: 3.2A
    update_interval: 0.2s 


  - platform: wifi_signal
    name: "Intercom WiFi Signal Sensor"
    update_interval: 60s

  

captive_portal:


    
# Enable logging
logger:
  level: INFO
# Enable Home Assistant API
api:

ota:

Someone might comment on a better way to use INA219 as I have it checking voltage on the line every 0.2 seconds.

Step 1 of the hadware
Connect relay to Videx terminal. Strip the ends of 2 Electrical wires and screw one in to Normally Open terminal of Relay and the other into Common terminal of Relay. The two other ends connect one each to 3 and 5 Videx Terminal. It doesn’t matter which way round you connect them. This is a dry relay with little current.
The Ground terminal of relay connect to a ground pin on ESP32 and the +V to 5 V on ESP32 by dupont wires.
Connect by dupont wire Pin15 to signal pin.( you can pick different pins but need to adjust ESPhome programme.

Step 2 of the hardware
In the picture I have hidden the wiring for the relay to make it easier to read.
Pic

Remove the wire from terminal 4 (call tone wire) and connect it to Vin+ at the top of the INA219. This is the only wire to be disconnected from the Videx. Take another wire and strip the ends and connect one end to Vin- and other back to terminal 4 on the Videx.

Connect by dupont +3V (ESP32) to Vcc (INA219) ,
GND (ESP32) to Gnd (INA219)
G21 to sda (INA219)
G22 to scl (INA219)

It does all fit back in to case. Bent pins a bit on ESP32 where Dupont connectors are. If I had a thinner USB power supply end I would have.

Back to the Home assistant

This is in my automations and set as a switch on the frontend of HA to turn on/off self buzz in. Would be crazy to leave on all the time.

- id: '1620237122004'
  alias: Door Buzzer auto open door
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.ina219_shunt_voltage
    above: '0.3'
    for: '0:00:0.1'
  condition: []
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.door_remote
  mode: single

The valve 0.3 might be different on your device. Adjust it to avoid false positives and false negatives.

Another automation to notify various devices like TV/Telegram that the door has buzzed

- id: '1612619661356'
  alias: 'Buzzer Door '
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.ina219_shunt_voltage
    above: '0.3'
    for: '0:00:0.1'
  condition: []
  action:
  - service: notify.home
    data:
      message: door Bell
  - service: notify.alien2br
    data:
      message: front doorbell
  mode: single

3 Likes

Thanks for this but I cant for the life of me work out how on earth I am meant to install the code to the board? Its really beginning to irritate me as i can only find rasberry pi tutorials and they all require SD cards but this version you recommended on your list of items has no mention of SD card slots or anything along those lines so cant figure out how on earth I am meant to install the software…any help please? A step by step tutorial for programming would be amazing.

Thanks in advance

Hi

I will assume you have already Homeassistant setup on a device like a Raspberry Pi.

From your computer you have logged into http://homeassistant.local:8123/lovelace/default_view
From the menu on the left select supervisor and then on the top of that page select add-on store.
Select ESPhome and install that.
When you have installed that select ESPhome from dashboard (top of screen of supervisor panel which was to the left of add-on store)and select open web-ui at right bottom screen.
Click on green circle at bottom right
You then put in a name for your ESPboard e.g. doorbuzzer and then add your wifi ssid and password. That should then appear on the screen when you click create.
paste in the text from the first box in the first post named esphome:
You need to make sure it has your details like static ip and gateway

When you have that finished you save it and install it to your ESP32 board.
To do this you will need to plug a usb cable into the back of the ESP32 and the other end into the computer.
See if you can get that far…
If any of that seems to go astray look it up on Youtube about using ESPhome.

Hey Spiro

Thanks for the reply

So I did manage to get it set up but it doesnt seem to work. When everything is connected and powered up, it just keeps the unlock button on a constant loop of unlock so basically it presses the unlock button constantly and doesnt activate only when the bell buzzer is pressed.

Ive coded the esp32 using the following code:

esphome:
name: intercom
platform: ESP32
board: esp-wrover-kit

wifi:
ssid: “CrewCabinsWifi”
password: “CabinCrew1”
fast_connect: false
manual_ip:
static_ip: 192.168.0.10
gateway: 192.168.0.1
subnet: 255.255.255.0
dns1: 192.168.0.1
dns2: 8.8.8.8

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Intercom Fallback Hotspot”
password: “CabinCrew1”

switch:

  • platform: gpio
    pin: 15
    id: relay

  • platform: template
    name: “Door Remote”
    icon: “mdi:door”
    turn_on_action:

    • switch.turn_on: relay
    • delay: 500ms
    • switch.turn_off: relay
  • platform: restart
    name: “Intercom.Node Restart”

i2c:
sda: 21
scl: 22
scan: True
id: bus_a

sensor:

  • platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    shunt_voltage:
    name: “INA219 Shunt Voltage”
    filters:
    - multiply: 100
    max_voltage: 18.0V
    max_current: 3.2A
    update_interval: 0.2s

  • platform: wifi_signal
    name: “Intercom WiFi Signal Sensor”
    update_interval: 60s

captive_portal:

Enable logging

logger:
level: INFO

Enable Home Assistant API

api:

ota:

I simply want the unlock buzzer to run for 5 seconds when the external buzzer is pressed. I dont need any connection to my phone or anything connected via wifi. Simply want it to run 24/7 so when the buzzer is pressed, it auto unlocks the front door for 5 seconds

I also get this error when flashing to the esp32

howing logs:
[14:24:30][I][logger:170]: Log initialized
[14:24:30][I][app:029]: Running through setup()…
[14:24:30][W][i2c:070]: Received NACK on transmit of address 0x40
[14:24:30][E][component:096]: Component was marked as failed.
[14:24:32][I][wifi:441]: - ‘CrewCabinsWifi’ (80:75:1F:F6:F5:02) ▂▄▆█
[14:24:32][I][wifi:250]: WiFi Connecting to ‘CrewCabinsWifi’…
[14:24:33][I][wifi:513]: WiFi Connected!
[14:24:33][I][app:059]: setup() finished successfully!
[14:24:33][I][app:105]: ESPHome version 1.20.0 compiled on Jul 26 2021, 14:19:02
[14:24:33][I][i2c:033]: Scanning i2c bus for active devices…
[14:24:33][I][i2c:049]: Found no i2c devices!
[14:24:34][E][ina219:136]: Communication with INA219 failed!

So relay keeping the door opens sounds like the wires are going between common and normally closed.

Can you see anywhere on the relay at the 3 screw terminals NC,C, NO. Different makers may swap the positions around.

The i2c isn’t recognizing the INA219. Try leaving out the line address: 0x40 to see if it finds the device automatically just incase your INA219 address is different.

Thanks for the quick reply buddy

So here is a pic of mine currently:

Ok so I swapped the cables around and the constant buzzing stopped. I originally had the wire going into the NO port and it was always buzzing so swapped to the NC and its stopped. Manual unlock from the handset works fine.

The i2c is loading and recognising fine now however upon pressing the external bell button, its not auto buzzing the person in. It just buzzes and does nothing.

I did change the 500ms value to 5000ms (i am assuming this is how long the relay is turned on for? i want it activated in door buzz for 5 seconds so am i correct assuming it should be 5000ms here below?)

  • switch.turn_on: relay
  • delay: 500ms
  • switch.turn_off: relay

Please help :slight_smile:

Good so far…

The relay just simulates what happens when you release the lock from inside.
If you only have to press the door release for 500ms on the inside then that’s
all you need to set relay for. Unless you do need to press the door release for
5 seconds to allow the person to come in.

  1. Test the door switch works by creating a switch on the overview panel
    click on the 3 vertical dots in top right hand corner and select edit dashboard
    select orange square with + sign and create a new panel.
    Give it a title and save.
    Press on button +add card
    select button card
    for entity select switch.door_remote
    select save
    Press the X at top right to close the editing of the page.

    Test the button on the card by pressing on it and see does door buzz open.

  2. If door buzzes open then move on to automation to open door from outside bell.

You can paste this into your /config/automations.yaml file.

- id: '1620237122004' #this is just number assigned when I set this up
  alias: Door Buzzer auto open door
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.ina219_shunt_voltage
    above: '0.3'
    for: '0:00:0.1'
  condition: []
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.door_remote
  mode: single

If you haven’t setup file editor program from supervisor panel I’ll show the other way.

On main screen select configuration panel which is usually below the supervisor panel.
Select automations.
select + add automations button
click on start with empty automation
Give it a name like automatic door opener

The 0.3 in the attributes section is number I get from checking the log of the ESP32 on the esphome addon on supervisor panel. I press the outside door bell and see what value shows up for the INA219.
I can get values as low as 0.5 but usually more like 0.9. Your INA219 may get different values from mine. Don’t want to set it too low in case it pick up stay signals. The 0:00:0.1 is the length of time you need to press the outside bell to set off the automation. This is 1/10th of a second.
Sometimes after making a new automation you need to reload automations by selecting
configuration then server controls then under YAML configuration reloading

select automations

Then test your automation by pressing the outside door bell. See how your getting on with that.

Thanks for this

So firstly there is no switch.door_remote entity on my list?!

Also “You can paste this into your /config/automations.yaml file.” I have no idea what automations.yaml file you are referring to. ive only ever created the first file coding you gave me called intercom.yaml which ive uploaded to the esp32…

On main Homeassistant panel If you select configuration on the left and then entities on the right.
In the search bar at top type switch.d and the switch you created on the ESP32 should appear along with any other switch starting with d.

Yeah the automations.yaml might be a bit deep to go so use the other method.
Select configuration from the Homeassistant panel and then automations on the right and create the connection that opens door on pressing door bell.

So first thing maybe to mention is when i connect my usb stick to my laptop, I cant actually see the device on homeassistant main screen as a connected device . I managed to get HTTPS version running and same issue so ive been compiling the code, manually downloading the bin file and using esphome flasher to install to the usb stick…

secondly as you can see from my pic here, these are the entities i can see, none of the ones we created in the code show up here and no matter how many times i flash it, it never shows as a connected device even though it says it connected to my wifi here…

It sounds like your ESP32 is not connecting to your network by wifi.

Is your esp32 saying online or offline?
When you put in your text about wifi: in response 4 every new line starts in the first space. You may have the correct spaces but I can’t tell as the reply formatter may have adjusted it. YAML is very fussy about indentation. It’s best to use the preformatted text button in the reply space. Moderators are very fussy about preformatted text. It makes it much easier to spot indentation mistakes.

But hey you are learning new stuff. :+1:
I don’t know how much you know about this HA stuff so let me know if you are missing out what I’m saying.

Mine always says offline :frowning:

All ive done is copy your original code you gave me on this thread and just changed my wifi values and IP and gateway, thats it. Ive never used yaml so I dont even know if after i copied your code, when its pasted back into my new intercom yaml, if its still correct but here is a screenshot. Other thought is if youre ok in doing so, I give you my wifi ssid and password, the ip and gateway and you input those into the code on your end and upload the code to me here? :smiley: that way I know the code is formatted how it should be so I can just copy and paste into the file??

and also to show you…my device is plugged directly into my laptop for this screenshot and where I’ve blue circled, you can see I do not see my device list here and you can also see my device is offline despite it being on, programmed and allegedly connected to my wifi during the flash phase…

Really annoying i can only upload 1 pic per reply lol

sensor:
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    shunt_voltage:
      name: "INA219 Shunt Voltage"
      on_value_range:
        above: 3
        then:
          - switch.turn_on: relay
          - delay: 500ms
          - switch.turn_off: relay
      filters:
        - multiply: 1000
    max_voltage: 18.0V
    max_current: 3.2A
    update_interval: 0.2s 

Here’s a idea try this to replace the sensor part in esp32 esphome program. This should open the door when you press the doorbell without having to talk to Home assistant at all. Again you might have to adjust the above 3 according to in the logs when you connect by usb cable to your esp32 what the INA219 reports as shunt voltage. I’ve increased the multiply: 100 to 1000 to bring it up from 0.3 to 3. You may also need to delete the address: 0x40 if that what it took to get INA219 working.

Thank buddy. Going to try now…let you know shortly the results…

right here is my log when i try to read it…

Can you humour me and just give me a completed code with the sensor bypassing HA?

ssid: CrewCabinsWifi
pass: CabinCrew1
Static IP: 192.168.0.30
Gateway: 192.168.0.1
My delay for the intercom to buzz should be 5 seconds as on my system, the unlock only works for how long you physically press the button so I want it to be a 5 second unlock from the time the external buzzer rings.

I dont need any smart access to it. Just needs to work 24/7 automatically :slight_smile:

esphome:
  name: intercom
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "CrewCabinsWifi"
  password: "CabinCrew1"
  fast_connect: false
  manual_ip:
    static_ip: 192.168.0.30
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 192.168.0.1
    dns2: 8.8.8.8
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Intercom Fallback Hotspot"
    password: "ReDaCtEd"


switch:
  - platform: gpio
    pin: 15
    id: relay
  - platform: template
    name: "Door Remote"
    icon: "mdi:door"
    turn_on_action:
    - switch.turn_on: relay
    - delay: 5000ms
    - switch.turn_off: relay
    
  - platform: restart
    name: "Intercom.Node Restart"

i2c:
  sda: 21
  scl: 22
  scan: True
  id: bus_a

sensor:
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    shunt_voltage:
      name: "INA219 Shunt Voltage"
      on_value_range:
        above: 3
        then:
          - switch.turn_on: relay
          - delay: 5000ms
          - switch.turn_off: relay
      filters:
        - multiply: 1000
    max_voltage: 18.0V
    max_current: 3.2A
    update_interval: 0.2s 




  

captive_portal:


    
# Enable logging
logger:
  level: DEBUG
# Enable Home Assistant API
api:

ota:

I think your wifi may not have connected as you didn’t put " " round the ssid and password which are strings. I have adjusted the logger level to DEBUG so when you check the logs you get a log in esphome like this.

when I press the door bell the voltage goes up to 0.89 which is above 0.3 I have set as lower level. The reason I think the voltage isn’t 0.0V is a difference in ground from the door buzzer and the ground of the ESP32. This voltage updates 5 times a second so by time I go out and press door bell and come back in 100’s of lines have gone by. If the above code runs press your door bell and see what voltage reads as you may have to adjust the above: 3. You may have to scroll up the log a bit.

Thank you so much. I am literally pressing the copy button and going to paste it into the file and manually flash it…ill message you in 15 mins with an update…

ok so it didnt work when i buzzed however this time when i installed via the esphome flasher, it gave me all sorts of readings which was a good sign.

when i click view log via the flasher, it says shunt voltage sending state -0.04000 and -0.05000

This means your code is clearly working this time than what ive been doing as its reading something now :slight_smile:

So what values do i need to adjust?