hi, sorry for my english, google translate is my friend lol.
I installed on my AC88U with merlin.
did I fill up well?
#! / Bin / sh
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection xx.xx.xx.xx 3888"
when I type ./presence_detection xx.xx.xx.xx IDX3888 I get the message [: On: unknown operand or [: Off: unknown operand
my phone is recognized. in domoticz the switch does not change state.
is a script needed in LUA in domoticz?
can you help me please?
Re: Yet another presence detection method
Posted: Tuesday 20 February 2018 19:47
by Surroot
Hi!
It seems like a mistake happened when you copied the script.
Try copy and paste again and replace the script on your router.
Good luck
Re: Yet another presence detection method
Posted: Saturday 24 February 2018 15:49
by vulbas
Hello,
it does not work.
is it necessary to put a script in domoticz? LUA, python ....?
Re: Yet another presence detection method
Posted: Saturday 24 February 2018 16:17
by Surroot
vulbas wrote: ↑Saturday 24 February 2018 15:49
Hello,
it does not work.
is it necessary to put a script in domoticz? LUA, python ....?
No it's not necessary, just try the steps from the description of the first post again.
#!/bin/sh
mac=$1
idx=$2
device_present=Off
domoticz_status=`curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=devices&rid=$idx" | grep Status | awk '{print $3}' | sed 's/[",]//g'`
# look in 2.4GHz (eth1) network for device
for x in `wl -i eth1 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then
device_present=On
fi
done
# look in 5GHz (eth2) network for device
for x in `wl -i eth2 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then
device_present=On
fi
done
# tell domoticz the new device status
if [ $domoticz_status != $device_present ]; then
if [ $device_present = "On" ]; then
curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=command¶m=switchlight&idx=$idx&switchcmd=On" > /dev/null
else
curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=command¶m=switchlight&idx=$idx&switchcmd=Off" > /dev/null
fi
fi
You could try setting the status manually by executing:
curl -s "http://domoticzUser:domoticzPassword@domoticzIP:domoticzPort/json.htm?\ type=command¶m=switchlight&idx=3692&switchcmd=On"
#!/bin/sh
mac=$1
idx=$2
device_present=Off
domoticz_status=`curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=devices&rid=3692" | grep Status | awk '{print $3}' | sed 's/[",]//g'`
# look in 2.4GHz (eth1) network for device
for x in `wl -i eth1 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then
device_present=On
fi
done
# look in 5GHz (eth2) network for device
for x in `wl -i eth2 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then
device_present=On
fi
done
# tell domoticz the new device status
if [ $domoticz_status != $device_present ]; then
if [ $device_present = "On" ]; then
curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=command¶m=switchlight&idx=3692&switchcmd=On" > /dev/null
else
curl -s "http://vulbas:[email protected]:8080/json.htm?\
type=command¶m=switchlight&idx=3692&switchcmd=Off" > /dev/null
fi
fi
Re: Yet another presence detection method
Posted: Monday 26 February 2018 14:31
by vulbas
it does not work automatically
Re: Yet another presence detection method
Posted: Monday 26 February 2018 22:10
by vulbas
avec ce code ça fonctionne presque.
le on s'allume automatiquement.
mais il ne s'eteint pas automatiquement
with this code it works almost.
it turns on automatically.
but it does not turn off automatically
Re: Yet another presence detection method
Posted: Tuesday 06 March 2018 19:48
by vulbas
hello,
finaly that work for my phone !!!
but i whant put an another phone, and that don't work
#!/bin/sh
mac=$1
idx=$2
device_present=Off
domoticz_status=`curl -s "xxxxxxxxxxxxxxx/json.htm?type=devices&rid=3701" | grep Status | awk '{print $3}' | sed 's/[",]//g'`
# look in 2.4GHz (eth1) network for device
for x in `wl -i eth1 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then device_present=On
fi
done
# look in 5GHz (eth2) network for device
for x in `wl -i eth2 assoclist | awk '{print $2}'`; do
if [ $x = $mac ]; then device_present=On
fi
done
# tell domoticz the new device status
if [ $domoticz_status != $device_present ]; then
if [ $device_present = "On" ]; then
curl -s "xxxxxxxxxxxxxxxxxx/json.htm?type=command¶m=switchlight&idx=3701&switchcmd=On" > /dev/null
else
curl -s "xxxxxxxxxxxxxxxxxxxxx/json.htm?type=command¶m=switchlight&idx=3701&switchcmd=Off" > /dev/null
fi
fi