Old doorbell (12-26 VAC) Shelly Plus UNI

My doorbell is an old one from around 1960, Friedland 752 doorbell. It is powered by an AC 230V to AVC 14V. Wanted to have the original chime with the nice sound.
Earlier I used Shelly1, but now I need a Bluetooth relay in my hallway.

This is what I want my doorbell to do:
• Limit the time between button pushes, friends can’t irritate by pressing the button several times in a row
• Notifications from Home Assistant
• Disable chime nighttime or when I want
• Ring chime from phone, if I need
• Bluetooth relay

Hardware:
• Shelly Plus UNI
• Relay
• Wago connectors
• New button, without light

The old button has light that runs on AC, hence the new button.
Shelly Plus UNI’s relay’s Max switching current is 250-300 mA
I’m not sure if Shelly’s relay is strong enough to do the job by itself.

I did not find any ESPHome or GPIO documentation for Shelly Plus UNI, so I had to do many try and error tests.

This is what I found out:
GPIO0 - Onboard LED
GPIO19 - Relay Out1
GPIO21 - Relay Out2
GPIO38 - IN1, PIN9
GPIO37 - IN2, PIN10
This is what I need, have not tried to find the other pins.

Connections:
Shelly
Pin1 to one main power
Pin2 to other main power
Pin6 to Relay VCC (DC+) and one OUT1
Pin7 to Relay Ground (DC-) and Button
Pin9 to Button
OUT1 (Second) wire to Relay Signal/IN
Relay COM to one main power
Relay NO to Chime
Chime to other main power
shelly_uni

Code:

substitutions:
  devicename: 'doorbell-plusuni'
  friendly_name: 'Doorbell PlusUNI'
  
  chime_delay: '30s'          # Chime reactivation delay
  button_delay: '0.2s'        # Button push release delay
  remote_button_delay: '0.5s' # Mobile push release delay
  hide_relay1: 'true'         # Hide from frontend 'true', Show in frontend 'false'

esphome:
  name: ${devicename}
  friendly_name: $friendly_name

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: arduino

logger:
  level: DEBUG
  logs:
    component: ERROR

api:
  encryption:
    key: !secret esphome_api_key

ota:
  - platform: esphome
    password: !secret esphome_api_password

wifi:
  ssid: !secret wifi_iot_ssid
  password: !secret wifi_iot_password

  ap:
    ssid: "$friendly_name"
    password: !secret fallback_ap_password

captive_portal:

web_server:
  port: 80
  auth:
    username: !secret admin_user
    password: !secret fallback_ap_password    

globals:
  - id: chime_bool
    type: bool
    restore_value: true
    initial_value: 'true'

output:
  - platform: gpio
    id: relay_output_1
    pin: GPIO19

switch:
  - platform: output
    id: relay_1
    name: "Chime Relay"
    output: "relay_output_1"
    internal: $hide_relay1

  ## Remote Ring for mobile, frontend and where ever you need...
  - platform: template
    id: remote_button
    name: "Remote Button"
    turn_on_action:
    - switch.turn_on: relay_1
    - delay: $remote_button_delay
    - switch.turn_off: relay_1

  ## Virtual switch for chime global variable.
  - platform: template
    id: chime_active
    name: "Chime Active"
    restore_mode: RESTORE_DEFAULT_ON
    turn_on_action:
      - globals.set:
          id: chime_bool
          value: 'true'
    turn_off_action:
      - globals.set:
          id: chime_bool
          value: 'false'
    lambda: |-
      return id(chime_bool);

  - platform: restart
    id: reboot
    name: "System Reboot"

binary_sensor:
  ## Doorbell button push.
  - platform: gpio
    pin: GPIO38
    id: push_button
    name: "Chime Button"
    internal: true
    on_press:
    ## Only turn on the chime when it is active.
          if:
            condition:
              - switch.is_on: chime_active
            then:
              - binary_sensor.template.publish:
                  id: button_notify
                  state: ON
              - switch.turn_on: relay_1
              - delay: $button_delay
              - switch.turn_off: relay_1
              - switch.turn_off: chime_active
              - delay: $chime_delay
              - switch.turn_on: chime_active
              - binary_sensor.template.publish:
                  id: button_notify
                  state: OFF
            else:
              - binary_sensor.template.publish:
                  id: button_notify
                  state: ON
              - delay: $chime_delay
              - binary_sensor.template.publish:
                  id: button_notify
                  state: OFF

# Dummy button for notifications
  - platform: template
    id: button_notify
    name: "Notify"

# Bluetooth proxy
bluetooth_proxy:
  active: true
esp32_ble_tracker:
  scan_parameters:
    active: true
3 Likes

I don’t have a uni plus, just a uni. However I believe the Shelly integration would do all this.

You have nice friends. :joy:

Anyway, nicely done.

Shelly’s original firmware can’t act as a Bluetooth Proxy.

True, good point.

Yes, it can

1 Like

It can, if i know correctly. I have shelly plus S and i have it turned on, because i have door/window sensor, which works via BT. It’s called “BT gateway”:

1 Like

Hello,

Did you found out all the gpios for Shelly Plus UNI?

@echo what is your pings with your config? could you please check?
with stock shelly firmware i had 2-10ms stable pings
with esphome i get 50-400ms pings

Ping question: I get around 8-20ms in ping. I have my AP close to the Shelly unit, in the same room.

Pins question: I have not had any projects where I need the other pins yet. So sorry no new pins.

I was able to fix ping problem with following config:


esphome:
  name: shelly-plus-uni
  friendly_name: Shelly Plus Uni
  platformio_options:
    board_build.f_cpu: 160000000L

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_FREERTOS_UNICORE: y
      CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y
      CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"

Just for community, here are all GPIOs i found and tested for Shelly Plus Uni:
GPIO18 - Onboard LED
GPIO19 - Relay Out1
GPIO21 - Relay Out2
GPIO36 - ADC, PIN3
GPIO37 - IN2, PIN10
GPIO38 - IN1, PIN9
GPIO39 - COUNT, PIN8 (works as normal GPIO IN)

(not tested)
GPIO25 - to switch ADC range test from 0-15 to 0-30 VDC
GPIO13 - DATA PIN