Open berkaytheunicorn opened 7 years ago
The state checking algorithm is basically checking if the state command returns an empty string. You can try gpio read 4 | grep -i "true"
something like that.
Try this:
"switches" : [
{
"state_cmd" : "sh /home/pi/read.sh",
"name" : "Lamp",
"on_cmd" : "gpio write 4 1",
"off_cmd" : "gpio write 4 0",
"pooling": true
}
]
read.sh
gpioread = $(gpio read 4)
if [ $gpioread -eq 1 ]
then
exit 0
fi
if [ $gpioread -eq 0 ]
then
exit 1
fi
HomeKit need a Exit-Code 0 for device ON and all other Exit-Codes = OFF. "gpio read" gives a "1" or a "0". But dont gives a Error-Code "1" or "0". "gpio read" gives always Error-Code 0, and that is the code for ON.
Hey there, I have simple set up
with bash
bash
on off works great but after I off the lamp 1-2 secons later it just became on in state but not really.
am i doing something wrong here?