Smartphone Radar - Smartphone presence detection (Locked)
Smartphone Radar - Smartphone presence detection (Locked)
Please see the topic below for current information and installation instructions.
Smartphone Radar - Information and Installation
Smartphone Radar - Information and Installation
Last edited by travisc on Sun May 19, 2013 7:52 pm, edited 19 times in total.
- jay (support)
- Site Admin
- Posts: 18345
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Smartphone Radar - Smartphone presence detection
Sweet - I'll have to check my router. A couple of thoughts:
1) To make the user do a bit less work on install, why not just ask for the variable name and create it yourself (if it doesn't exist) rather than make them create it and show the variable list?
2) In fact, if you made each phone a custom device with just a single state (atHome or something) then you wouldn't need variables at all and you could have unlimited phones.
Just some thoughts. I'd rather not muck with my router firmware but perhaps it already does syslog.
1) To make the user do a bit less work on install, why not just ask for the variable name and create it yourself (if it doesn't exist) rather than make them create it and show the variable list?
2) In fact, if you made each phone a custom device with just a single state (atHome or something) then you wouldn't need variables at all and you could have unlimited phones.
Just some thoughts. I'd rather not muck with my router firmware but perhaps it already does syslog.
Re: Smartphone Radar - Smartphone presence detection
travisc wrote:NOTE: This is a beta release. It's not going to wreak havoc on your computer, but it may still have a quirk or two.
What It Needs
To use Smartphone Radar you'll need a router with remote logging capabilities (sometimes called syslog). As well as some settings in the router so it gives out the same IP address to the phones every time it connects to the network (static DHCP). The phones will also need to be set to check email on a regular schedule. Many higher end routers already support these features, and many less expensive routers do too. If they don't, they can often be upgraded to have these features by installing DD-WRT or Tomato firmware on them.
DD-WRT Firmware: http://www.dd-wrt.com/site/index Supported Routers: http://www.dd-wrt.com/wiki/index.php/Supported_Devices
Tomato Firmware: http://www.polarcloud.com/firmware Supported Routers: http://www.polarcloud.com/tomatofaq#wha ... his_run_on
Excellent! I have been running Tomato for years, I'll give this a go when I get back home.
Thanks Travis!!
--
Korey
Korey
Re: Smartphone Radar - Smartphone presence detection
That'll work. At first I didn't see the variable methods in the plugin documentation, I think it just said FixMe. But then I noticed them later, I'll check this out.1) To make the user do a bit less work on install, why not just ask for the variable name and create it yourself (if it doesn't exist) rather than make them create it and show the variable list?
I originally wanted to do this to keep it simple. The reason I avoided using devices or triggers is because I think a lot of people will create conditions based on the value of the variable. For example, if the phone has been away for 4 hours reduce the heat, or if it's been away for 24 hours then put the house in vacation mode, or turn off the lights at 10pm only if phonelastseen is less than 30. Then I thought of creating triggers for different timeout periods, but then the times would have to be adjustable because some people might want to use it for different things. I figured I'd get this out first and see how people use it, if everyone just wants triggers for home and away then I can certainly change it.2) In fact, if you made each phone a custom device with just a single state (atHome or something) then you wouldn't need variables at all and you could have unlimited phones.
Thanks for the feedback!
Re: Smartphone Radar - Smartphone presence detection
Great! Let me know how it works out. I'll post my Tomato setup for reference. If you downloaded it already download it again. I moved a function last night just before I uploaded it and something broke, it's all fixed.Excellent! I have been running Tomato for years, I'll give this a go when I get back home.
Re: Smartphone Radar - Smartphone presence detection
Jay,
I've been thinking a little bit more about what you said with making each phone a Device. How does this sound?
- Each phone is a device. On the device config page user specifies the IP address and optionally types in a variable name to store the minutes since last seen.
- Each device then has triggers for: This Phone is Home, This Phone is Away, This Phone on Vacation
- There would also be global plugin triggers for: A Phone is Home, All Phones Home, All Phones Away, All Phones on Vacation, etc
- The pluginConfig screen could then have two settings where the user could specify how many minutes need to pass before a phone is declared away, and how many hours (or days) have to pass before it's declared on vacation.
I'm still considering if the vacation trigger is necessary or if it complicates things. I like to differentiate between Away for a few hours, and Away for days. If all the phones are just away for a few hours I'll adjust the HVAC a few degrees. But if they are all gone for a long time I'll adjust it much more, and also put the house in a mode to play with the lights to make it look like people are still home.
Thanks for your help.
Travis
I've been thinking a little bit more about what you said with making each phone a Device. How does this sound?
- Each phone is a device. On the device config page user specifies the IP address and optionally types in a variable name to store the minutes since last seen.
- Each device then has triggers for: This Phone is Home, This Phone is Away, This Phone on Vacation
- There would also be global plugin triggers for: A Phone is Home, All Phones Home, All Phones Away, All Phones on Vacation, etc
- The pluginConfig screen could then have two settings where the user could specify how many minutes need to pass before a phone is declared away, and how many hours (or days) have to pass before it's declared on vacation.
I'm still considering if the vacation trigger is necessary or if it complicates things. I like to differentiate between Away for a few hours, and Away for days. If all the phones are just away for a few hours I'll adjust the HVAC a few degrees. But if they are all gone for a long time I'll adjust it much more, and also put the house in a mode to play with the lights to make it look like people are still home.
Thanks for your help.
Travis
- jay (support)
- Site Admin
- Posts: 18345
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Smartphone Radar - Smartphone presence detection
Why not have # of minutes away a device state - that way people can trigger on when minutes away becomes greater than 60 (1 hour), minutes away becomes greater than 1440 (1 day), etc? Then you wouldn't have to preconfigure Away and Vacation (although maybe those are nice shortcuts). States, IMO, are just much nicer than having variables floating around cluttering up the variable list.
Global events sound interesting.
Global events sound interesting.
Re: Smartphone Radar - Smartphone presence detection
My only concern with this was that device states can't be used as conditions. So for example if 10pm rolls around and triggers an event to turn off the outside lights, you can't put a condition saying "Only If phone state < 30 minutes". Which would prevent them from turning off if the phone wasn't home yet. Or am I wrong? This limitation is the reason I went with variables in the first place. I agree that variables are messy.Why not have # of minutes away a device state - that way people can trigger on when minutes away becomes greater than 60 (1 hour), minutes away becomes greater than 1440 (1 day), etc?
- jay (support)
- Site Admin
- Posts: 18345
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Smartphone Radar - Smartphone presence detection
I think both use-cases are valid. The use in conditions is a valid point, and while we intend to implement device states in the condition editor eventually - working around using a variable is a reasonable alternative. No reason not to implement both IMO - updating states is a single line of code just like updating a variable...
BTW, the next beta release will have a new plugin - one of the actions in it will more easily allow users to insert a device state into a variable (so it'll work with any device type that has states). It'll help with that condition editor limitation until we can decide when we can get device states in natively.
BTW, the next beta release will have a new plugin - one of the actions in it will more easily allow users to insert a device state into a variable (so it'll work with any device type that has states). It'll help with that condition editor limitation until we can decide when we can get device states in natively.
-
- Posts: 20
- Joined: Mon Apr 25, 2011 7:19 pm
- Location: Running Springs, CA
- Contact:
Re: Smartphone Radar - Smartphone presence detection
I'm running into some trouble with this. As soon as I start up the plugin, I see this in the log:
Jun 3, 2011 7:12:13 PM
Smartphone Radar Phone 1 at IP Address 10.0.1.52 will use variable leda_logged.
Smartphone Radar Phone 2 at IP Address 10.0.1.53 will use variable elara_logged.
Jun 3, 2011 7:12:40 PM
Smartphone Radar Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 54, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/Smartphone Radar.indigoPlugin/Contents/Server Plugin/iPresence.py", line 122, in startComm
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''
Smartphone Radar Error plugin runConcurrentThread function returned or failed; will attempt again in 10 seconds
Quite possibly user error on my part. :)
Any ideas?
I'm running Indigo 5.0.0 b5 and the plugin I just downloaded today (v0.5.0)
-travis
Jun 3, 2011 7:12:13 PM
Smartphone Radar Phone 1 at IP Address 10.0.1.52 will use variable leda_logged.
Smartphone Radar Phone 2 at IP Address 10.0.1.53 will use variable elara_logged.
Jun 3, 2011 7:12:40 PM
Smartphone Radar Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 54, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/Smartphone Radar.indigoPlugin/Contents/Server Plugin/iPresence.py", line 122, in startComm
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''
Smartphone Radar Error plugin runConcurrentThread function returned or failed; will attempt again in 10 seconds
Quite possibly user error on my part. :)
Any ideas?
I'm running Indigo 5.0.0 b5 and the plugin I just downloaded today (v0.5.0)
-travis
Re: Smartphone Radar - Smartphone presence detection
Actually I bet it's my fault. It's assuming there's a number stored in that variable at first. Try changing the value of both of your variables to a number. Any number, it doesn't matter. Then start the plugin again.Quite possibly user error on my part.
Any ideas?
I'll adjust the code so it will check for this and initialize the variable if it's not a valid number.
Let me know if that works.
Travis
-
- Posts: 20
- Joined: Mon Apr 25, 2011 7:19 pm
- Location: Running Springs, CA
- Contact:
Re: Smartphone Radar - Smartphone presence detection
Ah, that did the trick, thanks.
I may be out of luck in the router department though. I'm using an AirPort Extreme, which probably won't work with Tomato or DD-WRT. It does support syslog, but you can't specify a TCP port. It always goes to 514 via UDP.
I may be out of luck in the router department though. I'm using an AirPort Extreme, which probably won't work with Tomato or DD-WRT. It does support syslog, but you can't specify a TCP port. It always goes to 514 via UDP.
Re: Smartphone Radar - Smartphone presence detection
I was looking into this the other day. Port 514 is the standard syslog port, but we can't use that port because ports below 1024 require administrator privileges. Indigo plugins don't have administrator privileges (which is good) so I decided on using port 1514. Some routers allow syslog to use a non-standard port, some don't. Apple's Airport extreme and Airport Express are examples of the latter.I may be out of luck in the router department though. I'm using an AirPort Extreme, which probably won't work with Tomato or DD-WRT. It does support syslog, but you can't specify a TCP port. It always goes to 514 via UDP.
From the research I've done, it seems the easiest work-around for this is to internally forward port 514 to 1514. The best tool to do this seems to be WaterRoof http://www.hanynet.com/waterroof/. It's not a program that has to run in the background, it's a simple GUI to OS X's powerful network layer. You use it to setup a simple network routing rule and that's it.
If you want to give this a shot, from what I've read you'd follow these steps to forward the port:
- 1. Click on “Rules”.
- 2. Click the “+” icon to add a new rule.
- 3. Enter the following information in the “Add new rule” window that appears:
- Protocol: udp
- Rule Action: Forward
In the “x.x.x.x, port” field enter 127.0.0.1 for the IP and 1514 for the port
- Source address, subnet or network: any
- Port or range: (leave blank)
- Destination address, subnet, or network: me
- Port or range: 514 (Port number to which you would like WaterRoof to redirect traffic from)
- Options: Select the In/Out radio button
- 4. Click on Add new rule
Let me know how you make out.
The WaterRoof steps above were based on the following pdf file.
http://support.grouplogic.com/wp-conten ... erroof.pdf
-
- Posts: 20
- Joined: Mon Apr 25, 2011 7:19 pm
- Location: Running Springs, CA
- Contact:
Re: Smartphone Radar - Smartphone presence detection
Ah, I was messing around with forwarding the port with netcat, but WaterRoof is much easier, thanks.
With this router, syslog isn't logging the phone connection by IP, but rather by MAC address (syslog level 5, btw). Your configuration panel is validating for IP, so I wasn't able to just enter the MAC address in there.
With this router, syslog isn't logging the phone connection by IP, but rather by MAC address (syslog level 5, btw). Your configuration panel is validating for IP, so I wasn't able to just enter the MAC address in there.
Re: Smartphone Radar - Smartphone presence detection
Try this one. I just whipped up a special blend that doesn't do IP validation. Enter the MAC address as it's shown in the log into the IP Address box and it should work. If it does I'll modify the plugin to accept either or.
http://frightideas.com/hobbies/smartpho ... dation.zip
http://frightideas.com/hobbies/smartpho ... dation.zip