2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

95_YAAHM.pm: Neue Version mit Fix für save

95_Babble.pm: Neue Version mit Fix für save

git-svn-id: https://svn.fhem.de/fhem/trunk@16371 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
phenning 2018-03-10 09:28:10 +00:00
parent 9f32b100a7
commit c68982e31b
2 changed files with 10 additions and 12 deletions

View File

@ -53,7 +53,7 @@ if (eval {require RiveScript;1;} ne 1) {
my $babblelinkname = "babbles"; # link text
my $babblehiddenroom = "babbleRoom"; # hidden room
my $babblepublicroom = "babble"; # public room
my $babbleversion = "1.31";
my $babbleversion = "1.32";
my %babble_transtable_EN = (
"ok" => "OK",
@ -439,12 +439,11 @@ sub Babble_Get($@) {
sub Babble_save($) {
my ($hash) = @_;
my $date = localtime(time);
my $date = TimeNow();
my $name = $hash->{NAME};
$hash->{DATA}{"savedate"} = $date;
readingsSingleUpdate( $hash, "savedate", $hash->{DATA}{"savedate"}, 1 );
my $json = JSON->new->utf8;
my $jhash0 = eval{ $json->encode( $hash->{DATA} ) };
readingsSingleUpdate( $hash, "savedate", $date, 1 );
my $jhash0 = toJSON($hash->{DATA});
if( ReadingsVal($name,"lockstate","locked") ne "locked" ){
my $error = FileWrite("babbleFILE",$jhash0);
#Log3 $name, 1, " ".Dumper($jhash0);
@ -1702,7 +1701,7 @@ sub Babble_getplaces($$$) {
@{$hash->{DATA}{"places"}} = @places;
$hash->{DATA}{"re_places"} = lc("((".join(")|(",@places)."))");
Babble_save($hash);
#Babble_save($hash);
return;
#-- just do something with the current list
}elsif( $type eq "html" ){
@ -1845,7 +1844,7 @@ sub Babble_getwords($$$$) {
$hash->{DATA}{"re_writes"} = lc("((".join(")|(",@words)."))");
}
delete($hash->{DATA}{"pronouns"});
Babble_save($hash);
#Babble_save($hash);
return;
#-- just do something with the current list

View File

@ -47,7 +47,7 @@ my $yaahmname;
my $yaahmlinkname = "Profile"; # link text
my $yaahmhiddenroom = "ProfileRoom"; # hidden room
my $yaahmpublicroom = "Unsorted"; # public room
my $yaahmversion = "1.49";
my $yaahmversion = "1.50";
my $firstcall = 1;
my %yaahm_transtable_EN = (
@ -953,11 +953,10 @@ sub YAAHM_Get($@) {
sub YAAHM_save($) {
my ($hash) = @_;
my $date = localtime(time);
my $date = TimeNow();
$hash->{DATA}{"savedate"} = $date;
readingsSingleUpdate( $hash, "savedate", $hash->{DATA}{"savedate"}, 1 );
my $json = JSON->new->utf8;
my $jhash0 = eval{ $json->encode( $hash->{DATA} ) };
readingsSingleUpdate( $hash, "savedate", $date, 1 );
my $jhash0 = toJSON($hash->{DATA});
my $error = FileWrite("YAAHMFILE",$jhash0);
#Log 1,"[YAAHM_save] error=$error";
return;