mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
20_ROOMMATE.pm: add attribute rg_noDuration, see forum msg #226922
git-svn-id: https://svn.fhem.de/fhem/trunk@7128 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e9d89a4f54
commit
e0620afc8d
@ -56,7 +56,7 @@ sub ROOMMATE_Initialize($) {
|
|||||||
$hash->{DefFn} = "ROOMMATE_Define";
|
$hash->{DefFn} = "ROOMMATE_Define";
|
||||||
$hash->{UndefFn} = "ROOMMATE_Undefine";
|
$hash->{UndefFn} = "ROOMMATE_Undefine";
|
||||||
$hash->{AttrList} =
|
$hash->{AttrList} =
|
||||||
"rr_locationHome rr_locationWayhome rr_locationUnderway rr_autoGoneAfter:12,16,24,26,28,30,36,48,60 rr_showAllStates:0,1 rr_realname:group,alias rr_states rr_locations rr_moods rr_moodDefault rr_moodSleepy rr_passPresenceTo "
|
"rr_locationHome rr_locationWayhome rr_locationUnderway rr_autoGoneAfter:12,16,24,26,28,30,36,48,60 rr_showAllStates:0,1 rr_realname:group,alias rr_states rr_locations rr_moods rr_moodDefault rr_moodSleepy rr_passPresenceTo rr_noDuration:0,1 "
|
||||||
. $readingFnAttributes;
|
. $readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,79 +762,82 @@ sub ROOMMATE_DurationTimer($;$) {
|
|||||||
|
|
||||||
ROOMMATE_RemoveInternalTimer( "DurationTimer", $hash );
|
ROOMMATE_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 -
|
|
||||||
ROOMMATE_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" )
|
||||||
{
|
{
|
||||||
if ( defined( $hash->{READINGS}{lastDeparture}{VAL} )
|
if ( defined( $hash->{READINGS}{lastArrival}{VAL} )
|
||||||
&& $hash->{READINGS}{lastDeparture}{VAL} ne "-" )
|
&& $hash->{READINGS}{lastArrival}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
$durAbsence =
|
$durPresence =
|
||||||
$timestampNow -
|
$timestampNow -
|
||||||
ROOMMATE_Datetime2Timestamp(
|
ROOMMATE_Datetime2Timestamp(
|
||||||
$hash->{READINGS}{lastDeparture}{VAL} );
|
$hash->{READINGS}{lastArrival}{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" )
|
||||||
{
|
{
|
||||||
if ( defined( $hash->{READINGS}{lastSleep}{VAL} )
|
if ( defined( $hash->{READINGS}{lastDeparture}{VAL} )
|
||||||
&& $hash->{READINGS}{lastSleep}{VAL} ne "-" )
|
&& $hash->{READINGS}{lastDeparture}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
$durSleep =
|
$durAbsence =
|
||||||
$timestampNow -
|
$timestampNow -
|
||||||
ROOMMATE_Datetime2Timestamp( $hash->{READINGS}{lastSleep}{VAL} );
|
ROOMMATE_Datetime2Timestamp(
|
||||||
}
|
$hash->{READINGS}{lastDeparture}{VAL} );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $durPresence_hr =
|
# sleep timer
|
||||||
( $durPresence > 0 ) ? ROOMMATE_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 ) ? ROOMMATE_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 ) ? ROOMMATE_sec2time($durSleep) : "00:00:00";
|
ROOMMATE_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 ) ? ROOMMATE_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 ) ? ROOMMATE_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 ) ? ROOMMATE_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 );
|
||||||
|
}
|
||||||
|
|
||||||
ROOMMATE_InternalTimer( "DurationTimer", $timestampNow + 60,
|
ROOMMATE_InternalTimer( "DurationTimer", $timestampNow + 60,
|
||||||
"ROOMMATE_DurationTimer", $hash, 1 );
|
"ROOMMATE_DurationTimer", $hash, 1 );
|
||||||
@ -1126,6 +1129,9 @@ sub ROOMMATE_StartInternalTimers($$) {
|
|||||||
<li>
|
<li>
|
||||||
<b>rr_moods</b> - list of moods to be shown in FHEMWEB; separate entries by comma only and do NOT use spaces
|
<b>rr_moods</b> - list of moods to be shown in FHEMWEB; separate entries by comma only and do NOT use spaces
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>rr_noDuration</b> - may be used to disable duration timer calculation (see readings durTimer*)
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>rr_passPresenceTo</b> - synchronize presence state with other ROOMMATE or GUEST devices; separte devices by space
|
<b>rr_passPresenceTo</b> - synchronize presence state with other ROOMMATE or GUEST devices; separte devices by space
|
||||||
</li>
|
</li>
|
||||||
@ -1393,6 +1399,9 @@ sub ROOMMATE_StartInternalTimers($$) {
|
|||||||
<li>
|
<li>
|
||||||
<b>rr_moods</b> - Liste von Stimmungen, wie sie in FHEMWEB angezeigt werden sollen; mehrere Einträge nur durch Komma trennen und KEINE Leerzeichen verwenden
|
<b>rr_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>rr_noDuration</b> - deaktiviert die Berechnung der Zeitspannen (siehe Readings durTimer*)
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>rr_passPresenceTo</b> - synchronisiere die Anwesenheit mit anderen ROOMMATE oder GUEST Devices; mehrere Devices durch Leerzeichen trennen
|
<b>rr_passPresenceTo</b> - synchronisiere die Anwesenheit mit anderen ROOMMATE oder GUEST Devices; mehrere Devices durch Leerzeichen trennen
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user