CALDAV - Change UNDEF to No Events Scheduled

Hello -

I am using the CALDAV binding to populate a HABPanel dashboard with various events. I have multiple calendars with recycling pickups, school schedules, etc reporting on the dashboard. During periods of inactivity (like the summer school break) calendars will show UNDEF when no events are pulled from the calendar. Can I use a simple MAP transformation to change the UNDEF to “No Events Scheduled” without impacting the regular display of information? Or do I need to use something else?

Thanks,

Squid :squid:

Maybe a JS transform, because MAP offers no “pass anything else unaltered” option.

Untested -

// function to translate UNDEF only
// variable "input" contains data passed by OpenHAB
(function(input) {
    var out = input ;      // allow everything to pass through
    if (input == 'UNDEF') {
        out = 'No Events Scheduled' ;
    } else if (input == 'NULL') {
        out = 'No calendar data yet' ;
    }
    return out ;      // return a string
})(input)