From fc772bb938f5b18e51bcc7a76c4e23471f9cd9fd Mon Sep 17 00:00:00 2001
From: markusbloch <>
Date: Wed, 14 Oct 2015 17:01:10 +0000
Subject: [PATCH] PRESENCE: support for Solaris ping (mode: local-ping)
git-svn-id: https://svn.fhem.de/fhem/trunk@9454 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/CHANGED | 1 +
fhem/FHEM/73_PRESENCE.pm | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index 62ad5b66b..b76c931ce 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
+ - feature: PRESENCE: support for Solaris ping (mode: local-ping)
- feature: HUEbridge: added support for HUE scenes
(get: scenes; set: savescene, modifyscene, scene)
new unified syntax for multiple lights
diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm
index e3ebdaf24..a952050bc 100755
--- a/fhem/FHEM/73_PRESENCE.pm
+++ b/fhem/FHEM/73_PRESENCE.pm
@@ -610,6 +610,21 @@ PRESENCE_DoLocalPingScan($)
$return = "$name|$local|error|Could not execute ping command: \"ping -n $count -4 $device\"";
}
}
+ elsif($^O =~ m/solaris/)
+ {
+ $temp = qx(ping $device 4);
+
+ chomp $temp;
+ if($temp ne "")
+ {
+ Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp";
+ $return = "$name|$local|".($temp =~ /is alive/ ? "present" : "absent");
+ }
+ else
+ {
+ $return = "$name|$local|error|Could not execute ping command: \"ping -n $count -4 $device\"";
+ }
+ }
else
{
$temp = qx(ping -c $count $device 2>&1);
@@ -1226,7 +1241,7 @@ Options:
If this attribute is activated, an active check will be disabled.
Possible values: 0 => not disabled , 1 => disabled
Default Value is 0 (not disabled)
-