Hello everyone,
I just tried to mess around with durations in a Main UI widget but realized that dayjs.duration does not seem to be supported, is that correct?
I’m trying to create a widget that shows me all devices that haven’t sent a message within a certain time interval. This time interval is received from a custom metadata as an ISO8601 duration string. What I try to do (I do it successfully in a rule already) is get the items state (a timestamp) and check whether this timestamp is after now - this duration.
In the rule the following works fine. Is there a more or less easy way to get this also to work in a Main UI widget? Thanks for any ideas!
var filteredTagged = items.lastmessages.descendents
.filter( i => i.getMetadata("messageInterval") != null && time.toZDT("-" + i.getMetadata("messageInterval").value).isAfterDateTime(i.state));