Working Iphone wifi presence locator

what in the world are “french commas”??

` is a french comma. it has to be

DEVICES=`/usr/sbin/arp -an | awk ‘{print $4}’`

ah of course - well I used $( … ) anyway same difference I guess.

A few notes on the suggested exec script though, I noticed that hping3 could only be run with privileged access (sudo/root) so I added sudo into the command line. Also, arp displays all mac addresses in lowercase - which explained why I couldn’t get a positive response.

Hi there

Yes the french comma is there. It didn’t copie when I paste it here.
Binding-exec-1.9.0.SNAPSHOT is also installed.
Even when there was an error with hping or the ligne DEVICES= the echo in line two should work.
First line is #!/bin/bash also bad paste.

the script has a chmod 777.

Best regards
Ossy

What happens when you run the script via bash as a first step

I placed those line in the beginning of my items file.

String MOB001_WLAN_N “Zu Hause [%s]” (gPresence) { exec="<[sudo /opt/openhab/iphonedetect.sh:60000:REGEX((.?))]" }
String MOB002_WLAN_N “Zu Hause2 [%s]” (gPresence) { exec="<[bash /opt/openhab/iphonedetect2.sh:60000:REGEX((.
?))]" }
String MOB003_WLAN_N “Zu Hause3 [%s]” (gPresence) { exec="<[/opt/openhab/iphonedetect3.sh:60000:REGEX((.*?))]" }

and restarted ./start.sh but nothing better.

++
Ossy

No dont run your script via openhab. Try it at first via a bash

Hi Ossy,
pls connect to your server via Putty or similar, change via cd to the folder you have stored the script an “run” ./iphonedetect.sh.
Cheers
Björn

Try to add the bash command I.e.

String M0B001_WLAN_N"Zu Hause [%S]" (gPresence) {exec=<[sudo bash /opt/open has/iphonedetect.sh:6000:REGEX((.?))]"}

Hi there

I changed my items file to:
String M0B001_WLAN_N"Zu Hause [%S]" (gPresence) {exec=<[sudo bash /opt/open has/iphonedetect.sh:6000:REGEX((.?))]"}
but still the same.

When I connect with putty and run the script /opt/openhab/iphonedetect.sh the script works.
No error and an entry added to the ip1.txt file.

++
Ossy

What’s the openhab.log error? Also you said you chmod but I assume you’re also chown-ing

Hi Ossy,
suggestion:

Change Item to:
String M0B001_WLAN_N"Zu Hause [%S]" (gPresence) {exec=<[ /opt/open has/iphonedetect.sh:6000:REGEX((.?))]"}
-> remove “sudo” and "bash"
Change Permission of file iphonedetect.sh:
chmod 777 iphonedetect.sh

Try again.
Cheers
Björn
PS: Please confirm that /opt/open/open has/… is correct. Eventually the blank in “open has” might be a problem during the execution. Thus if afore mentioned method does not work, rename the directory.

i don’t know i you haven’t seen but I think there is a typo in the path :opehnhas is wrong

  1. Do you see any errors in your log?

  2. Are you sure your home.sitemap is right? (I.e. Text item=[s%])

Hi there

I updated today Debian Jessie and installed last openhab-online-2.0.0-SNAPSHOT.zip.
Also checked my items file which starts with:
String MOB001_WLAN_N “Zu Hause [%s]” (gPresence) { exec="<[sudo bash /opt/openhab/iphonedetect.sh:60000:REGEX((.?))]" }
String MOB002_WLAN_N “Zu Hause2 [%s]” (gPresence) { exec="<[bash /opt/openhab/iphonedetect2.sh:60000:REGEX((.
?))]" }
String MOB003_WLAN_N “Zu Hause3 [%s]” (gPresence) { exec="<[/opt/openhab/iphonedetect3.sh:60000:REGEX((.*?))]" }

I created 3 different lines to tests différents exec.

My sitemap file:

Text item=CurrentDate
Text item=MOB001_WLAN_N icon="siren"
Text item=MOB002_WLAN_N icon="siren"
Text item=MOB003_WLAN_N icon=“siren”

I started even in /opt/openhab ./start.sh with su - to be sure not having a permission problem.

Thanks anyway for all of your help.

Best regards

Ossy

Whats in your openhab log? Is it showing the script is executed? Is the script owned by the user openhab is running as?

Is i possible to send parameters to iphonedetect.sh and have mac and ip address in Items file?

/mike

Hi there in the log there is nothing showing an execution of the script.
I run the ./start.sh not with the user openhab. I use my user. in this case: ossy

here my files as pdf (Ididn’t find how to insert texte files)iphonedetect.sh.pdf (123.6 KB):

ossy.items.pdf (158.1 KB)

ossy.sitemap.pdf (129.1 KB)

best regards

Ossy

Couple of points.
Isn’t // a comment?
You say you’re running as your user, but that means you should chown all openhab and addon directories as that user as well. Once done restart service.
Double check your script still works at command prompt.
For debugging maybe change the exec timer down to 20 seconds or lower so you don’t need to wait for one minute each time

Ok this is going to sound strange but it’s worth a try. Make a new items file (call it presence.items or something) with just

String MOB001_WLAN_N “Zu Hause [%s]” (gPresence) { exec="<[sudo bash /opt/openhab/iphonedetect.sh:60000:REGEX((.*?))]" }

I have had a similar issue as you, where an item was not showing up and there was nothing in the log. Usually it was when my home.items was really long and there was some error in it that I didn’t see. I fixed it by making a second items file. Openhab reads all items files that are in the items folder. Keep home.items but add presence.items.