Krijn20345
Posts: 5
Joined: Tue Sep 15, 2015 8:50 pm

Wifi phone detection

Wed Sep 16, 2015 11:00 am

Hi,

I'm working on a script but can't manage it to work.

The idea:

Detect my phone on the wifi network. Save the status in a php file so i'm able to display the status on a webpage.

I found 2 scripts on the internet and like to combine those. The only problem is, they're in different script-languages.

The first script (.sh): https://www.reddit.com/r/raspberry_pi/comments/1yrudi/

Ping an IP-adress, save the status to a file so we can compare it during a new scan. If the status is the same as the previous status, do nothing.

I'd liked to combine that part of the script with this script (.py):
http://raspberrypilife.com/a-simple-way ... -are-home/

The second script is already working. I've reserved an ip-adress in my router. So my Iphone will always connect with that IP-Adress (192.168.178.65).

I'd liked to run the script on the background without displaying the output in the Terminal, so i still can use the Terminal for other scripts.

The status ( 0 or 1 ) needs to be saved in a php file, so i'm able to display it to a webpage.

Hopefully everything is clear. If there are any questions, feel free to ask.


Greetings,
Krijn

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Wifi phone detection

Wed Sep 16, 2015 7:18 pm

Nice, simple script and gonna use this but a slight problem with Windows (will be on the Pi eventually but developing on laptop).
When I run the script and print 'check = output.communicate()[0]' it returns 'Access denied. Option -c requires administrative privileges.'
I know sudo would solve this in Linux but how do I get around this in Windows?

Dave.
Apple say... Monkey do !!

Krijn20345
Posts: 5
Joined: Tue Sep 15, 2015 8:50 pm

Re: Wifi phone detection

Wed Sep 16, 2015 7:28 pm

Dave,

I have no problem with that. I use Putty to SSH to my Raspberry and program it remotely.


-
Krijn

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Wifi phone detection

Wed Sep 16, 2015 7:51 pm

Krijn20345 wrote:I have no problem with that. I use Putty to SSH to my Raspberry and program it remotely.
Thanks but Pi's not connected at the moment, how do I use this script just on Windows?

Regards.
Dave.
Apple say... Monkey do !!

Krijn20345
Posts: 5
Joined: Tue Sep 15, 2015 8:50 pm

Re: Wifi phone detection

Wed Sep 16, 2015 7:56 pm

davef21370 wrote:
Krijn20345 wrote:I have no problem with that. I use Putty to SSH to my Raspberry and program it remotely.
Thanks but Pi's not connected at the moment, how do I use this script just on Windows?

Regards.
Dave.
Dave,

I have no clue, just started with the Raspberry. So doing everything through Putty.

-
Krijn

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Wifi phone detection

Wed Sep 16, 2015 7:58 pm

Okay, thanks Krijn, I'll look into it at weekend, nice bit of code though.

Dave.
Apple say... Monkey do !!

Krijn20345
Posts: 5
Joined: Tue Sep 15, 2015 8:50 pm

Re: Wifi phone detection

Wed Oct 07, 2015 9:04 am

Any progress?

Return to “Python”