Tellstick Duo+Doorbell+Script event

Moderator: Telldus

Post Reply
Urme
Posts: 34
Joined: Fri Mar 17, 2023 9:45 am

Tellstick Duo+Doorbell+Script event

Post by Urme »

I've setup a Doorbell in my tellstick.config with an ID of 6, and when I push the doorbell a script runs in deviceevent/doorbell.sh
Everything works great! Except that the script are triggered twice :( Is it the doorbell that sends the signal twice that it has been pushed? The doorbell is a Nexa LMLT-711.

Can I prevent the script from execute two times and make sure it only executes once?

This is the script both "echo" are logged twice and my lamp in homeautomation is turned on and then off.

Code: Select all

#!/bin/bash
echo "Deviceevent activated with ID: ${DEVICEID}" >> /tmp/tdlog.log
if [ "${DEVICEID}" = "6" ]; then
        echo "Doorbell was pushed! ${DEVICEID}" >> /tmp/tdlog.log
        url="http://192.168.1.101/ha/api.php?do=devices/toggle&deviceid=1&status=-1"
        wget -qO- "${url}" >> /tmp/tdlog.log
fi
Urme
Posts: 34
Joined: Fri Mar 17, 2023 9:45 am

Re: Tellstick Duo+Doorbell+Script event

Post by Urme »

I did a "hack" in the sh script like this:

Code: Select all

#!/bin/bash
echo "Running doorbell.sh...." >> /tmp/tdlog.log
if [ "${DEVICEID}" = "6" ]; then
        if mkdir /tmp/lockdir-doorbell; then
                echo "Doorbell pushed!! ${DEVICEID}" >> /tmp/tdlog.log
                url="http://192.168.1.101/ha/api.php?do=devices/toggle&deviceid=1&status=-1"
                wget -qO- "${url}" >> /tmp/tdlog.log
                sleep 5
                rm -rf /tmp/lockdir-doorbell
        else
                echo "lockdir failed - exit" >> /tmp/tdlog.log
                exit 1
        fi
fi
At least this works.. probably a better way to do it?
Post Reply