Skip to content

Instantly share code, notes, and snippets.

@toaomatis
Last active March 4, 2016 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toaomatis/6cb8434248c4d9c9c2e8 to your computer and use it in GitHub Desktop.
Save toaomatis/6cb8434248c4d9c9c2e8 to your computer and use it in GitHub Desktop.
#!/bin/bash
startup_path=$1
hardware_id=$2
device_id=$3
status=$4
status2=$5
devname=$6
echo "startup_path=${startup_path}, hardware_id=${hardware_id}, device_id=${device_id}, status=${status}, status2=${status2}, devname=${devname}"
INDEX=`expr index "$devname" 'Impuls'`
echo $INDEX
# "Impuls18C"
if [[ $devname == Impuls* ]]
then
PROTO=impuls
CODE=${devname:6:2}
DEV=${devname:8:1}
elif [[ $devname == Eurodomest* ]]
then
PROTO=kaku_switch_old
CODE=${devname:10:2}
DEV=${devname:12:1}
else
exit 1
fi
DEV=$(expr $(printf '%d\n' "'$DEV") - 65)
status=${status,,}
echo "It's there!";
echo "PROTO $PROTO"
echo "CODE $CODE"
echo "DEV $DEV"
echo "STATUS $status"
echo "pilight-send -p $PROTO -i $CODE -u $DEV --$status"
for i in `seq 1 5`;
do
pilight-send -p $PROTO -i $CODE -u $DEV --$status
sleep 1
done
# ./domoticz_main.sh foo bar foo on bar Eurodomest10A
# ./domoticz_main.sh foo bar foo off bar Eurodomest10A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment