diff --git a/fhem/CHANGED b/fhem/CHANGED
index 6eb0c2663..fe86109ed 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# 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.
+ - change: 98_todoist: removed Attribute "sortTasks" / better commandref
- change: 93_DbLog: change datetime pattern in valueFn of addCacheLine
Forum: #107285
- change: 98_todoist: reorder tasks - widget reorder
diff --git a/fhem/FHEM/98_todoist.pm b/fhem/FHEM/98_todoist.pm
index a6d88f18e..990c69465 100644
--- a/fhem/FHEM/98_todoist.pm
+++ b/fhem/FHEM/98_todoist.pm
@@ -17,7 +17,7 @@ eval "use Date::Parse;1" or $missingModule .= "Date::Parse ";
#######################
# Global variables
-my $version = "1.3.0";
+my $version = "1.3.1";
my $srandUsed;
@@ -76,7 +76,6 @@ sub todoist_Initialize($) {
$hash->{AttrList} = "disable:1,0 ".
"pollInterval ".
"do_not_notify ".
- "sortTasks:1,0 ".
"getCompleted:1,0 ".
"showPriority:1,0 ".
"showAssignedBy:1,0 ".
@@ -937,7 +936,7 @@ sub todoist_GetTasksCallback($$$){
else {
my $decoded_json="";
- # checl for correct JSON
+ # check for correct JSON
if (eval{decode_json($data)}) {
$decoded_json = decode_json($data);
@@ -1134,11 +1133,7 @@ sub todoist_GetTasksCallback($$$){
readingsEndUpdate( $hash, 1 );
-
- ## sort Tasks alphabetically if set
- todoist_sort($hash) if (AttrVal($name,"sortTasks",0) == 1);
-
-
+
RemoveInternalTimer($hash,"todoist_GetTasks");
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "todoist_GetTasks", $hash, 0); ## loop with Interval
@@ -1466,73 +1461,6 @@ sub todoist_GetProjectsCallback($$$){
return "Got $i new projects: ".$return;
}
-# sort alphabetically (probably deprecated)
-sub todoist_sort($) {
- my ($hash) = @_;
-
- my $name=$hash->{NAME};
-
- my $lText="";
-
- my %list;
-
-
- ## get all Readings
- my $readings = $hash->{READINGS};
- ## prepare Hash for sorting
- foreach my $key (keys %{$readings}) {
- if ($key =~ m/^Task_\d\d\d$/) {
- my @temp = split("_",$key);
- my $tid = int($temp[1]);
- my $val = $readings->{$key}{VAL};
- my $id = $hash->{helper}{IDS}{'Task_'.$tid};
- $list{$tid} = {content => $val, ID => $id};
- }
- }
-
- CommandDeleteReading(undef, "$hash->{NAME} (T|t)ask_.*");
-
- readingsBeginUpdate($hash);
-
- delete($hash->{helper}{"IDS"});
-
- ## sort Tasks and write them back
- my $i = 0;
- foreach my $key (sort {lc($list{$a}->{content}) cmp lc($list{$b}->{content})} keys(%list)) {
- my $data = $list{$key};
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i),$data->{content});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_dueDate",$hash->{helper}{"DUE_DATE"}{$data->{ID}}) if ($hash->{helper}{"DUE_DATE"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_responsibleUid",$hash->{helper}{"RESPONSIBLE_UID"}{$data->{ID}}) if ($hash->{helper}{"RESPONSIBLE_UID"}{$data->{ID}} && AttrVal($name,"showResponsible",0)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_assignedByUid",$hash->{helper}{"ASSIGNEDBY_UID"}{$data->{ID}}) if ($hash->{helper}{"ASSIGNEDBY_UID"}{$data->{ID}} && AttrVal($name,"showAssignedBy",0)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_priority",$hash->{helper}{"PRIORITY"}{$data->{ID}}) if ($hash->{helper}{"PRIORITY"}{$data->{ID}} && AttrVal($name,"showPriority",0)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_recurrenceType",$hash->{helper}{"RECURRENCE_TYPE"}{$data->{ID}}) if ($hash->{helper}{"RECURRENCE_TYPE"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_completedAt",$hash->{helper}{"COMPLETED_AT"}{$data->{ID}}) if ($hash->{helper}{"COMPLETED_AT"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_completedById",$hash->{helper}{"COMPLETED_BY_ID"}{$data->{ID}}) if ($hash->{helper}{"COMPLETED_BY_ID"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_order",$hash->{helper}{"ORDER"}{$data->{ID}}) if ($hash->{helper}{"ORDER"}{$data->{ID}} && AttrVal($name,"showOrder",0)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_parentID",$hash->{helper}{"PARENT_ID"}{$data->{ID}}) if ($hash->{helper}{"PARENT_ID"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_sectionID",$hash->{helper}{"SECTION_ID"}{$data->{ID}}) if ($hash->{helper}{"SECTION_ID"}{$data->{ID}});
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_checked",$hash->{helper}{"CHECKED"}{$data->{ID}}) if ($hash->{helper}{"CHECKED"}{$data->{ID}} && AttrVal($name,"showChecked",1)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_isDeleted",$hash->{helper}{"ISDELETED"}{$data->{ID}}) if ($hash->{helper}{"ISDELETED"}{$data->{ID}} && AttrVal($name,"showDeleted",1)==1);
- readingsBulkUpdate($hash,"Task_".sprintf("%03s",$i)."_ID",$data->{ID}) if (AttrVal($name,"hideId",0)!=1);
-
- $hash->{helper}{"IDS"}{"Task_".$i} = $data->{ID};
- $hash->{helper}{"WID"}{$data->{ID}} = $i;
-
- if (!$hash->{helper}{"COMPLETED_AT"}{$data->{ID}}) {
- $lText.=", " if ($i != 0);
- $lText.=$data->{content};
- }
- $i++;
- }
-
- ## list Text for TTS, Text-Message...
- $lText="-" if ($lText eq "");
- readingsBulkUpdate($hash,"listText",$lText) if ($lText ne "");
-
- readingsEndUpdate( $hash, 1 );
- return undef;
-}
-
#################################################
# delete all Tasks from list
@@ -1751,7 +1679,7 @@ sub todoist_Attr($@) {
}
}
- if ( $attrName eq "sortTasks" || $attrName =~ /(show(Priority|AssignedBy|Responsible|Order|DetailWidget|Section|Parent)|getCompleted|hide(Id|ListIfEmpty)|autoGetUsers|avoidDuplicates|delDeletedLists)/) {
+ if ( $attrName =~ /(show(Priority|AssignedBy|Responsible|Order|DetailWidget|Section|Parent)|getCompleted|hide(Id|ListIfEmpty)|autoGetUsers|avoidDuplicates|delDeletedLists)/) {
if ( $cmd eq "set" ) {
return "$name: $attrName has to be 0 or 1" if ($attrVal !~ /^(0|1)$/);
Log3 $name, 4, "todoist ($name): set attribut $attrName to $attrVal";
@@ -2406,7 +2334,7 @@ sub todoist_genUUID() {
set <DEVICE> updateTask 1 dueDate=übermorgen
set <DEVICE> updateTask TITLE:Brot dueDate=übermorgen
set <DEVICE> reorderTasks 12345678,23456789,34567890Milch -dueDate=morgen
+ Milch dueDate=morgen