
I have this homemade Doorbell, which i have been using for some time now.
It's a standalone wireless doorbell, which i hacked and connected to the GPIO24 through/via a optocoubler for protecting the Pi.
The signal, which is sended from the bell, is around 3,5 - 4 Vdc... then this signal is converted into 3,0 Vdc via, as i described the optocoubler.
Anyway, the signal is fast pulsing, so there will be hundreds of pulses on the input, everytime someone push the doorbell buttom.
Until now i managed to use a Bashscript (Se below), but sometimes Domoticz is driven into 80-100% CPU useage, when using the doorbell.
I think it's a combine of filling the virtual switch which executes the script, whith hundreds of log lines

So i was woundering if someone have an idea of howto solve this? -My thoughts was to completly avoid the Domoticz, and then let a Python daemon or like control this input? -Any ideas -Any code snippet?
Thanks everybody in advance !
Rgds; Jesper
Link to thread i opened in "Show youre projects" :
http://www.domoticz.com/forum/viewtopic ... 38&t=11304
Code: Select all
#!/bin/bash
SCRIPTDIR=/home/pi/scripts/doorbell
MESSAGE_1=$SCRIPTDIR/MESSAGE_1_ON_OFF
if [ ! -e $MESSAGE_1 ]; then
touch $MESSAGE_1
echo 0 > $MESSAGE_1
fi
chown pi:pi $MESSAGE_1
EXECUTE_ON_OFF=$(cat $MESSAGE_1)
TOKEN=xxx:xxx
TEXT="HEY... DOORBELL"
CHAT_ID=xxx
RSER=192.168.1.121
RSER_PORT=8080
RIDX=71
SLEEPTIME=60 # Must be set to minimum time of MP3 tune (Seconds)
UNIXTIME=$(date +%s) # %s seconds since 1970-01-01 00:00:00 UTC
TIME1=$SCRIPTDIR/TIME1
if [ ! -e $TIME1 ]; then
touch $TIME1
let INIT_TIME=($UNIXTIME+$SLEEPTIME)
echo $INIT_TIME > $TIME1
fi
UNIXTIME1=$(cat $TIME1)
echo "Unixtime ="$UNIXTIME1
if [ $UNIXTIME -gt $UNIXTIME1 ]; then
let UNIXTIME2=($UNIXTIME+$SLEEPTIME)
echo $UNIXTIME2 > $TIME1
echo "EXECUTE"
curl -s -i -H "Accept: application/json" "http://$RSER:$RSER_PORT/json.htm?type=command¶m=switchlight&idx=$RIDX&switchcmd=On"
sleep 0.3
if [ $EXECUTE_ON_OFF -eq 1 ]; then
curl -s -X POST https://api.telegram.org/bot$TOKEN/sendMessage -d text="$TEXT" -d chat_id=$CHAT_ID
fi
fi
exit