mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
88_Timer: fix2 list "Probably associated with" Forum: #1015549
git-svn-id: https://svn.fhem.de/fhem/trunk@21098 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bbc69959d0
commit
6094e83d14
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 88_Timer: fix2 list "Probably associated with" Forum: #1015549
|
||||||
- new: 70_DENON_AVR: initial commit.
|
- new: 70_DENON_AVR: initial commit.
|
||||||
- bugfix: 93_DbLog: fix warning, Forum: #107950
|
- bugfix: 93_DbLog: fix warning, Forum: #107950
|
||||||
- feature: 98_weekprofile: new command import_profile
|
- feature: 98_weekprofile: new command import_profile
|
||||||
|
@ -267,7 +267,8 @@ sub Timer_Set($$$@) {
|
|||||||
|
|
||||||
my $deleteTimer = "Timer_$cmd2"."_set:textField-long";
|
my $deleteTimer = "Timer_$cmd2"."_set:textField-long";
|
||||||
Timer_delFromUserattr($hash,$deleteTimer);
|
Timer_delFromUserattr($hash,$deleteTimer);
|
||||||
addStructChange("modify", $name, "attr $name userattr Timer_$cmd2"); # note with question mark
|
Timer_PawList($hash); # list, Probably associated with
|
||||||
|
addStructChange("modify", $name, "attr $name userattr Timer_$cmd2"); # note with question mark
|
||||||
}
|
}
|
||||||
|
|
||||||
return $setList if ( $a[0] eq "?");
|
return $setList if ( $a[0] eq "?");
|
||||||
@ -378,6 +379,8 @@ sub Timer_Get($$$@) {
|
|||||||
CommandAttr($hash,"$name $attr_values_names[$i] $attr_values[$i]");
|
CommandAttr($hash,"$name $attr_values_names[$i] $attr_values[$i]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer_PawList($hash); # list, Probably associated with
|
||||||
|
|
||||||
readingsSingleUpdate($hash, "state" , "Timers loaded", 1);
|
readingsSingleUpdate($hash, "state" , "Timers loaded", 1);
|
||||||
FW_directNotify("FILTER=(room=)?$name", "#FHEMWEB:WEB", "location.reload('true')", "");
|
FW_directNotify("FILTER=(room=)?$name", "#FHEMWEB:WEB", "location.reload('true')", "");
|
||||||
Timer_Check($hash);
|
Timer_Check($hash);
|
||||||
@ -408,6 +411,7 @@ sub Timer_Attr() {
|
|||||||
|
|
||||||
if ($attrName =~ /^Timer_\d{2}_set$/) {
|
if ($attrName =~ /^Timer_\d{2}_set$/) {
|
||||||
my $err = perlSyntaxCheck($attrValue, ()); # check PERL Code
|
my $err = perlSyntaxCheck($attrValue, ()); # check PERL Code
|
||||||
|
InternalTimer(gettimeofday()+0.1, "Timer_PawList", $hash);
|
||||||
return $err if($err);
|
return $err if($err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,6 +429,11 @@ sub Timer_Attr() {
|
|||||||
$cnt_attr_userattr = 0;
|
$cnt_attr_userattr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($attrName =~ /^Timer_\d{2}_set$/) {
|
||||||
|
Log3 $name, 3, "$name: Attr | Attributes $attrName deleted";
|
||||||
|
InternalTimer(gettimeofday()+0.1, "Timer_PawList", $hash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,26 +813,7 @@ sub FW_pushed_savebutton {
|
|||||||
readingsBulkUpdate($hash, "state" , $state, 1);
|
readingsBulkUpdate($hash, "state" , $state, 1);
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
## Probably associated with - added to list ##
|
Timer_PawList($hash); # list, Probably associated with
|
||||||
### check must work after changed setreadings to new value ###
|
|
||||||
## all device must check, for right value in .associatedWith
|
|
||||||
my $associatedWith = ReadingsVal($name, ".associatedWith", "");
|
|
||||||
|
|
||||||
foreach my $d (sort keys %{$hash->{READINGS}}) {
|
|
||||||
if ($d =~ /^Timer_(\d+)$/) {
|
|
||||||
my @values = split("," , ReadingsVal($name, $d, ""));
|
|
||||||
if ($values[7] ne "DEF") {
|
|
||||||
#Log3 $name, 5, "$name: FW_pushed_savebutton | Reading .associatedWith check: ".$values[6]." with ".$values[7];
|
|
||||||
if (not grep /$values[6]/, $associatedWith) {
|
|
||||||
#Log3 $name, 5, "$name: FW_pushed_savebutton | Reading .associatedWith added ".$values[6];
|
|
||||||
$associatedWith = $associatedWith eq "" ? $values[6] : $associatedWith.",".$values[6];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Log3 $name, 5, "$name: FW_pushed_savebutton | Reading .associatedWith is: ".$associatedWith;
|
|
||||||
CommandSetReading(undef, "$name .associatedWith $associatedWith");
|
|
||||||
## current list "Probably associated with" finish ##
|
|
||||||
|
|
||||||
## popup user message (jump to javascript) ##
|
## popup user message (jump to javascript) ##
|
||||||
if ($popup != 0) {
|
if ($popup != 0) {
|
||||||
@ -971,6 +961,51 @@ sub Timer_Check($) {
|
|||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### list, Probably associated with ###
|
||||||
|
sub Timer_PawList($) {
|
||||||
|
my ($hash) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
my $associatedWith = "";
|
||||||
|
|
||||||
|
Log3 $name, 5, "$name: Timer_PawList is running";
|
||||||
|
|
||||||
|
foreach my $d (keys %{$hash->{READINGS}}) {
|
||||||
|
if ($d =~ /^Timer_(\d+)$/) {
|
||||||
|
my @values = split("," , ReadingsVal($name, $d, ""));
|
||||||
|
### clear value, "Probably associated with" ne DEF
|
||||||
|
if ($values[7] ne "DEF") {
|
||||||
|
if (not grep /$values[6]/, $associatedWith) {
|
||||||
|
$associatedWith = $associatedWith eq "" ? $values[6] : $associatedWith.",".$values[6];
|
||||||
|
}
|
||||||
|
### Self-administration test, "Probably associated with" for DEF
|
||||||
|
} elsif ($values[7] eq "DEF") {
|
||||||
|
my $Timer_set_attr = AttrVal($name, $d."_set", "");
|
||||||
|
if ($Timer_set_attr ne "") {
|
||||||
|
Log3 $name, 5, "$name: Timer_PawList | look at DEF: ".$Timer_set_attr;
|
||||||
|
$Timer_set_attr =~ /(get|set)\s(\w+)\s/;
|
||||||
|
if ($2) {
|
||||||
|
Log3 $name, 5, "$name: Timer_PawList | found in DEF: ".$2;
|
||||||
|
if (not grep /$2/, $associatedWith) {
|
||||||
|
$associatedWith = $associatedWith eq "" ? $2 : $associatedWith.",".$2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### END ###
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3 $name, 5, "$name: Timer_PawList | Reading .associatedWith is: ".$associatedWith;
|
||||||
|
if ($associatedWith ne "") {
|
||||||
|
CommandSetReading(undef, "$name .associatedWith $associatedWith");
|
||||||
|
} else {
|
||||||
|
readingsDelete($hash,".associatedWith") if(ReadingsVal($name, ".associatedWith", undef));
|
||||||
|
}
|
||||||
|
## current list "Probably associated with" finish ##
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
|
||||||
# Eval-Rückgabewert für erfolgreiches
|
# Eval-Rückgabewert für erfolgreiches
|
||||||
# Laden des Moduls
|
# Laden des Moduls
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user