FHEM Forum

FHEM - Hausautomations-Systeme => Unterstützende Dienste => Thema gestartet von: HarryT am 21 Februar 2018, 21:00:04

Titel: Presence doesn't detect samsung smartphone
Beitrag von: HarryT am 21 Februar 2018, 21:00:04
Hi

I use FHEM 5.8 on a Raspberry. My own samsung galaxy s7 is detect with the presence module, lan-ping. The galaxy-s6 smartphone of my wife not.  It doesn work on my productieon system nor on my test system. I have removed the connection from the Fritzbox and connected again. No result. I have checked the IP address.

Any ideas what I could do or test to get it working?

{HT}

Ok, it seems the phone isn´t answering a ping.  Anybody an idea why not?
Titel: Antw:Presence doesn't detect samsung smartphone
Beitrag von: jensb am 21 Februar 2018, 21:16:48
Hi HT,

some phones have a firewall that prevents echo replies. Another reason depends on your settings: the WiFi may go into sleep mode, but then you should be able to ping if the phone is on and connected to WiFi.

Have a look at that (https://stackoverflow.com/questions/44598334/cant-ping-android-device) post. If the firewall is the reason you can pack nmap into a script and use "shellscript" mode instead of "lan-ping" with PRESENCE.

Greetings,
JB
Titel: Antw:Presence doesn't detect samsung smartphone
Beitrag von: HarryT am 21 Februar 2018, 21:42:34
Hi JB

Thanks for you quick answer. Indeed with nmaps the phone is seen. So it will be a firewall problem.

I know it is not a fhem problem anymore, but I can't find a firewall on the phone nor is Knox installed. Any guess where I can find which firewall is installed and how I can turn it off? The phone has also huge delays with receiving mails and messages, so I guess this is the way to solve both issues.  Thanks for any help.

{HT}
Titel: Antw:Presence doesn't detect samsung smartphone
Beitrag von: jensb am 22 Februar 2018, 21:15:10
Hi HT,

as far as I know an Android smartphone does not have a firewall frontend comparable to a Windows machine. I would expect the firewalls to be setup by the OS and if you want to change the firewall rules you will probably need to root the device first. A solid understanding of Linux/Android command line and firewall techniques is also required. To block or allow a ping to be received and answered you use:

iptables -A INPUT -p icmp --icmp-type echo-request -j REJECT/DROP/ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j REJECT/ACCEPT


Depending on the firewall strategy of the OS you will either have to remove an existing reject/drop rule or add an accept rule. But that is all just theory. If your are lucky there is some app out there that can enable pinging without rooting. Personally I would not compromise the security settings of my phone in any way and I prefer not to be pingable in a public network (and it will be hard to have it both ways).

On the other hand a firewall does not typically make a smartphone slow. If the phone was already running for some time try a cache wipe first. Uninstalling/disabling unused apps also helps a bit. If you can backup all essential data and are willing to do a step by step reinstall/reconfigure - a factory reset will show you what is possible in respect to performace.

Greetings,
JB