Page 4 of 5
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 10:27
by Yustmenl
I am having problems running the script, i have been looking throught the posts of the same problem but none of the solutions seem to work
when running
sudo sh ./script.sh
i get
./telrichard.sh: 21: ./telrichard.sh: [[: not found
./telrichard.sh: 31: ./telrichard.sh: [[: not found
./telrichard.sh: 41: ./telrichard.sh: [[: not found
./telrichard.sh: 51: ./telrichard.sh: [[: not found
Status in sync Wifi 1st attempt
when running
sudo ./script
i get
sudo: ./telrichard.sh: command not found
when running
./script
i get
bash: ./telrichard.sh: Permission denied
i already used dos2unix on the file
and created the file with touch and filled it with nano
but somehow i can't get it to work
so now i am out of ideas hopefully someone here can help me.
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:14
by ben53252642
This should fix it:
sudo chmod 755 telrichard.sh
then run:
sudo ./telrichard.sh
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:18
by Yustmenl
wel it's running now with sudo ./telrichard.sh
but i still get
./telrichard.sh: 21: ./telrichard.sh: [[: not found
./telrichard.sh: 31: ./telrichard.sh: [[: not found
./telrichard.sh: 41: ./telrichard.sh: [[: not found
./telrichard.sh: 51: ./telrichard.sh: [[: not found
Status in sync Wifi 1st attempt
any idea what can be the solution for that?
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:32
by ben53252642
Try sudo bash ./telrichard.sh
u still get the error?
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:34
by Yustmenl
thats's it thanks wil change it in cron to
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:41
by ben53252642
Cool,
The first line of the script:
Is supposed to tell systems to run it as a bash script but for some reason your system seems to ignore that.
Anyway you can run it with that command:
sudo bash ./telrichard.sh
And it essentially does the same thing.

Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 29 March 2017 13:50
by Yustmenl
Looks i removed to much from the script
was missing

Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 05 April 2017 8:38
by Yustmenl
I found out that the WIFI ping isn't working with my and my girlfriends phone.
Does anyone have an idea if this can be solved? or is this becuase of the power saving from the phones?
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Sunday 16 April 2017 18:44
by ToneStrife
Hello to anyone!
I get the sensor working correctly but I'm having problems to get it in the startup. I'm running the script in a Rpi3
startup.sh file is
Code: Select all
cd /home/pi/domoticz/scripts
# Start Carlos Mobile Ping Monitor
#/usr/bin/screen -S PingCarlosMobile -d -m ./carlos_phone.sh
And the file in init.d is
Code: Select all
#!/bin/sh
### BEGIN INIT INFO
# Provides: Startscripts
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop:
# Description:
### END INIT INFO
case "$1" in
'start')
sudo sh /home/pi/domoticz/scripts/startup.sh
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
I have added the file to the startup using defaults command. But on startup is not detecting changes. Any help?
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Thursday 11 May 2017 18:03
by chrisk81
I'm using this code to detect my iPhone bluetooth. I've found it to be rock solid so far and it also gives the RSSI. Can anyone see any issues with it?
Code: Select all
#!/bin/bash
sudo hcitool cc AA:BB:CC:DD:EE:FF 2> /dev/null
while true
do
bt=$(hcitool rssi AA:BB:CC:DD:EE:FF 2> /dev/null)
if [ "$bt" == "" ]; then
sudo hcitool cc AA:BB:CC:DD:EE:FF 2> /dev/null
bt=$(hcitool rssi AA:BB:CC:DD:EE:FF 2> /dev/null)
fi
echo "$bt"
done
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Saturday 08 July 2017 12:41
by beounet
A very nice script indeed!! works fine till now!!
Thanks a lot Ben!
I think that it will be a good idea to include some sort of security here!!
As i see if the domoticz page is code protected then the virtual switch does not refresh it's state!!
One more is that the same happens if the virtual switch is also password protected!
Protecting the switch is usefull in order to prevent accidentally change of the state!!
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Tuesday 07 November 2017 14:24
by rudiraz
Hi,
I do not need the commandline output. I obly need the script for witching the alarm-switches on and off.
How do I have to use this script then.?
Starting manually ist not the right way...?!
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Friday 01 December 2017 14:41
by schulpr
Hi,
I'm getting this error: ./iphone_rob.sh: 75: ./iphone_rob.sh: Syntax error: "done" unexpected (expecting "then").
Anyone an idea what's going wrong?
Regards, Rob
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 18:51
by theo69
Hi I am a Newbi and have no clue how to add a script like this, is there somebody that can write down all the steps for me?
I have two phones with these Bluetooth Mac Adress: 00:14:22:01:23:45 and 00:0a:95:9d:68:16
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 19:26
by theo69
okay its running (more or less) however my Dummy switch is not changing using this code:
Code: Select all
echo "Status out of sync, correcting..."
if [ "$device" = On ] ; then
echo "$Name" "Online"
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx="$392"&switchcmd=On" 2>/dev/null 1>/dev/null
else
echo "$Name" "Offline"
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx="$392"&switchcmd=Off" 2>/dev/null 1>/dev/null
fi
fi
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 19:30
by jvdz
Guess that needs to be:
Code: Select all
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx=392&switchcmd=On" 2>/dev/null 1>/dev/null
else
echo "$Name" "Offline"
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx=392&switchcmd=Off" 2>/dev/null 1>/dev/null
A $ infront means it is a variable defined before and guess 392 is the actual IDX for the dummy switch.
Jos
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 19:32
by theo69
jvdz wrote: ↑Wednesday 03 January 2018 19:30
Guess that needs to be:
Code: Select all
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx=392&switchcmd=On" 2>/dev/null 1>/dev/null
else
echo "$Name" "Offline"
curl -s "http://"10.0.1.32:8080"/json.htm?type=command¶m=switchlight&idx=392&switchcmd=Off" 2>/dev/null 1>/dev/null
A $ infront means it is a variable defined before and guess 392 is the actual IDX for the dummy switch.
Jos
yep found that myself right now
Only problem now, i can only start the sh with sudo bash iphone.sh
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 19:41
by theo69
Also a lot of times when i switch of bluetooth on the phone, it still shows online...
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 19:51
by jvdz
What is the problem with running it without sudo? Access to curl or the scriptfile?
The script should tell you what it finds. Which version are you using and did you also use the IP address as that looks like it is required for the script I see on the first page? (I am not using this version and wrote my own LUA version)
Jos
Re: Ultimate Wifi and Bluetooth Presence Detection
Posted: Wednesday 03 January 2018 21:09
by theo69
if I just use sudo (without bash) it says
and if I just write bash (without sudo) it says
Code: Select all
Can't create socket: Operation not permitted
Status out of sync, correcting...
Can you share your LUA Srcipt with me please?