Wifi switches for phones

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Wifi switches for phones

Post 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!
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Wifi switches for phones

Post by alfred_j_kwak »

rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post 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...
rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post 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?
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post 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.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post 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?
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post by StanHD »

Could you edit the "Off" action of the switch?
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post by rednas »

I am currently not using the on/off actions.
Isn't it working for you?
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post 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.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post 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..
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Wifi switches for phones

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post 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?
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

Re: Wifi switches for phones

Post by pvm »

It is running reliable on my raspberry pi2
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
jannl
Posts: 825
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: Wifi switches for phones

Post 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.
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Wifi switches for phones

Post by Westcott »

For those of you who are successfully using Domoticz' Ping - does anything show up in your log?
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post by StanHD »

Yes when ping response status changes:-

2015-12-14 17:44:16.566 (Ping) Lighting 2 (TV Kitchen)
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Wifi switches for phones

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
rednas
Posts: 132
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wifi switches for phones

Post 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?
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wifi switches for phones

Post 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.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Wifi switches for phones

Post 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?
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest