From 03c4aebb227832b9f944962d2a37cab2f76a20e3 Mon Sep 17 00:00:00 2001 From: markusbloch Date: Wed, 24 Jan 2018 10:44:02 +0000 Subject: [PATCH] PRESENCE: renamed attributes (pingCount, fritzboxCheckSpeed, bluetoothHciDevice) via AttrRenameMap. Minor Commandref updates git-svn-id: https://svn.fhem.de/fhem/trunk@15979 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 5 ++ fhem/FHEM/73_PRESENCE.pm | 106 +++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 49 deletions(-) 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


    - + Set
    - + Get
    - - Generated Events:

    + + Generated readings/events: