diff --git a/fhem/FHEM/20_GUEST.pm b/fhem/FHEM/20_GUEST.pm
index fdee6c24e..46e8a174a 100644
--- a/fhem/FHEM/20_GUEST.pm
+++ b/fhem/FHEM/20_GUEST.pm
@@ -322,8 +322,9 @@ sub GUEST_Set($@) {
$usage .= " location$locations";
if ($adminMode) {
$usage .= " create:wakeuptimer";
-
- # $usage .= " compactMode:noArg largeMode:noArg";
+ $usage .= ",locationMap"
+ if ( ReadingsVal( $name, "locationLat", "-" ) ne "-"
+ && ReadingsVal( $name, "locationLong", "-" ) ne "-" );
}
# silentSet
@@ -747,8 +748,12 @@ sub GUEST_Set($@) {
}
# create
- elsif ( $a[1] eq "create" ) {
- if ( defined( $a[2] ) && $a[2] eq "wakeuptimer" ) {
+ elsif ( lc( $a[1] ) eq "create" ) {
+ if ( !defined( $a[2] ) ) {
+ return
+ "Invalid 2nd argument, choose one of wakeuptimer locationMap ";
+ }
+ elsif ( lc( $a[2] ) eq "wakeuptimer" ) {
my $i = "1";
my $wakeuptimerName = $name . "_wakeuptimer" . $i;
my $created = 0;
@@ -804,8 +809,38 @@ sub GUEST_Set($@) {
return
"Dummy $wakeuptimerName and other pending devices created and pre-configured.\nYou may edit Macro_$wakeuptimerName to define your wake-up actions\nand at_$wakeuptimerName for optional at-device adjustments.";
}
- else {
- return "Invalid 2nd argument, choose one of wakeuptimer ";
+ elsif ( lc( $a[2] ) eq "locationmap" ) {
+ my $locationmapName = $name . "_map";
+
+ if ( defined( $defs{$locationmapName} ) ) {
+ return
+"Device $locationmapName existing already, delete it first to have it re-created.";
+ }
+ else {
+ my $sortby = AttrVal( $name, "sortby", -1 );
+ $sortby++;
+
+ # create new weblink device
+ fhem "define $locationmapName weblink htmlCode {
+'
+
+
'
+}";
+ fhem "attr $locationmapName alias Current Location";
+ fhem
+ "attr $locationmapName comment Auto-created by GUEST module";
+ fhem "attr $locationmapName group " . $attr{$name}{group}
+ if ( defined( $attr{$name}{group} ) );
+ fhem "attr $locationmapName room " . $attr{$name}{room}
+ if ( defined( $attr{$name}{room} ) );
+ }
+
+ return "Weblink device $locationmapName was created.";
}
}
@@ -889,8 +924,7 @@ sub GUEST_DurationTimer($;$) {
{
$durPresence =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastArrival", "" ) );
+ time_str2num( ReadingsVal( $name, "lastArrival", "" ) );
}
# absence timer
@@ -899,8 +933,7 @@ sub GUEST_DurationTimer($;$) {
{
$durAbsence =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastDeparture", "" ) );
+ time_str2num( ReadingsVal( $name, "lastDeparture", "" ) );
}
# sleep timer
@@ -909,8 +942,7 @@ sub GUEST_DurationTimer($;$) {
{
$durSleep =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastSleep", "" ) );
+ time_str2num( ReadingsVal( $name, "lastSleep", "" ) );
}
my $durPresence_hr =
@@ -1205,7 +1237,9 @@ sub GUEST_StartInternalTimers($$) {
state home,gotosleep,asleep,awoken,absent,none switch between states; see attribute rg_states to adjust list shown in FHEMWEB
- create wakeuptimer add several pre-configurations provided by RESIDENTS Toolkit. See separate section in RESIDENTS module commandref for details.
+ create
+ locationMap add a pre-configured weblink device using showing a Google Map if readings locationLat+locationLong are present.
+ wakeuptimer add several pre-configurations provided by RESIDENTS Toolkit. See separate section in RESIDENTS module commandref for details.
@@ -1505,7 +1539,9 @@ sub GUEST_StartInternalTimers($$) {
state home,gotosleep,asleep,awoken,absent,gone wechselt den Status; siehe auch Attribut rg_states, um die in FHEMWEB angezeigte Liste anzupassen
-
- create wakeuptimer fügt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der RESIDENTS Modul Kommandoreferenz.
+ create
+
- locationMap fügt ein vorkonfiguriertes weblink Device hinzu, welches eine Google Map anzeigt, sofern die Readings locationLat+locationLong vorhanden sind.
+ - wakeuptimer fügt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der RESIDENTS Modul Kommandoreferenz.
diff --git a/fhem/FHEM/20_ROOMMATE.pm b/fhem/FHEM/20_ROOMMATE.pm
index c4465dc91..5d7efe3bf 100644
--- a/fhem/FHEM/20_ROOMMATE.pm
+++ b/fhem/FHEM/20_ROOMMATE.pm
@@ -327,8 +327,9 @@ sub ROOMMATE_Set($@) {
$usage .= " location$locations";
if ($adminMode) {
$usage .= " create:wakeuptimer";
-
- # $usage .= " compactMode:noArg largeMode:noArg";
+ $usage .= ",locationMap"
+ if ( ReadingsVal( $name, "locationLat", "-" ) ne "-"
+ && ReadingsVal( $name, "locationLong", "-" ) ne "-" );
}
# silentSet
@@ -729,8 +730,12 @@ sub ROOMMATE_Set($@) {
}
# create
- elsif ( $a[1] eq "create" ) {
- if ( defined( $a[2] ) && $a[2] eq "wakeuptimer" ) {
+ elsif ( lc( $a[1] ) eq "create" ) {
+ if ( !defined( $a[2] ) ) {
+ return
+ "Invalid 2nd argument, choose one of wakeuptimer locationMap ";
+ }
+ elsif ( lc( $a[2] ) eq "wakeuptimer" ) {
my $i = "1";
my $wakeuptimerName = $name . "_wakeuptimer" . $i;
my $created = 0;
@@ -786,8 +791,38 @@ sub ROOMMATE_Set($@) {
return
"Dummy $wakeuptimerName and other pending devices created and pre-configured.\nYou may edit Macro_$wakeuptimerName to define your wake-up actions\nand at_$wakeuptimerName for optional at-device adjustments.";
}
- else {
- return "Invalid 2nd argument, choose one of wakeuptimer ";
+ elsif ( lc( $a[2] ) eq "locationmap" ) {
+ my $locationmapName = $name . "_map";
+
+ if ( defined( $defs{$locationmapName} ) ) {
+ return
+"Device $locationmapName existing already, delete it first to have it re-created.";
+ }
+ else {
+ my $sortby = AttrVal( $name, "sortby", -1 );
+ $sortby++;
+
+ # create new weblink device
+ fhem "define $locationmapName weblink htmlCode {
+'
+
+
'
+}";
+ fhem "attr $locationmapName alias Current Location";
+ fhem
+"attr $locationmapName comment Auto-created by ROOMMATE module";
+ fhem "attr $locationmapName group " . $attr{$name}{group}
+ if ( defined( $attr{$name}{group} ) );
+ fhem "attr $locationmapName room " . $attr{$name}{room}
+ if ( defined( $attr{$name}{room} ) );
+ }
+
+ return "Weblink device $locationmapName was created.";
}
}
@@ -870,8 +905,7 @@ sub ROOMMATE_DurationTimer($;$) {
{
$durPresence =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastArrival", "" ) );
+ time_str2num( ReadingsVal( $name, "lastArrival", "" ) );
}
# absence timer
@@ -880,8 +914,7 @@ sub ROOMMATE_DurationTimer($;$) {
{
$durAbsence =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastDeparture", "" ) );
+ time_str2num( ReadingsVal( $name, "lastDeparture", "" ) );
}
# sleep timer
@@ -890,8 +923,7 @@ sub ROOMMATE_DurationTimer($;$) {
{
$durSleep =
$timestampNow -
- time_str2num(
- ReadingsVal( $name, "lastSleep", "" ) );
+ time_str2num( ReadingsVal( $name, "lastSleep", "" ) );
}
my $durPresence_hr =
@@ -1193,7 +1225,9 @@ sub ROOMMATE_StartInternalTimers($$) {
state home,gotosleep,asleep,awoken,absent,gone switch between states; see attribute rr_states to adjust list shown in FHEMWEB
-
- create wakeuptimer add several pre-configurations provided by RESIDENTS Toolkit. See separate section in RESIDENTS module commandref for details.
+ create
+
- locationMap add a pre-configured weblink device using showing a Google Map if readings locationLat+locationLong are present.
+ - wakeuptimer add several pre-configurations provided by RESIDENTS Toolkit. See separate section in RESIDENTS module commandref for details.
@@ -1493,7 +1527,9 @@ sub ROOMMATE_StartInternalTimers($$) {
state home,gotosleep,asleep,awoken,absent,gone wechselt den Status; siehe auch Attribut rr_states, um die in FHEMWEB angezeigte Liste anzupassen
-
- create wakeuptimer fügt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der RESIDENTS Modul Kommandoreferenz.
+ create
+
- locationMap fügt ein vorkonfiguriertes weblink Device hinzu, welches eine Google Map anzeigt, sofern die Readings locationLat+locationLong vorhanden sind.
+ - wakeuptimer fügt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der RESIDENTS Modul Kommandoreferenz.