Make a dumb doorbell smart with Shelly 1

I think you can make a webhook to trigger the HA API directly.
I used a PHP page which uses curl to trigger the HA API before I switched to using the MQTT solution. Not sure why the button behaves like that, but with this workaround you will catch every press of the button no matter how short it is.

Thanks again. Will try it either or. Just setup MQTT and got a first message. Otherwise, it is somehow overkill for a single message to set this up, because beside that I don’t use/nee MQTT (till now). :joy:

Perhaps I will give ShellyforHass another try and look if this behavior is there now as well. Had this, before I have just removed it to replace with core. Either this problem was not there or I didn’t only notice it.

I am using ShellyforHass, so the problem is also there :wink:

Ah. Ok. Then I can skip this. :joy:

Seems that HA (or webhooks in general, I’m not familiar with such things) only accepts POST and the Shelly BUTTON SWITCHED ON URL action uses GET.

Then I tried to have a plain htm file on HA, which calls the API via JS onload

    xhr_time.open('POST', "http://<ip>:<port>/api/services/input_boolean/turn_on", true); 
    xhr_time.setRequestHeader("Authorization", "Bearer <bearer>");
    xhr_time.setRequestHeader("content-type", "application/json");
    xhr_time.send(JSON.stringify({
        entity_id: "input_boolean.hausturklingel_helfer"
    }));

what is working without problems, if I open it in a web browser but not if I enter the URL in BUTTON SWITCHED ON URL action, most probably because there isn’t a JS interpreter etc.

Preferred would be, because enabled out of the box, the webhook. The website would be ok as well. If someone has any clue to get either or working, it would be appreciated.

The webhook solution indeed doesn’t work according to this post.

Do you have a webserver which can run a php page? Below the code for the page that I used.
Change the <your_ip> and <your_token_here> part in the code.

In the Shelly OUTPUT SWITCHED ON URL you put:
http://<webserver_ip>/<folder>/shelly_button.php?type=input_boolean&entity_id=doorbell_short_press&service=turn_on

<?php
    // get variables
    $type = $_GET["type"];
    $entity_id = $_GET["entity_id"];
    $service = $_GET["service"];

    // create curl resource
    $ch = curl_init();
    $data = array("entity_id" => $type . "." . $entity_id, );
    $data_string = json_encode($data);

    // set url
    curl_setopt($ch, CURLOPT_URL, "http://<your_ip>:8123/api/services/" . $type . "/" . $service);
    //curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Authorization: Bearer <your_token_here>",
        "Content-Type: application/json",
    ));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

    //return the transfer as a string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the output string
    $output = curl_exec($ch);

    // close curl resource to free up system resources
    curl_close($ch);

    echo $output
?>

Thanks again. And thanks for the link to the feature request as well. Didn’t find this before. And searched longer time. Don’t know, why I didn’t find. Was going to open that as well.

Anyway. I would have to setup a weserver for this. Some overkill as currently the MQTT server, etc. But what is a HA user not doing, if he needs it :joy:

But perhaps on of the devs will implement or accept a PR for web hook GET in the future.

Can anyone help me with the Shelly Plus1 please?


Button/Switch, is it detached mode?

Not sure what is the correct config to read the input state from the button press?

Looks like you need to set the pulldown to Switch instead of Button.
That should enable you to choose Follow and Match input which matches the settings from the Shelly 1 as shown below.

When you set the relay type to Detached the chime wont ring, you can use that for silent hours. See more info on this in the first post.

1 Like

Thank you sooo much @gerard33, will test and let you know if i run into issues :slight_smile:

@gerard33 Awesome project! I am also attempting this with my doorbell, but am running into a wiring issue as I have a slightly different model trafo/adapter.

Based on this topic, I got as far as the picture below shows. The left hand side shows the original situation without the Shelly and the right hand side shows the situation based on the wiring as explained in this topic.

The button works perfectly, the relais is clicking and in Home Assistant I am able to have HA sent a notification to my phone. There is only one issue: the chime is not working/the bell is not ringing…

As the blue wires from the adapter are not connected, and I suspect that is my problem. Should I switch the wires from the bell itself around? Or is there something else I am missing? :thinking:

Any help is greatly appreciated.

Thanks for your post. Let’s try to fix the last step :smiley:

Based on your picture it looks like you have change the position of 2 wires from the trafo to the chime. If that’s the case, than that’s not correct, keep those on the same position. Just place the Shelly via the O and I connection in between the blue wire. So the blue wire from the chime goes to O on the Shelly, then you can take another blue wire from the I of the Shelly to the position the blue wire was on the trafo when the chime was directly connected. The red wire from the chime to the trafo doesn’t need to change.

My picture was based on the wire schematic as I have found it in my house, but that’s not a standard scenario, see also this post.

Just see the Shelly as a switch which connects the blue wires once the doorbell is pressed.

Thanks for your reply, @gerard33. I managed to get it working, but had to use a slightly different schema. Basically there is a red and a blue wire going to the O and the 1 of the Shelly. This effectively replaces the button which also had a red and blue wire and therefore complete the circuit as the Shelly is activated. I attached the schema for reference purposes :slight_smile:

I had the same problem. Then I realized I have a four wire cable running to my doorbell. So I decided to disconnect the light from the switch, and connect it directly to the 2 spare wires.

Then I connected the spare wires (now connected to the light) to the bell transformer (8 VAC output)

Hi folks, anyone got this working in a 2 button and 2 chime setup or might know what the Shelly wiring would look like in that scenario?

Thanks for any suggestions!

I’ve made some progress I think. Both the binary_sensor.shelly_shsw_1_8caab56e410f_switch and the switch.shelly_shsw_1_8caab56e410f switch are on. I can’t seem to get the binary_sensor to be off while the switch is on, either both are on or both are off.

This is may be a dumb question, but my doorbell transformer is running on 12V AC → the doorbell → two chimes on different floors.
Now I was hoping to run the shelly on 230V and just stick the chime input into the shelly switch terminal. Will that work? Can the shelly handle different switch voltages?
What would be my other options? I’m not really interested in turning the chimes off at certain times, I just need the phone notification.
Edit: Shelly 1 is not able to handle 12V AC on the switch input.

To have instant notification, the best way is to use MQTT with the Shelly 1.
The Shelly integration takes too long, about 10 seconds in my case.
Night and day with MQTT.
Implemented on a Fermax intercom device. I had to replace the default 12VAC power by DC to power intercom and Shelly 1 using the same source.

Hi did you figure this out? I have the same situation in my home and really would like to add a shelly to my dumb doorbell.

Is there any way to “MQTT” this as wll via a MQTT switch? I read the API and listened to the topics, but didn’T find a way to set and listen according to the btn_types above.