Siedle HT 611 doorbell notification to Telegram (Shelly 1)

Moderator: leecollings

Post Reply
GeyerA
Posts: 12
Joined: Friday 18 September 2020 11:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Siedle HT 611 doorbell notification to Telegram (Shelly 1)

Post by GeyerA »

Hi, since I missed a couple of delivery services, I enhanced my old Siedle HT 611 to get a notification and picture to Telegram. I now used a Shelly 1 but will also try a Shelly Uni and completely customised solution using optocoupler with ESP8266 (espeasy).

Please make sure that you measure all voltages before; I can just guarantee the numbers for my station!

Preparation of Siedle:
I picked the signal of the ring button and switch a small relay (in the pic is an huge one which will be changed) to bridge the Shelly SW contact. So the relay is switched by the 7 and c contact from the Siedle station. If somebody pushed the doorbell button, the 7/c would jump to 13.2VAC.

Shelly 1:
My rectifier delivers 12VAC and 9VDC and luckily, the Shelly 1 does work with the provided DC power.
Shelly 1 contact L (-) is connected to 9 (Siedle). One cable from the rectifier is directly delivering 9VDC + which is wired to N (+) (Shelly). Then, a small cable from L (-) is put to the relay and the output signal of relay to SW on the Shelly.

Relay:
As mentioned, the 7/c (13.2VAC) will switch the relay and bridge between the L (-) and SW.

Shelly settings:
I will skip explanations on how to get the Shelly into your network etc. I will just focus on the getting the Domoticz switch to work.

Under Settings:
Power on default mode - "ON" - Configure Shelly device to turn ON, when it has power
Button Type - Edge Switch - Set Shelly device to be "Edge" switch. Changes state on every hit
Timer:
Auto Off - When On - Turn Off After 5 seconds
I/O URL actions:
OUTPUT SWITCHED ON URL:
Enabled
192.168.178.47:8080/json.htm?type=command&parm=switchlight&idx=59&switchcmd=On
OUTPUT SWITCHED OFF URL:
Enabled
192.168.178.47:8080/json.htm?type=command&parm=switchlight&idx=59&switchcmd=Off

Domoticz:
I created a dummy device and added On/Off switch. Note the idx and adjust the idx switched URL above (also IP obviously). I was not able to work with the doorbell switch so if somebody of you got some ideas, would be happy to try/know.

Code (lua script/device) for sending note and pictures to Telegram:
I will also not go through the process of creating a Telegram bot. Hope you have a good reference or maybe some thread in the forum here.
Cameras, also here I assume you already got some cameras in your Domoticz system. Not sure how to get the idx from camera; I made try and error.

I found the script while watching an YouTube video and had to fine tune the POST string since I was not able to make it work using the local bot variable. Credit to HOUSEDOMOTICZ https://sites.google.com/view/housedomo ... authuser=0

Code: Select all

-- service data chat telegram
-- local bot = 'xxxxxxxxxx';   -- Telegram Bot ID
local token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;   -- Telegram Bot Token
local chatId = 'xxxxxxxxx';   -- Telegram Chat ID
local message = 'Doorbell';   -- message subject

commandArray = {}
if (devicechanged['Doorbell'] == 'On') then -- example for sensor state

-- save snapshot in temporary location
os.execute('wget http://127.0.0.1:8080/camsnapshot.jpg?idx=4 && mv camsnapshot.jpg?idx=4 /var/tmp/snapshot4.jpg')
os.execute('wget http://127.0.0.1:8080/camsnapshot.jpg?idx=3 && mv camsnapshot.jpg?idx=3 /var/tmp/snapshot3.jpg')

-- send snapshot to Telegram
-- os.execute('curl -s -X POST "https://api.telegram.org/bot'..bot..':'..token..'/sendPhoto" -F chat_id='..chatId..' -F photo="@/var/tmp/snapshot.jpg " -F caption='..message..' ')
os.execute('curl -s -X POST "https://api.telegram.org/bot'..token..'/sendPhoto?chat_id='..chatId..'" -F photo="@/var/tmp/snapshot4.jpg"')
os.execute('curl -s -X POST "https://api.telegram.org/bot'..token..'/sendPhoto?chat_id='..chatId..'" -F photo="@/var/tmp/snapshot3.jpg" -F caption='..message..' ')

end
return commandArray
Have a look at the pictures and let me know if I can improve the switch to doorbell since I tried all conditions in the Shelly and did not get it to work in a better way especially because the auto-off in the Shelly will need to switch of my sensor in Domoticz. I have no clue how to do this with the doorbell switch.

I will update the thread once I was able to use the ESP8266 just to see if I can save some space to put all into the existing Siedle housing.
Attachments
Shelly 1.jpg
Shelly 1.jpg (158.2 KiB) Viewed 1751 times
Siedle HT 611.jpg
Siedle HT 611.jpg (270.96 KiB) Viewed 1751 times
GeyerA
Posts: 12
Joined: Friday 18 September 2020 11:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siedle HT 611 doorbell notification to Telegram (Shelly 1)

Post by GeyerA »

Hi, I removed the domoticz script and replaced it with a bash file which is triggered just when the switch is changing state to ON. With the lua script I experienced delay in taking the photo and might have not captured the person ringing the doorbell.
I also added a mp4 stream sent to Telegram. I now get a high resolution jpg and 8sec mp4 video....
Credit to the guys in this thread viewtopic.php?f=28&t=12730

doorbellmp4.sh

Code: Select all

#!/bin/sh
now=$(date +"%T")

SnapFileJPG="/var/tmp/frontdoor.jpg"
SnapFile="/var/tmp/frontdoorcam.mp4"    # Temp name of the video, change it when using this script for multiple cams
VideoLength=8     # Seconds to record
WaitTime=10       # Seconds the script waits before it sends another video
User=xxxxxx         # Username which has access to the RTSP stream
Password=xxxxxxx   # Password for above provided user
rtspUrl="rtsp://$User:[email protected]:8096/videoSub"   # Use https://sourceforge.net/projects/onvifdm/ to find your correct RTSP stream url
ChatID=xxxxxxxxxx    # Telegram chat ID   See https://www.domoticz.com/wiki/Installing_Telegram_Notification_System for setup instructions
TelegramAPIToken=xxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxx     # Telegram API token

filedate=`stat -L --format %Y $SnapFile`
retc=$?
if [ $retc -eq 0 ] ; then
        sec=$(( `date +%s`-$filedate))
        echo file found and age is $sec seconds
else
        sec=999
        echo File not found $SnapFile
fi
if [ $sec -gt $WaitTime ] ; then    
        echo file older than $WaitTime seconds:  $sec sending video
wget http://127.0.0.1:8080/camsnapshot.jpg?idx=4 && mv camsnapshot.jpg?idx=4 /var/tmp/frontdoor.jpg
curl -s -F chat_id=$ChatID -F photo="@$SnapFileJPG" https://api.telegram.org/bot$TelegramAPIToken/sendPhoto

ffmpeg -y -i $rtspUrl -r 30 -vcodec copy -an -t $VideoLength $SnapFile
curl -s -F chat_id=$ChatID -F video="@$SnapFile" -F caption="Doorbell ringing.." https://api.telegram.org/bot$TelegramAPIToken/sendVideo
else
        echo There was another try within $WaitTime seconds: $sec
fi
DoorbellSwitch.png
DoorbellSwitch.png (65.76 KiB) Viewed 1724 times
GeyerA
Posts: 12
Joined: Friday 18 September 2020 11:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siedle HT 611 doorbell notification to Telegram (Shelly 1)

Post by GeyerA »

Hi, I just wanted to share the final assembly. Found a small 12AC Finder relay and put the Shelly into the flush box behind the handset. I am surprised on the stable operation of the Shelly on 9VDC.
Just to be complete, I also tried two other solutions:
1. Shelly UNI. Works as the Shelly1 and despite the extremely small size, it could even perform much more tasks. I prefer to use that one for more complex jobs.
2. ESP8266 (flashed espeasy) and DC to DC converter (3.3V). Was also working well however needed to add a rule to drop the switch signal and envelope was too larger so I could not have mounted inside the doorbell handset.
Small relay.jpg
Small relay.jpg (220.99 KiB) Viewed 1710 times
Final assembly.jpg
Final assembly.jpg (257.51 KiB) Viewed 1710 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest