Hi all,
I’m using OH 3.1
I’ve tried to create a JS that react on cron as well as on an event change. As shown below.
The problem is now that once a Change is happening on an event level this even is always reported.
(Even if I run the rule manually in the UI.
My script looks like this to detect if it was running on Cron.
if (typeof event !== 'undefined') {
logger.info("event: \t" + event);
logger.info("event.itemName: \t" + event.itemName);
logger.info("event.thingUID: \t" + event.thingUID);
logger.info("event.statusInfo: \t" + event.statusInfo);
// It is triggered by an item Event
myaction = event.itemName;
}
if (typeof event === 'undefined') {
// It is triggered by cron (or Script)
myaction = "OfflineUpdate"
}
But once a event happened then “myaction” is the event.itemName.
Any ideas why and how I can find out if the cron rule was triggered?
Thanks
/Franz