mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
20_GUEST.pm: add attribute rg_noDuration, see forum msg #226922
git-svn-id: https://svn.fhem.de/fhem/trunk@7127 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d3deb75ffd
commit
e9d89a4f54
@ -56,7 +56,7 @@ sub GUEST_Initialize($) {
|
|||||||
$hash->{DefFn} = "GUEST_Define";
|
$hash->{DefFn} = "GUEST_Define";
|
||||||
$hash->{UndefFn} = "GUEST_Undefine";
|
$hash->{UndefFn} = "GUEST_Undefine";
|
||||||
$hash->{AttrList} =
|
$hash->{AttrList} =
|
||||||
"rg_locationHome rg_locationWayhome rg_locationUnderway rg_autoGoneAfter:12,16,24,26,28,30,36,48,60 rg_showAllStates:0,1 rg_realname:group,alias rg_states rg_locations rg_moods rg_moodDefault rg_moodSleepy "
|
"rg_locationHome rg_locationWayhome rg_locationUnderway rg_autoGoneAfter:12,16,24,26,28,30,36,48,60 rg_showAllStates:0,1 rg_realname:group,alias rg_states rg_locations rg_moods rg_moodDefault rg_moodSleepy rg_noDuration:0,1 "
|
||||||
. $readingFnAttributes;
|
. $readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,79 +792,82 @@ sub GUEST_DurationTimer($;$) {
|
|||||||
|
|
||||||
GUEST_RemoveInternalTimer( "DurationTimer", $hash );
|
GUEST_RemoveInternalTimer( "DurationTimer", $hash );
|
||||||
|
|
||||||
# presence timer
|
if ( !defined($attr{$name}{noDuration}) || $attr{$name}{noDuration} == 0 ) {
|
||||||
if ( defined( $hash->{READINGS}{presence}{VAL} )
|
|
||||||
&& $hash->{READINGS}{presence}{VAL} eq "present" )
|
|
||||||
{
|
|
||||||
if ( defined( $hash->{READINGS}{lastArrival}{VAL} )
|
|
||||||
&& $hash->{READINGS}{lastArrival}{VAL} ne "-" )
|
|
||||||
{
|
|
||||||
$durPresence =
|
|
||||||
$timestampNow -
|
|
||||||
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastArrival}{VAL} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# absence timer
|
# presence timer
|
||||||
if ( defined( $hash->{READINGS}{presence}{VAL} )
|
if ( defined( $hash->{READINGS}{presence}{VAL} )
|
||||||
&& $hash->{READINGS}{presence}{VAL} eq "absent"
|
&& $hash->{READINGS}{presence}{VAL} eq "present" )
|
||||||
&& defined( $hash->{READINGS}{state}{VAL} )
|
{
|
||||||
&& $hash->{READINGS}{state}{VAL} eq "absent" )
|
if ( defined( $hash->{READINGS}{lastArrival}{VAL} )
|
||||||
{
|
&& $hash->{READINGS}{lastArrival}{VAL} ne "-" )
|
||||||
if ( defined( $hash->{READINGS}{lastDeparture}{VAL} )
|
{
|
||||||
&& $hash->{READINGS}{lastDeparture}{VAL} ne "-" )
|
$durPresence =
|
||||||
{
|
$timestampNow -
|
||||||
$durAbsence =
|
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastArrival}{VAL} );
|
||||||
$timestampNow -
|
}
|
||||||
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastDeparture}{VAL} );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# sleep timer
|
# absence timer
|
||||||
if ( defined( $hash->{READINGS}{state}{VAL} )
|
if ( defined( $hash->{READINGS}{presence}{VAL} )
|
||||||
&& $hash->{READINGS}{state}{VAL} eq "asleep" )
|
&& $hash->{READINGS}{presence}{VAL} eq "absent"
|
||||||
{
|
&& defined( $hash->{READINGS}{state}{VAL} )
|
||||||
if ( defined( $hash->{READINGS}{lastSleep}{VAL} )
|
&& $hash->{READINGS}{state}{VAL} eq "absent" )
|
||||||
&& $hash->{READINGS}{lastSleep}{VAL} ne "-" )
|
{
|
||||||
{
|
if ( defined( $hash->{READINGS}{lastDeparture}{VAL} )
|
||||||
$durSleep =
|
&& $hash->{READINGS}{lastDeparture}{VAL} ne "-" )
|
||||||
$timestampNow -
|
{
|
||||||
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastSleep}{VAL} );
|
$durAbsence =
|
||||||
}
|
$timestampNow -
|
||||||
}
|
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastDeparture}{VAL} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $durPresence_hr =
|
# sleep timer
|
||||||
( $durPresence > 0 ) ? GUEST_sec2time($durPresence) : "00:00:00";
|
if ( defined( $hash->{READINGS}{state}{VAL} )
|
||||||
my $durPresence_cr =
|
&& $hash->{READINGS}{state}{VAL} eq "asleep" )
|
||||||
( $durPresence > 60 ) ? int( $durPresence / 60 + 0.5 ) : 0;
|
{
|
||||||
my $durAbsence_hr =
|
if ( defined( $hash->{READINGS}{lastSleep}{VAL} )
|
||||||
( $durAbsence > 0 ) ? GUEST_sec2time($durAbsence) : "00:00:00";
|
&& $hash->{READINGS}{lastSleep}{VAL} ne "-" )
|
||||||
my $durAbsence_cr =
|
{
|
||||||
( $durAbsence > 60 ) ? int( $durAbsence / 60 + 0.5 ) : 0;
|
$durSleep =
|
||||||
my $durSleep_hr =
|
$timestampNow -
|
||||||
( $durSleep > 0 ) ? GUEST_sec2time($durSleep) : "00:00:00";
|
GUEST_Datetime2Timestamp( $hash->{READINGS}{lastSleep}{VAL} );
|
||||||
my $durSleep_cr = ( $durSleep > 60 ) ? int( $durSleep / 60 + 0.5 ) : 0;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readingsBeginUpdate($hash) if ( !$silent );
|
my $durPresence_hr =
|
||||||
readingsBulkUpdate( $hash, "durTimerPresence_cr", $durPresence_cr )
|
( $durPresence > 0 ) ? GUEST_sec2time($durPresence) : "00:00:00";
|
||||||
if ( !defined( $hash->{READINGS}{durTimerPresence_cr}{VAL} )
|
my $durPresence_cr =
|
||||||
|| $hash->{READINGS}{durTimerPresence_cr}{VAL} ne $durPresence_cr );
|
( $durPresence > 60 ) ? int( $durPresence / 60 + 0.5 ) : 0;
|
||||||
readingsBulkUpdate( $hash, "durTimerPresence", $durPresence_hr )
|
my $durAbsence_hr =
|
||||||
if ( !defined( $hash->{READINGS}{durTimerPresence}{VAL} )
|
( $durAbsence > 0 ) ? GUEST_sec2time($durAbsence) : "00:00:00";
|
||||||
|| $hash->{READINGS}{durTimerPresence}{VAL} ne $durPresence_hr );
|
my $durAbsence_cr =
|
||||||
readingsBulkUpdate( $hash, "durTimerAbsence_cr", $durAbsence_cr )
|
( $durAbsence > 60 ) ? int( $durAbsence / 60 + 0.5 ) : 0;
|
||||||
if ( !defined( $hash->{READINGS}{durTimerAbsence_cr}{VAL} )
|
my $durSleep_hr =
|
||||||
|| $hash->{READINGS}{durTimerAbsence_cr}{VAL} ne $durAbsence_cr );
|
( $durSleep > 0 ) ? GUEST_sec2time($durSleep) : "00:00:00";
|
||||||
readingsBulkUpdate( $hash, "durTimerAbsence", $durAbsence_hr )
|
my $durSleep_cr = ( $durSleep > 60 ) ? int( $durSleep / 60 + 0.5 ) : 0;
|
||||||
if ( !defined( $hash->{READINGS}{durTimerAbsence}{VAL} )
|
|
||||||
|| $hash->{READINGS}{durTimerAbsence}{VAL} ne $durAbsence_hr );
|
readingsBeginUpdate($hash) if ( !$silent );
|
||||||
readingsBulkUpdate( $hash, "durTimerSleep_cr", $durSleep_cr )
|
readingsBulkUpdate( $hash, "durTimerPresence_cr", $durPresence_cr )
|
||||||
if ( !defined( $hash->{READINGS}{durTimerSleep_cr}{VAL} )
|
if ( !defined( $hash->{READINGS}{durTimerPresence_cr}{VAL} )
|
||||||
|| $hash->{READINGS}{durTimerSleep_cr}{VAL} ne $durSleep_cr );
|
|| $hash->{READINGS}{durTimerPresence_cr}{VAL} ne $durPresence_cr );
|
||||||
readingsBulkUpdate( $hash, "durTimerSleep", $durSleep_hr )
|
readingsBulkUpdate( $hash, "durTimerPresence", $durPresence_hr )
|
||||||
if ( !defined( $hash->{READINGS}{durTimerSleep}{VAL} )
|
if ( !defined( $hash->{READINGS}{durTimerPresence}{VAL} )
|
||||||
|| $hash->{READINGS}{durTimerSleep}{VAL} ne $durSleep_hr );
|
|| $hash->{READINGS}{durTimerPresence}{VAL} ne $durPresence_hr );
|
||||||
readingsEndUpdate( $hash, 1 ) if ( !$silent );
|
readingsBulkUpdate( $hash, "durTimerAbsence_cr", $durAbsence_cr )
|
||||||
|
if ( !defined( $hash->{READINGS}{durTimerAbsence_cr}{VAL} )
|
||||||
|
|| $hash->{READINGS}{durTimerAbsence_cr}{VAL} ne $durAbsence_cr );
|
||||||
|
readingsBulkUpdate( $hash, "durTimerAbsence", $durAbsence_hr )
|
||||||
|
if ( !defined( $hash->{READINGS}{durTimerAbsence}{VAL} )
|
||||||
|
|| $hash->{READINGS}{durTimerAbsence}{VAL} ne $durAbsence_hr );
|
||||||
|
readingsBulkUpdate( $hash, "durTimerSleep_cr", $durSleep_cr )
|
||||||
|
if ( !defined( $hash->{READINGS}{durTimerSleep_cr}{VAL} )
|
||||||
|
|| $hash->{READINGS}{durTimerSleep_cr}{VAL} ne $durSleep_cr );
|
||||||
|
readingsBulkUpdate( $hash, "durTimerSleep", $durSleep_hr )
|
||||||
|
if ( !defined( $hash->{READINGS}{durTimerSleep}{VAL} )
|
||||||
|
|| $hash->{READINGS}{durTimerSleep}{VAL} ne $durSleep_hr );
|
||||||
|
readingsEndUpdate( $hash, 1 ) if ( !$silent );
|
||||||
|
}
|
||||||
|
|
||||||
GUEST_InternalTimer( "DurationTimer", $timestampNow + 60,
|
GUEST_InternalTimer( "DurationTimer", $timestampNow + 60,
|
||||||
"GUEST_DurationTimer", $hash, 1 )
|
"GUEST_DurationTimer", $hash, 1 )
|
||||||
@ -1151,6 +1154,9 @@ sub GUEST_StartInternalTimers($$) {
|
|||||||
<li>
|
<li>
|
||||||
<b>rg_moods</b> - list of moods to be shown in FHEMWEB; separate entries by comma only and do NOT use spaces
|
<b>rg_moods</b> - list of moods to be shown in FHEMWEB; separate entries by comma only and do NOT use spaces
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>rg_noDuration</b> - may be used to disable duration timer calculation (see readings durTimer*)
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>rg_passPresenceTo</b> - synchronize presence state with other GUEST or GUEST devices; separte devices by space
|
<b>rg_passPresenceTo</b> - synchronize presence state with other GUEST or GUEST devices; separte devices by space
|
||||||
</li>
|
</li>
|
||||||
@ -1418,6 +1424,9 @@ sub GUEST_StartInternalTimers($$) {
|
|||||||
<li>
|
<li>
|
||||||
<b>rg_moods</b> - Liste von Stimmungen, wie sie in FHEMWEB angezeigt werden sollen; mehrere Einträge nur durch Komma trennen und KEINE Leerzeichen verwenden
|
<b>rg_moods</b> - Liste von Stimmungen, wie sie in FHEMWEB angezeigt werden sollen; mehrere Einträge nur durch Komma trennen und KEINE Leerzeichen verwenden
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>rg_noDuration</b> - deaktiviert die Berechnung der Zeitspannen (siehe Readings durTimer*)
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>rg_passPresenceTo</b> - synchronisiere die Anwesenheit mit anderen GUEST oder ROOMMATE Devices; mehrere Devices durch Leerzeichen trennen
|
<b>rg_passPresenceTo</b> - synchronisiere die Anwesenheit mit anderen GUEST oder ROOMMATE Devices; mehrere Devices durch Leerzeichen trennen
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user