diff --git a/fhem/CHANGED b/fhem/CHANGED
index 1c85131ad..96a345ec3 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,10 @@
# 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.
+ - change: 73_PRESENCE: following attributes were renamed:
+ * ping_count => pingCount
+ * fritzbox_speed => fritzboxCheckSpeed
+ * bluetooth_hci_device => bluetoothHciDevice
+ existing configuration will be converted automatically
- bugfix: 74_XiaomiBTLESens: fix error messages
- feature: 46_TeslaPowerwall2AC: Powerwalls overwiev
- feature: 73_PRESENCE: new set commands overrideInterval and clearOverride
diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm
index 8f08c7c1c..8fd1b34d8 100755
--- a/fhem/FHEM/73_PRESENCE.pm
+++ b/fhem/FHEM/73_PRESENCE.pm
@@ -47,16 +47,22 @@ PRESENCE_Initialize($)
$hash->{UndefFn} = "PRESENCE_Undef";
$hash->{AttrFn} = "PRESENCE_Attr";
$hash->{AttrList} = "do_not_notify:0,1 ".
- "disable:0,1 ".
- "disabledForIntervals ".
- "fritzbox_speed:0,1 ".
- "ping_count:1,2,3,4,5,6,7,8,9,10 ".
- "bluetooth_hci_device ".
- "absenceThreshold ".
- "presenceThreshold ".
- "absenceTimeout ".
- "presenceTimeout ".
- "powerCmd ".$readingFnAttributes;
+ "disable:0,1 ".
+ "disabledForIntervals ".
+ "fritzboxCheckSpeed:0,1 ".
+ "pingCount:1,2,3,4,5,6,7,8,9,10 ".
+ "bluetoothHciDevice ".
+ "absenceThreshold ".
+ "presenceThreshold ".
+ "absenceTimeout ".
+ "presenceTimeout ".
+ "powerCmd ".
+ $readingFnAttributes;
+
+ $hash->{AttrRenameMap} = { "ping_count" => "pingCount",
+ "bluetooth_hci_device" => "bluetoothHciDevice",
+ "fritzbox_speed" => "fritzboxCheckSpeed"
+ };
}
@@ -662,17 +668,17 @@ sub PRESENCE_StartLocalScan($;$)
if($mode eq "local-bluetooth")
{
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode local-bluetooth";
- $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalBluetoothScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "bluetooth_hci_device", ""), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
+ $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalBluetoothScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "bluetoothHciDevice", ""), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
}
elsif($mode eq "lan-ping")
{
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode lan-ping";
- $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalPingScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "ping_count", "4"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
+ $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalPingScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "pingCount", "4"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
}
elsif($mode eq "fritzbox")
{
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode fritzbox";
- $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFritzBoxScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "fritzbox_speed", "0"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
+ $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFritzBoxScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "fritzboxCheckSpeed", "0"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
}
elsif($mode eq "shellscript")
{
@@ -1120,19 +1126,13 @@ sub PRESENCE_ProcessLocalScan($)
if($a[2] eq "present")
{
- readingsBulkUpdate($hash, "device_name", $a[3]) if(defined($a[3]) and $hash->{MODE} =~ /^(lan-bluetooth|local-bluetooth)$/ );
+ readingsBulkUpdate($hash, "device_name", $a[3]) if($hash->{MODE} =~ /^(lan-bluetooth|local-bluetooth)$/ and defined($a[3]));
- if($hash->{MODE} eq "fritzbox" and defined($a[4]))
- {
- readingsBulkUpdate($hash, "speed", $a[4]);
- }
+ readingsBulkUpdate($hash, "speed", $a[4]) if($hash->{MODE} eq "fritzbox" and defined($a[4]));
}
elsif($a[2] eq "absent")
{
- if($hash->{MODE} eq "fritzbox" and defined($a[4]))
- {
- readingsBulkUpdate($hash, "speed", $a[4]);
- }
+ readingsBulkUpdate($hash, "speed", $a[4]) if($hash->{MODE} eq "fritzbox" and defined($a[4]));
}
elsif($a[2] eq "error")
{
@@ -1441,7 +1441,7 @@ sub PRESENCE_setNotfiyDev($)
present-check-interval - The interval in seconds between each presence check in case the device is present. Otherwise the normal check-interval will be used.
-
+
Define
Mode: lan-ping
define <name> PRESENCE lan-ping <ip-address> [ <check-interval> [ <present-check-interval> ] ]
@@ -1622,7 +1622,7 @@ Options:
-
+
Set
- statusRequest - Schedules an immediatly check.
@@ -1632,7 +1632,7 @@ Options:
-
+
Get
N/A
@@ -1683,12 +1683,12 @@ Options:
the regular check interval.
Default Value is 3 (number of check retries)
- - ping_count
(Only in mode "ping" applicable)
+ - pingCount
(Only in mode "ping" applicable)
Changes the count of the used ping packets to recognize a present state. Depending on your network performance sometimes a packet can be lost or blocked.
Default Value is 4 (packets)
- - bluetooth_hci_device
(Only in Mode "local-bluetooth" applicable)
+ - bluetoothHciDevice
(Only in Mode "local-bluetooth" applicable)
Set a specific bluetooth HCI device to use for scanning. If you have multiple bluetooth modules connected, you can select a specific one to use for scanning (e.g. hci0, hci1, ...).
- - fritzbox_speed
(Only in Mode "fritzbox" applicable)
+ - fritzboxCheckSpeed
(Only in Mode "fritzbox" applicable)
When this attribute is enabled, the network speed is checked in addition to the device state.
This only makes sense for wireless devices connected directly to the FritzBox.
@@ -1715,20 +1715,24 @@ Options:
-
- Generated Events:
+
+ Generated readings/events:
- General Events:
+ General readings/events:
- - state: (absent|maybe absent|present|disabled|error|timeout) - The state of the device, check errors or "disabled" when the disable attribute is enabled
- - presence: (absent|maybe absent|present) - The state of the device. The value "maybe absent" only occurs if absenceThreshold is activated.
+ - state: (absent|maybe absent|present|maybe present|disabled|error|timeout) - The state of the device, check errors or "disabled" when the disable attribute is enabled
+ - presence: (absent|maybe absent|present|maybe present) - The presence state of the device. The value "maybe absent" only occurs if absenceThreshold is activated. The value "maybe present" only occurs if presenceThreshold is activated.
- powerCmd: (executed|failed) - power command was executed or has failed
- Bluetooth specific events:
+ Bluetooth specific readings/events:
- device_name: $name - The name of the Bluetooth device in case it's present
- presenced/collectord specific events:
+ FRITZ!Box specific readings/events:
+
+ - speed: $speed - The current speed of the checked device if attribute fritzboxCheckSpeed is activated
+
+ presenced/collectord specific readings/events:
- command_accepted: $command_accepted (yes|no) - Was the last command acknowleged and accepted by the presenced or collectord?
- room: $room - If the module is connected with a collector daemon this event shows the room, where the device is located (as defined in the collectord config file)
@@ -1763,7 +1767,7 @@ Options:
- present-check-interval - Das Prüfinterval in Sekunden, wenn ein Gerät anwesend (present) ist. Falls nicht angegeben, wird der Wert aus check-interval verwendet
-
+
Define
Modus: lan-ping
define <name> PRESENCE lan-ping <IP-Addresse oder Hostname> [ <Interval> [ <Anwesend-Interval> ] ]
@@ -1947,7 +1951,7 @@ Options:
-
+
Set
- statusRequest - Startet einen sofortigen Check.
@@ -1957,14 +1961,14 @@ Options:
-
+
Get
-
+
Attributes
- do_not_notify
@@ -2007,14 +2011,14 @@ Options:
innerhalb des in retryInterval konfigurierten Interval ausgeführt um in kürzerer Zeit ein valides Ergebnis zu erhalten.
Standardwert ist 3 Wiederholungen
- - ping_count
(Nur im Modus "ping" anwendbar)
+ - pingCount
(Nur im Modus "ping" anwendbar)
Verändert die Anzahl der Ping-Pakete die gesendet werden sollen um die Anwesenheit zu erkennen.
Je nach Netzwerkstabilität können erste Pakete verloren gehen oder blockiert werden.
Standardwert ist 4 (Versuche)
- - bluetooth_hci_device
(Nur im Modus "local-bluetooth" anwendbar)
+ - bluetoothHciDevice
(Nur im Modus "local-bluetooth" anwendbar)
Sofern man mehrere Bluetooth-Empfänger verfügbar hat, kann man mit diesem Attribut ein bestimmten Empfänger auswählen, welcher zur Erkennung verwendet werden soll (bspw. hci0, hci1, ...). Es muss dabei ein vorhandener HCI-Gerätename angegeben werden wie z.B. hci0.
- - fritzbox_speed
(Nur im Modus "fritzbox")
+ - fritzboxCheckSpeed
(Nur im Modus "fritzbox")
Zusätzlich zum Status des Geräts wird die aktuelle Verbindungsgeschwindigkeit ausgegeben
Das macht nur bei WLAN Geräten Sinn, die direkt mit der FritzBox verbunden sind. Bei abwesenden Geräten wird als Geschwindigkeit 0 ausgegeben.
@@ -2041,20 +2045,24 @@ Options:
-
- Generierte Events:
+
+ Generierte Readings/Events:
- Generelle Events:
+ Generelle ReadingsEvents:
- - state: (absent|maybe absent|present|disabled|error|timeout) - Der Anwesenheitsstatus eine Gerätes (absent = abwesend; present = anwesend) oder "disabled" wenn das disable-Attribut aktiviert ist
- - presence: (absent|maybe absent|present) - Der Anwesenheitsstatus eine Gerätes (absent = abwesend; present = anwesend). Der Wert "maybe absent" (vielleicht abwesend) tritt nur auf, sofern das Attribut absenceThreshold aktiviert ist.
+ - state: (absent|maybe absent|present|maybe present|disabled|error|timeout) - Der Anwesenheitsstatus eine Gerätes (absent = abwesend; present = anwesend) oder "disabled" wenn das disable-Attribut aktiviert ist
+ - presence: (absent|maybe absent|present|maybe present) - Der Anwesenheitsstatus eine Gerätes (absent = abwesend; present = anwesend). Der Wert "maybe absent" (vielleicht abwesend) tritt nur auf, sofern das Attribut absenceThreshold aktiviert ist. Der Wert "maybe present" (vielleicht anwesend) tritt nur auf, sofern das Attribut presenceThreshold aktiviert ist.
- powerCmd: (executed|failed) - Ausführung des power-Befehls war erfolgreich.
- Bluetooth-spezifische Events:
+ Bluetooth-spezifische Readings/Events:
- device_name: $name - Der Name des Bluetooth-Gerätes, wenn es anwesend (Status: present) ist
- presenced-/collectord-spezifische Events:
+ FRITZ!Box-spezifische Readings/Events:
+
+ - speed: $speed - Die Netzwerkdeschwindigkeit des Gerätes, sofern das Attribut fritzboxCheckSpeed aktiviert ist.
+
+ presenced-/collectord-spezifische Readings/Events:
- command_accepted: $command_accepted (yes|no) - Wurde das letzte Kommando an den presenced/collectord akzeptiert (yes = ja, no = nein)?
- room: $room - Wenn das Modul mit einem collectord verbunden ist, zeigt dieses Event den Raum an, in welchem dieses Gerät erkannt wurde (Raumname entsprechend der Konfigurationsdatei des collectord)