Add sorting by last_triggered

This commit is contained in:
thomas committed 2020-01-07 20:54:13 +01:00
1 parent 4398cb44b1
commit 0a15d4e68e
3 files changed
+13 -4

No files matched your search

+9
View File
@@ -78,6 +78,15 @@ export function entity_sorter(hass, method) {
new Date(entityB.last_changed).getTime(),
new Date(entityA.last_changed).getTime()
);
case "last_triggered":
if(entityA.attributes.last_triggered == null
|| entityB.attributes.last_triggered == null)
return 0;
method.numeric=true;
return compare(
new Date(entityB.attributes.last_triggered).getTime(),
new Date(entityA.attributes.last_triggered).getTime()
);
default:
return 0;
}