From 1a66831f39d0bb23ce3276de467d20bfcc21eab0 Mon Sep 17 00:00:00 2001 From: markusbloch Date: Fri, 9 Jan 2015 16:16:07 +0000 Subject: [PATCH] PRESENCE: new reading "presence" which contains the current (or last known) presence state, which can be just "absent" or "present" (Forum: #29334) git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7485 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/73_PRESENCE.pm | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index d852c8521..106a5052a 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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: new reading "presence" which contains the current (or last known) + presence state (can be "absent" or "present") - bugfix: 70_Jabber.pm: hardening XML::Stream Process() call and fix of ssl_verify - feature: readingsGroup: allow devspec :FILTER= expressions in device selection - added: 73_km200.pm for the Buderus KM200 heating controller (Sailor) diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index 11df26c09..b22cd9d33 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -423,10 +423,12 @@ PRESENCE_Read($) if($buf eq "absence") { readingsBulkUpdate($hash, "state", "absent"); + readingsBulkUpdate($hash, "presence", "absent"); } elsif($buf =~ /present;(.+?)$/) { readingsBulkUpdate($hash, "state", "present"); + readingsBulkUpdate($hash, "presence", "present"); if($1 =~ /^(.*);(.+)$/) { @@ -941,6 +943,7 @@ PRESENCE_ProcessLocalScan($) if($a[2] eq "present") { readingsBulkUpdate($hash, "state", "present"); + readingsBulkUpdate($hash, "presence", "present"); readingsBulkUpdate($hash, "device_name", $a[3]) if(defined($a[3]) and $hash->{MODE} =~ /^(lan-bluetooth|local-bluetooth)$/ ); if($hash->{MODE} eq "fritzbox" and defined($a[4])) @@ -951,7 +954,7 @@ PRESENCE_ProcessLocalScan($) elsif($a[2] eq "absent") { readingsBulkUpdate($hash, "state", "absent"); - + readingsBulkUpdate($hash, "presence", "absent"); if($hash->{MODE} eq "fritzbox" and defined($a[4])) { readingsBulkUpdate($hash, "speed", $a[4]); @@ -1243,7 +1246,8 @@ Options: