Hi guys,
is there a plugin that allow me to track the presence of device in my network?
The idea is to check if my iPhone is connected to my home’s WiFi network to have e.g. a rule to turn on the lights if I’m at home and it’s after sunset.
[solved]Detect presence of device in network?
Hi guys,
is there a plugin that allow me to track the presence of device in my network?
The idea is to check if my iPhone is connected to my home’s WiFi network to have e.g. a rule to turn on the lights if I’m at home and it’s after sunset.
@GuybrushMR80 Generally, you can use pimatic-ping to ping network devices. However, this is problematic with some mobile devices and iPhones in particular, as they will not reliably respond to ping request while the given device is in some deeper sleep mode. One possible work around is to use the pimatic-location plugin which comes at the cost of a siginficantly higher power draw according to my findings. Moreover, it is bound to using the iCloud “find my iphone” service.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Also set a static ip address.
My phone keeps changing its ip address even when i make it static.
So i had to make a bash script to filter the devices connected to my wifi by MAC via curl and then change state in pimatic…
It’s also working with device-names instead of IP addresses, but must be configured inside your router to manage named devices properly. For standard routers like FritzBox or (Telekom) Speedports it’s working fine in my net.
Like mwittig says it could be a problem of some mobile devices as they don’t react in sleep mode. I never got pings fro IPhones for example, but Android most times wors for me. But it is not really reliable.
Thanks for all the replies. I tried the ping plugin, using the device name - that seems to work for my iPhone 6 but somehow not for my wife’s iPhone 6s. But I’m getting there, will play around with the config a bit more.
The location tracking could be interesting, too - but I wonder if there would be a way to do it the other way round: Using geofencing to send a notification to pimatic from my phone once I’m close to home. Should be possible with a rather simple iOS app and wouldn’t waste that much energy. Is there some kind of plugin for receiving notifications as a sensor? Sound like a classic IFTTT use case I think…
you can try to use the tasker app in combination with the pimatic api
there is also an ifttt plugin.
you can find more information on the ifttt plugin here https://pimatic.org/plugins/pimatic-ifttt/
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
cool, thanks - I’ll give it a shot!
I just successfully setup pimatic-location with my iPhone using iCloud. I added my device and it shows up nicely including current location, distance and ETA.
Now I want to add a rule but I have no clue what logic would work here and I didn’t find any instructions. I want to do stuff like “if iPhone is present and it is after sunset turn on lights” please bear with my, probably it’s very obvious how to do that if you’re familiar with pimatic…
PS: What’s the difference between “and” and “and if”?
WHEN iphone is present and sunset starts THEN turn on lamp1 and turn on lamp2 and turn on tv
Note that you have to have a sunset device with id sunset. Start typung your rule and the gui makes suggestions to you.
doesn’t seem to work (“Could not find an provider that decides next predicate of “iPhone is present””). - sure it is “present”? that’s what works for the ping plugin, shouldn’t it be different for the pimatic-location plugin? There must be a list of some sort for supported attributes for each plugin…
ha, got it - found out how this rule GUI works in general. Looks like I finally found what I was looking for, thanks for all your support!
Good to hear. Have fun with the rule system. It is great
it really is! One last (?) question: Is there a way to check for the presence of my iPhone “on demand” as part of a rule only? Now iCloud gets checked every minute, probably impacting my phone’s battery. But I’d only like to check if I’m nearby after sunset and then turn on the lights. I found the “pimatic shell execute plugin” - maybe that one could help my use case?
Jeez, i dont know…
Good question.
There could be several options.
First option,
Create a button device. Make a rule to activate and deactivate(search forum) the location device and write a variable.
Second option, that would be the best if it works for you,
Create a bash script to ping your phone. Either via MAC or IP.
Route the output of the bash to a variable and let the bash run every 5 minutes or so.
Create a rule based on the variable:
WHEN it is after sunset and $iphonepresent = 1 THEN turn on light1
Where $iphonepresent is the variable.
Try setting up a simple bash ping script and see if it pings correctly. Im not sure what the difference would be between pimatic-ping or a bash script… Just try it.
Hmm… what about the option to use find-my-iphone and execute the call from within the rule? Would that be doable?
OR I could let the phone trigger an event via IFTTT, this is something that would work with what I’m asking for in this thread: https://forum.pimatic.org/topic/2166/how-to-trigger-a-virtual-sensor-using-the-ifttt-maker-channel
The pinging of my iPhone doesn’t really work because the iPhone sleeps if it’s not used and disconnects from the WiFi…
@GuybrushMR80
Im not sure about ifttt. You could try it.
I dont think there is a way to trigger a device with a rule in the way you want it…
You could use a variable but it still needs to check location to set the variable.
Setting the interval higher could make it possible that detection is way too late, also not an option.
There is a request to deactivate devices from rules.
For example:
WHEN it is after sunset AND iphone is present THEN turn on lamp 1 and disable iphone-location-device
However, when do you enable it again if it is deactivated? You dont. That will also cause battery drainage.
I dont think i can help you anymore. Maybe someone else knows a way