diff --git a/fhem/CHANGED b/fhem/CHANGED index 93aff4e31..a7bdac31f 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,7 @@ # 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. - - feature: 6.0 released + - feature: 98_weekprofile: new command get associations + - feature: 6.0 released - 2020-01-26 (6.0) - new: MSwitch_Wizard: preparation for Mswitch V3.0 diff --git a/fhem/FHEM/98_weekprofile.pm b/fhem/FHEM/98_weekprofile.pm index 49af2edc6..7f8e46830 100644 --- a/fhem/FHEM/98_weekprofile.pm +++ b/fhem/FHEM/98_weekprofile.pm @@ -814,6 +814,50 @@ sub weekprofile_Get($$@) } return $names; } + + #----------------------------------------------------------------------------- + $list .= ' associations:0,1' if ($useTopics); + if($cmd eq "associations") { + my $retType = 1; + $retType = $params[0] if(@params >= 1); + my @not_asso = (); + my @json_arr = (); + my $retHTML = "
Device | Profile | "; + $retHTML .= ""; + foreach my $dev (@{$hash->{SNDDEVLIST}}) { + my $entry = {}; + $entry->{DEVICE}->{NAME} = $dev->{NAME}; + $entry->{PROFILE}->{NAME} = ""; + my $prfName = AttrVal($dev->{NAME},"weekprofile",undef); + if (!defined($prfName)) { + push @not_asso, $dev->{NAME}; + push @json_arr , $entry; + next; + } + my ($prf,$idx) = weekprofile_findPRF($hash, $prfName, undef, 0); + my $color = defined($prf) ? "" : "color:red" ; + + $entry->{PROFILE}->{NAME} = $prfName; + $entry->{PROFILE}->{EXISTS} = defined($prf) + 0; + push @json_arr , $entry; + $retHTML .= " |
---|---|
$dev->{NAME} | $prfName |
Not associated devices | |
$devname |