diff --git a/fhem/FHEM/57_CALVIEW.pm b/fhem/FHEM/57_CALVIEW.pm
index 79fcd248c..71b1dea63 100644
--- a/fhem/FHEM/57_CALVIEW.pm
+++ b/fhem/FHEM/57_CALVIEW.pm
@@ -23,10 +23,13 @@ sub CALVIEW_Initialize($)
"disable:0,1 " .
"do_not_notify:1,0 " .
"filterSummary:textField-long " .
+ "fulldaytext " .
"isbirthday:1,0 " .
"maxreadings " .
"modes:next ".
"oldStyledReadings:1,0 " .
+ "sourcecolor:textField-long " .
+ "timeshort:1,0 " .
"yobfield:_location,_description,_summary " .
$readingFnAttributes;
}
@@ -146,7 +149,8 @@ sub CALVIEW_GetUpdate($){
etime => $tempend[1],
edatetimeiso => $isoendtime,
btimestamp => $bts[0],
- mode => $item->[6]};
+ mode => $item->[6],
+ wday => $wday};
}
my $todaycounter = 1;
my $tomorrowcounter = 1;
@@ -155,6 +159,8 @@ sub CALVIEW_GetUpdate($){
my $yobfield = AttrVal($name,"yobfield","_description");
my $filterSummary = AttrVal($name,"filterSummary",".*:.*");
my @arrFilters = split(',' , $filterSummary );
+ my $sourceColor = AttrVal($name,"sourcecolor","");
+ my @arrSourceColors = split(',' , $sourceColor );
# sort the array by btimestamp
my @sdata = map $_->[0],
@@ -165,7 +171,9 @@ sub CALVIEW_GetUpdate($){
my $age = 0;
my @termyear;
my $validterm = 0;
+
for my $termin (@sdata){
+ my $termcolor="white";
#if($termin->{summary} =~ /$filterSummary/ ){
foreach my $filter (@arrFilters){
my @arrFilter= split(':' , $filter);
@@ -173,6 +181,12 @@ sub CALVIEW_GetUpdate($){
my $summaryFilter = $arrFilter[1];
if( $termin->{source} =~ /$sourceFilter/i && $termin->{summary} =~ /$summaryFilter/i ){ $validterm =1;}
};
+ foreach my $color (@arrSourceColors){
+ my @arrSourceColor = split(':' , $color);
+ my $sourceName = $arrSourceColor[0];
+ my $sourceColor = $arrSourceColor[1];
+ if( $termin->{source} =~ /$sourceName/i ){ $termcolor = $sourceColor;}
+ };
if ($validterm ==1){
#alter berechnen wenn attribut gesetzt ist. alter wird aus "jahr des termins" - "geburtsjahr aus location oder description" errechnet
if($isbday == 1 ){
@@ -182,7 +196,18 @@ sub CALVIEW_GetUpdate($){
elsif($yobfield eq "_summary" && defined($termin->{summary}) && length($termin->{summary}) > 0 && $termin->{summary} =~ /(\d{4})/ ) { my ($byear) = $termin->{summary} =~ /(\d{4})/ ; $age = $termyear[2] - $byear;}
else {$age = " "}
}
-
+ my $timeshort = "";
+ my $nD = $D + 1;
+ if( $eD eq $nD && $termin->{btime} eq $termin->{etime} ){ $timeshort = AttrVal($name,"fulldaytext","ganztägig"); }
+ else {
+ if(AttrVal($name,"timeshort","0") eq 0) {$timeshort = $termin->{btime}." - ".$termin->{etime}; }
+ elsif(AttrVal($name,"timeshort","0") eq 1) {
+ my $tmps = substr $termin->{btime},0,5 ;
+ my $tmpe = substr $termin->{etime},0,5 ;
+ $timeshort = $tmps." - ".$tmpe ;
+ }
+ }
+
#standard reading t_[3steliger counter] anlegen
if($isbday == 1 ){ readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_age", $age);}
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_bdate", $termin->{bdate});
@@ -192,11 +217,14 @@ sub CALVIEW_GetUpdate($){
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_daysleftLong", $termin->{daysleftLong});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_summary", $termin->{summary});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_source", $termin->{source});
+ readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_sourcecolor", $termcolor);
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_location", $termin->{location});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_description", $termin->{description});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_edate", $termin->{edate});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_etime", $termin->{etime});
readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_mode", $termin->{mode});
+ readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_timeshort", $timeshort );
+ readingsBulkUpdate($hash, "t_".sprintf ('%03d', $counter)."_weekday", $termin->{wday} );
#wenn termin heute today readings anlegen
if ($date eq $termin->{bdate} ){
if($isbday == 1 ){ readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_age", $age);}
@@ -207,11 +235,13 @@ sub CALVIEW_GetUpdate($){
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $counter)."_daysleftLong", $termin->{daysleftLong});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_summary", $termin->{summary});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_source", $termin->{source});
+ readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_sourcecolor", $termcolor);
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_location", $termin->{location});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_description", $termin->{description});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_edate", $termin->{edate});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_etime", $termin->{etime});
readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_mode", $termin->{mode});
+ readingsBulkUpdate($hash, "today_".sprintf ('%03d', $todaycounter)."_timeshort", $timeshort );
$todaycounter ++;
}
#wenn termin morgen tomorrow readings anlegen
@@ -224,11 +254,13 @@ sub CALVIEW_GetUpdate($){
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_daysleftLong", $termin->{daysleftLong});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_summary", $termin->{summary});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_source", $termin->{source});
+ readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_sourcecolor", $termcolor);
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_location", $termin->{location});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_description", $termin->{description});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_edate", $termin->{edate});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_etime", $termin->{etime});
readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_mode", $termin->{mode});
+ readingsBulkUpdate($hash, "tomorrow_".sprintf ('%03d', $tomorrowcounter)."_timeshort", $timeshort );
$tomorrowcounter++;
}
last if ($counter++ == $max);
@@ -358,6 +390,9 @@ sub CALVIEW_Notify($$)
e.g.: filterSummary Kalender_Abfall:Leichtverpackungen,Kalender_Abfall:Bioabfall
filterSummary Kalender_Abfall:Leichtverpackungen,Kalender_Feiertage:.*,Kalender_Christian:.*,Kalender_Geburtstage:.*
+