Yet another presence detection method
Moderator: leecollings
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
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?
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?
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
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
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
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
Hello,
it does not work.
is it necessary to put a script in domoticz? LUA, python ....?
it does not work.
is it necessary to put a script in domoticz? LUA, python ....?
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
if you have an idee
[youtube]https://youtu.be/qeTwzoC8qvQ?t=56s[/youtube]
Code: Select all
#! /bin/sh
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection 74:23:44:F7:2C:9B IDX3692"
Code: Select all
#!/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
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
Ah sorry, I see. "IDX" was intended to be replaced by only a number, not by IDX+number.
So your commands have to look like this:
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection 74:23:44:F7:2C:9B 3692"
Best regards.
So your commands have to look like this:
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection 74:23:44:F7:2C:9B 3692"
Best regards.
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
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"
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
remove "\ " in between htm? and type=
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
curl -s "http://vulbas:[email protected]:8080/json.htm? type=command¶m=switchlight&idx=$idx&switchcmd=On"
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>admin@RT-AC88U-2648:/jffs/scripts#
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>admin@RT-AC88U-2648:/jffs/scripts#
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
There is still a space symbol between json.htm? and type=vulbas wrote: ↑Saturday 24 February 2018 18:20 curl -s "http://vulbas:[email protected]:8080/json.htm? type=command¶m=switchlight&idx=$idx&switchcmd=On"
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>admin@RT-AC88U-2648:/jffs/scripts#
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
hello surout
i have installed a new domoticz and i make a hard reset of my router, the problem is the same.
i don't understand
with a still a space symbol between json.htm? and type=
admin@RT-AC88U-2648:/jffs/scripts# curl -s "http://vulbas:[email protected]:8080/json.htm? type=command¶m=switchlight&idx=$idx&switchcmd=On"
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
with no space symbol between json.htm? and type=
admin@RT-AC88U-2648:/jffs/scripts# curl -s "http://vulbas:[email protected]:80 ... itchcmd=On"
{
"status" : "ERR"
i have the asus router AC88U with merlin 384.3
i have installed a new domoticz and i make a hard reset of my router, the problem is the same.
i don't understand
with a still a space symbol between json.htm? and type=
admin@RT-AC88U-2648:/jffs/scripts# curl -s "http://vulbas:[email protected]:8080/json.htm? type=command¶m=switchlight&idx=$idx&switchcmd=On"
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
with no space symbol between json.htm? and type=
admin@RT-AC88U-2648:/jffs/scripts# curl -s "http://vulbas:[email protected]:80 ... itchcmd=On"
{
"status" : "ERR"
i have the asus router AC88U with merlin 384.3
- Surroot
- Posts: 31
- Joined: Wednesday 18 January 2017 11:28
- Target OS: Linux
- Domoticz version: beta
- Location: Vienna
- Contact:
Re: Yet another presence detection method
you forgot to replace $idx with the ID of your switch
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
ho sorry, i don't understand that
this is good ?
this is good ?
Code: Select all
#!/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
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
hello,
finaly that work for my phone !!!
but i whant put an another phone, and that don't work
how to add a second phone on the code ?
the IDX is only 3701 on this code
finaly that work for my phone !!!
but i whant put an another phone, and that don't work
Code: Select all
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection 74:23:44:F7:2C:9B 3701
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection D4:A3:3D:20:51:69 3705
the IDX is only 3701 on this code
Code: Select all
#!/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
-
- Posts: 57
- Joined: Sunday 03 January 2016 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
your cru commands are missing ending "
should be:
should be:
Code: Select all
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection 74:23:44:F7:2C:9B 3701"
cru a PRESENCE "*/1 * * * * /jffs/scripts/presence_detection D4:A3:3D:20:51:69 3705"
-
- Posts: 37
- Joined: Tuesday 20 February 2018 17:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Yet another presence detection method
ho thank you.
it worked without the "
but i do not know how to have two phone
it worked without the "
but i do not know how to have two phone
Who is online
Users browsing this forum: No registered users and 1 guest