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