Videx Buzzer alert/Automatic door opening switch on pressing Buzzer

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?

to make it easier… clearly this is now working as i can connect wirelessly to the logs

These very low numbers are the voltage at rest. Press the door bell and see if the voltage is recorded as much higher. As I said 5 reading will go by a second and you will have to scroll back. If the voltages don’t go up when you pressed door bell then INA219 isn’t reading the shunt voltage.

Each step your getting a little closer.
Does your Home assistant now have an entity switch.door_remote. If so create the card as described above to check you can manually open the door from HA.
Let me know how you got on and I’ll see it tomorrow.

ok checking now…will also check the switch and create it too. if you can give me 5 mins ill send you the readings now

ok here is the log. shows 9.4+

Sounds good and I see the relay turning on. If relay didn’t open the door then may be problem back with the physical wiring at the relay. Unless of course you can open it by a button on HA then it’s a problem with the esp32.yaml. :zzz: Good night.

ill test that now and see if it opens…will let you know.

Thanks again for all your help! Defo made good progress today and getting closer :smiley:

Sleep well

so this still doesnt exist for me, the switch.door_remote

Is there even a new entity Ina219 showing up in entities list? If not check the configuration panel and select integrations. Under Esp home it should have an entry for intercom.