Questions about hardware that can be controlled by Indigo (but not through the interfaces and plugins listed). If Indigo doesn't support some bit of hardware you're interested in, and you don't find a 3rd Party Plugin for it, add it to this forum. Be sure to include links to as much information as you can find about it.
Note: adding it here does not mean we're going to add it - in fact it's possible one of our 3rd party developers may decide to write a plugin for it. We add hardware/features based on a lot of different factors beyond just having a request for it.
ChopOMatic wrote:Post both scripts here along with a description of how you run them, and we'll have a look....My only remaining thing to figure out now is why the ON and OFF scripts aren't working from within Indigo. They work perfectly from the command line, turning the switches on and off as instructed. They generate no errors when run from Indigo, but they're not turning the switches on or off. (I've set the permissions for both.)
ChopOMatic wrote:OK!Here you go...
#!/bin/sh
FUNC=$1
if [[ $FUNC = "on" ]] || [[ $FUNC = "off" ]];then
/usr/local./bin/tplink_smartplug.py -t 10.0.0.26 -c${FUNC}
/usr/local./bin/tplink_smartplug.py -t 10.0.0.26 -c info | json_pp | grep relay_state | cut -c26 | tr -d "\n"
elif [[ $FUNC = "status" ]];then
/usr/local./bin/tplink_smartplug.py -t 10.0.0.26 -c info | json_pp | grep relay_state | cut -c26 | tr -d "\n"
else
echo Error: on, off or status required
exit 1
fi
exit 0
/usr/local/bin/gkmain.sh on
$ ls -l gkmain.sh
-rwxr-xr-x 2 root wheel 584 Aug 13 08:57 gkmain.sh
ChopOMatic wrote:First, I see there is output from the on and off command, so let's get rid of that. Then, are you using the unmodified (original) version of tplink_smartplug.py? If you are, you need the alternate version of the command line I posted earlier. Here is the script with changes for both issues and a typo:...STATUS is not. All generate an error from the command line.
#!/bin/sh
FUNC=$1
if [[ $FUNC = "on" ]] || [[ $FUNC = "off" ]];then
/usr/local/bin/tplink_smartplug.py -t 10.0.0.26 -c${FUNC} >/dev/null 2>&1
/usr/local/bin/tplink_smartplug.py -t 10.0.0.26 -c info | sed -e "s/Received..//" | json_pp | grep relay_state | cut -c26 | tr -d "\n"
elif [[ $FUNC = "status" ]];then
/usr/local/bin/tplink_smartplug.py -t 10.0.0.26 -c info | sed -e "s/Received..//" | json_pp | grep relay_state | cut -c26 | tr -d "\n"
else
echo Error: on, off or status required
exit 1
fi
exit 0
/usr/local/bin/tplink_smartplug.py -t 10.0.0.26 -c info
ChopOMatic wrote:Good news!All working PERFECTLY.
jay (support) wrote:There is one possible advantage to a plugin. Given the tplink_smartplug.py code, it would possible to fully configure the SmartPlug without using the Kasa app. The only advantage of doing this in a plugin would be the ability to set some options that are not available in Kasa. For example, setting the cloud service url to some phantom address to keep the plug from phoning home. However, it is not at all clear that small advantage would be with the effort, especially since it can already be done from the command line anyway.No need for a plugin really - just execute a run shell script action that points to that script.
#!/bin/zsh
TPLINK=/usr/local/bin/tplink_smartplug.py
PLUGADDR=192.168.5.113
#### Do not change anything below this line ####
FUNC=$1
alias tpOn='$TPLINK -t $PLUGADDR -c on >/dev/null 2>&1'
alias tpOff='$TPLINK -t $PLUGADDR -c off >/dev/null 2>&1'
alias tpStatus='$TPLINK -t $PLUGADDR -c info | grep Received | sed -e "s/Received..//" | json_pp | grep relay_state | cut -c26 | tr -d "\n"'
case $FUNC in
on)
tpOn
tpStatus
;;
off)
tpOff
tpStatus
;;
toggle)
STATE=`tpStatus`
case $STATE in
0)
tpOn
tpStatus
;;
1)
tpOff
tpStatus
;;
*)
echo Unknown state $STATE received from plug
exit 1
;;
esac
;;
status)
tpStatus
;;
*)
echo Error: on, off or status required
exit 1
;;
esac
exit 0
Users browsing this forum: No registered users and 1 guest