an integer 1..3, indication which of the remoteFHEM functions to be called
+ The Babble device name may contain a *-character. If this is the case, it will be considered a regular expression, with the star replaced by (.*).
+ When using Babble with a natural language sentence whose device part matches this regular expression, the character group addressed by the star sequence is placed in the variable
+ $STAR, and used to replace this value in the command sequence.
attr <name> helpFunc <function name&rt; name of a help function which is used in case no command is found for a certain device. When this function is called, the strings $DEV, $HELP, $PARM[0|1|2...]
will be replaced by the devicename identified by Babble, the help text for this device and parameters passed to the Babble_DoIt function
attr <name> testParm(0|1|2|3) <string&rt; if a command is not really excuted, but only tested, the values of these attributes will be used to substitute the strings $PARM[0|1|2...]
- in the tested command
+ in the tested command
attr <name> noChatBot 0|1 if this attribute is set to 1, a local RiveScript interpreter will be ignored even though it is present in the system
attr <name> babbleSubs :,:, ...
+ space separated list of regular expressions and their replacements - this will be used on the initial sentence submitted to Babble
+ (Note: a space in the regexp must be replaced by \s).
attr <name> babbleNoPlaces ...
diff --git a/fhem/FHEM/95_PostMe.pm b/fhem/FHEM/95_PostMe.pm
index e6fdd74e5..e8f77b989 100644
--- a/fhem/FHEM/95_PostMe.pm
+++ b/fhem/FHEM/95_PostMe.pm
@@ -185,10 +185,10 @@ sub PostMe_Check($$) {
for( $loop=1;$loop<=$cnop;$loop++){
$res = ReadingsVal($devname, sprintf("postme%02dName",$loop), undef);
last
- if($res eq $listname);
+ if(lc($res) eq lc($listname));
}
#-- no PostMe with this name
- if( $res ne $listname ){
+ if( lc($res) ne lc($listname) ){
return undef;
}else{
return $loop;
diff --git a/fhem/FHEM/95_YAAHM.pm b/fhem/FHEM/95_YAAHM.pm
index edde8a691..e627852c2 100644
--- a/fhem/FHEM/95_YAAHM.pm
+++ b/fhem/FHEM/95_YAAHM.pm
@@ -47,7 +47,7 @@ my $yaahmname;
my $yaahmlinkname = "Profile"; # link text
my $yaahmhiddenroom = "ProfileRoom"; # hidden room
my $yaahmpublicroom = "Unsorted"; # public room
-my $yaahmversion = "1.47";
+my $yaahmversion = "1.48";
my $firstcall = 1;
my %yaahm_transtable_EN = (
@@ -731,6 +731,10 @@ sub YAAHM_Set($@) {
}elsif ( $cmd =~ /^checkstate.*/ ) {
YAAHM_InternalTimer("check",time()+ $args[0], "YAAHM_checkstate", $hash, 0);
+ #-----------------------------------------------------------
+ }elsif ( $cmd =~ /^correctstate.*/ ) {
+ YAAHM_correctstate($hash);
+
#-----------------------------------------------------------
}elsif ( $cmd =~ /^time.*/ ) {
return YAAHM_time($name,$args[0],$exec);
@@ -839,7 +843,7 @@ sub YAAHM_Set($@) {
my $str = "";
return "[YAAHM] Unknown argument " . $cmd . ", choose one of".
" manualnext time:".join(',',@times)." mode:".join(',',@modes).
- " state:".join(',',@states)." locked:noArg unlocked:noArg save:noArg checkstate:0,5,10 restore:noArg initialize:noArg createWeekly deleteWeekly";
+ " state:".join(',',@states)." locked:noArg unlocked:noArg save:noArg correctstate:noArg checkstate:0,5,10 restore:noArg initialize:noArg createWeekly deleteWeekly";
}
}
@@ -1091,6 +1095,8 @@ sub YAAHM_setParm($@) {
#
# Parameter name = name of the YAAHM device
#
+# Careful: $exec=0 is needed in case we want to prevent execution of helper here
+#
#########################################################################################
sub YAAHM_time {
@@ -1178,7 +1184,7 @@ sub YAAHM_time {
#-- helper function not executed, e.g. by call from external timer
return
- if( !defined($exec) );
+ if( !defined($exec) || $exec==0);
#-- execute the helper function
my $xval;
@@ -1205,6 +1211,7 @@ sub YAAHM_time {
$msg .= "Simulation ".$xval;
}
if( $exec==1 ){
+ Log3 $name,1,"[YAAHM_time] ecxecuting $xval";
fhem($xval);
}elsif( $exec==0 ){
Log3 $name,1,"[YAAHM_time] ".$msg;
@@ -1460,6 +1467,65 @@ sub YAAHM_checkstate($) {
return undef
}
+#########################################################################################
+#
+# YAAHM_correctstate - correct state devices
+#
+# Parameter someHash = either internal hash of timer
+# => need to dereference it for getting device hash
+# or device hash
+#
+#########################################################################################
+
+sub YAAHM_correctstate($) {
+ my ($someHash) = @_;
+
+ my $hash;
+ if( defined($someHash->{HASH}) ){
+ $hash = $someHash->{HASH};
+ }else{
+ $hash = $someHash;
+ }
+ my $name = $hash->{NAME};
+
+ Log3 $name, 1,"[YAAHM_correctstate] on device ".$hash->{NAME}." called";
+
+ my $istate;
+ my $cstate = defined($hash->{DATA}{"HSM"}{"state"}) ? $hash->{DATA}{"HSM"}{"state"} : "";
+
+ return undef
+ if( !defined($attr{$name}{"stateDevices"}) );
+
+ for($istate=0;$istate{DATA}{"DT"}{$key}[2]) && $hash->{DATA}{"DT"}{$key}[2] ne "";
- my $xval = "{YAAHM_time('".$name."','".$key."')},".$hash->{DATA}{"DT"}{$key}[2];
+ #-- uh oh, double execution of functions !!! Do this in YAAHM_time, NOT in timer
+ #my $xval = "{YAAHM_time('".$name."','".$key."')},".$hash->{DATA}{"DT"}{$key}[2];
+ my $xval = "{YAAHM_time('".$name."','".$key."',1)}";
#-- entries in the default table with no entry are single-timers
if( !$f1 and !$f2 ){
@@ -1651,12 +1719,12 @@ sub YAAHM_startWeeklyTimer($) {
$res .= "\nand ([" .$name. ":housemode] =~ \"".$v4a."\")";
$res .= "\nand ([" .$name. ":todayType] =~ \"".$v4b."\")";
- #-- action
+ #-- action - explicitly in timer, not in YAAHM_time
my $xval = "";
if( $i==0 ){
- $xval = "{YAAHM_time('".$name."','wakeup')},".$hash->{DATA}{"WT"}[$i]{"action"};
+ $xval = "{YAAHM_time('".$name."','wakeup',0)},".$hash->{DATA}{"WT"}[$i]{"action"};
}elsif( $i==1 ){
- $xval = "{YAAHM_time('".$name."','sleep')},".$hash->{DATA}{"WT"}[$i]{"action"};
+ $xval = "{YAAHM_time('".$name."','sleep',0)},".$hash->{DATA}{"WT"}[$i]{"action"};
}else{
$xval = $hash->{DATA}{"WT"}[$i]{"action"};
}
@@ -3664,6 +3732,15 @@ sub YAAHM_Longtable($){
The actual changes to certain devices are made by an external stateHelper function. If these external devices are in their proper state
for a particular house (security) state can be checked automatically, see the attribute stateDevices
+
+ set <name> checkstate 0|5|10
+
+ Check the house (security) state for each of the devices defined in the stateDevices attribute in 0, 5 or 10 seconds from now
+
+ set <name> correctstate
+
+ Try to correct the house (security) state, by issueing a FHEM command set <device> <targetstate>
+ for each of the devices defined in the stateDevices attribute and not in the proper state for the given house (security) state
set <name> createWeekly <string>
diff --git a/fhem/contrib/Babble/general.rive b/fhem/contrib/Babble/general.rive
index 5921078cf..f0b7ddb4e 100644
--- a/fhem/contrib/Babble/general.rive
+++ b/fhem/contrib/Babble/general.rive
@@ -1,6 +1,6 @@
//########################################################################################
// general.rive
-// Version 0.1
+// Version 0.2
// See 95_Babble.pm for licensing
//########################################################################################
//# Prof. Dr. Peter A. Henning
@@ -39,6 +39,15 @@
+ wie kannst du * (steuern|schalten)
- devhelp
++ wie kannst du (den|das|die) * (steuern|schalten)
+- devhelp
+
++ was kannst du (mit|bei) * (machen|steuern|schalten)
+- devhelp
+
++ was kannst du (mit|bei) (dem|der|den) * (machen|steuern|schalten)
+- devhelp
+
+ was ist *
- devhelp