Page 1 of 2
Wifi switches for phones
Posted: Sunday 13 December 2015 17:18
by rednas
Hello,
I would like to have dummy switches within Domoticz which are on/off whether the phone is connected to the wifi. Every phone should have its own switch.
I already tried it with pinging but the phones turn off the wifi (or just don't respond to the ping command) when the screen is turned off (both androids and iphones do this).
The second thing I tried was by using an IFTTT trigger after (dis)connecting to the wifi. This worked like a charm, BUT this is not possible with iphones. IFTTT does not provide a trigger for an iphone (dis)connecting to Wifi.
Can I do this in another way?
Thanks in advance!
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 17:54
by alfred_j_kwak
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 19:18
by rednas
I don't want to use ping anymore, however I'll give it a try.
I added two ip addresses of phones, but (silly question) where do I find the logs of the ping requests? Can't find anything like a device or something of the logs...
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 19:50
by rednas
Well I now added 2 dummy switches with the same names as the 2 nodes of the System Alive Checker (guess that's what I have to do?)
These switches are not updated.
Only thing I see in the log is:
2015-12-13 19:48:05.772 Pinger: Worker stopped...
2015-12-13 19:48:05.784 Pinger: Started
And after this I don't see the "Pinger" returning anymore... What am I doing wrong?
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:08
by StanHD
After you add the addresses in the hardware, set Domoticz to accept new devices. (Allow for 5 minutes should do it). Then they show up in the Not Used device list. Add the switch from there by clicking on the Green Arrow.
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:13
by rednas
Thanks, that did the trick! Will try this out.
Someone also knowing a trick to call a HTTP request on (dis)connecting Wifi on an iphone?
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:15
by StanHD
Could you edit the "Off" action of the switch?
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:17
by rednas
I am currently not using the on/off actions.
Isn't it working for you?
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:30
by StanHD
Yes, I have several http commands in switches to overide my Evohome set points when a door or window is opened. Works well.
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:37
by rednas
Alright, well I just want to know whether someone connects or disconnects from the wifi.
The pinging also thinks the phones are disconnected when they are still connected and that's something I don't want to happen..
Re: Wifi switches for phones
Posted: Sunday 13 December 2015 20:43
by Westcott
Hi StanHD,
I'm trying as well to get this to work.
Two switches are there - (2 devices) Lighting2 AC On/Off
Both shown as Off with no activity at all logged.
The actual devices are connected to my WiFi
Nothing is logged if I disconnect one from WiFi, wait a couple of minutes, and re-connect.
Thanks.
Re: Wifi switches for phones
Posted: Monday 14 December 2015 0:17
by StanHD
Hi Westcott,
We have 2 Android phones and 2 smart TVs that we use with this. Each logs totally reliable when connecting / disconnecting. We use the phones for presence detection and the TVs to set lighting scenes. Other users, however, report problems and un-reliable operation. My Domoticz is running under Windows, maybe this is the difference?
Re: Wifi switches for phones
Posted: Monday 14 December 2015 0:31
by pvm
It is running reliable on my raspberry pi2
Re: Wifi switches for phones
Posted: Monday 14 December 2015 7:17
by jannl
I use a perl script which runs very reliable. 2 androids and one iphone. Only disadvantage is the long time out for iphones, 40 minutes here.
Re: Wifi switches for phones
Posted: Monday 14 December 2015 17:32
by Westcott
For those of you who are successfully using Domoticz' Ping - does anything show up in your log?
Re: Wifi switches for phones
Posted: Monday 14 December 2015 18:46
by StanHD
Yes when ping response status changes:-
2015-12-14 17:44:16.566 (Ping) Lighting 2 (TV Kitchen)
Re: Wifi switches for phones
Posted: Monday 14 December 2015 20:51
by Westcott
Stan, thanks.
Sorry to keep on, but I'm guessing that there is some config difference between our setups.
Like Rednas, all I see is the Ping worker starting, then no more action.
A Lighting2 AC device is added for each of my 3 Ping entries, but is never actually pinged, unlike yours.
Re: Wifi switches for phones
Posted: Monday 14 December 2015 23:02
by rednas
I was again searching through my Android Wifi settings and found my ipv4 address greyed out and ipv6 seems active.
When I ping my ipv4 address it does not receive any packages, but it does receive the packages when I ping the ipv6 address.
Could this be the problem everyone is experiencing? How can I solve this?
Re: Wifi switches for phones
Posted: Monday 14 December 2015 23:15
by rgroothuis
Another question I'm having on this subject is how to use this pinging information (if it works) in the LUA scripts? Any examples?
I found the device I'm pinging in my device list but I cannot add it to my switches dashboard, is this correct? And because of that I also cannot see the pinging result history, so I cannot tell if my iPhone is ping-ed correctly.
Re: Wifi switches for phones
Posted: Monday 14 December 2015 23:33
by StanHD
I have disabled IPv6 on my router for my LAN (not WAN) as this gave me other problems. May be worth a try?