I have a dumb doorbell which I wanted to make smart so I get messages on my phone including a picture from the camera.
I was using a Xiaomi vibration sensor which I sticked to my chime, but there always was a delay and when someone only pushed the doorbell button very short it doesn’t (always) work.
After some research I found that a Shelly 1 would be able to do the job, but couldn’t find a connection diagram for this. After some help from the Dutch Tweakers forum and the Shelly Support site I have successfully installed the Shelly 1. In this post I will explain how I did this and share some usefull code as well.
With this solution you can:
- Receive messages when the doorbell button is pushed
- Turn the chime off on certain times (and still receive a messages when the doorbell button is pushed)
- Ring the doorbell via HA, can be useful for alarms etc.
What do you need
- Shelly 1
- 12V DC adapter
My doorbell button and chime are connected to a 8V transformer.
Preparing the adapter and the Shelly 1
- Make sure to set the bridge on the Shelly to 12V DC. Check the manual on how to do this.
- You have to strip the wires from the adapter in order to connect these to the Shelly 1.
Connecting the Shelly 1
See the connection diagram below on how to connect the adapter, the push button and chime to the Shelly 1.
The plus wire (normally the one with the stripes on it) goes to the N on the Shelly and the negative wire goes to the L.
Configuring the Shelly
Once the adapter is connected to a wall outlet you can configure the Shelly 1. I assume you have connected the Shelly to wifi and HA already and only mention the specific settings here.
- Set POWER ON DEFAULT MODE to SWITCH
- Set BUTTON TYPE to Toggle Switch
Configuration in HA
- When the doorbell button is pushed the binary sensor of the Shelly device will go from
off
toon
. You can listen to this state change with an automation as below where you have to change theentity_id
to the one of your Shelly 1.
- alias: Notification to phone when doorbell button is pushed
trigger:
- platform: state
entity_id: binary_sensor.shelly_doorbell_switch
to: 'on'
action:
- service: camera.snapshot
<etc>
- service: notify.telegram
<etc>
You can add a delay in the automation so you wont get multiple messages when someone is pushing the button multiple times in a short period.
- You can add a switch in HA which you can use to turn the chime on and off. You will still get a message from the automation above no mather of the chime state, as HA will still detect the doorbell button is pushed. You can make an automation to silence the chime at certain times.
In order to do this, we need to get the button type from the Shelly API and set it to Detached if we want the chime to be silent.
Add the code below to get a switch showing the current status of the chime. Pushing the switch in HA will either turn the Shelly in Detached (chime is not used) or Toggle (chime is used) mode.
Change the IP address to the one the Shelly is using (and set a fixed IP in your router).
switch:
- platform: rest
name: shelly_doorbell_chime_status
resource: http://192.168.1.187/settings/relay/0
body_on: 'btn_type=toggle'
body_off: 'btn_type=detached'
is_on_template: '{{ value_json.btn_type == "toggle" }}'
That’s it. Now you have made your dumb doorbell smart and it only takes a Shelly 1 and a 12V adapter.
Edit 14-02-2021
I noticed that when the button of the doorbell is only pressed for a very short period, the chime rang but HA wasn’t triggered. Played with some settings and couldn’t find a way to improve this, so now I have added under I/O URL actions
and then OUTPUT SWITCHED ON URL
an URL to a PHP page which is hosted on my NAS and triggers an input_boolean via the HA API. I use that input_boolean as an extra trigger in my automation. Using this also a very short press on the button is noticed and I get the notification.
Or see this post for a solution via MQTT.