Trigger on channel event
ds82 opened this issue · 3 comments
ds82 commented
Is it possible to create a trigger that set off on a channel event?
I tried to add a helper function to generates a channel trigger, but something seems wrong:
function channelTrigger(channel, event, triggerName) {
return new Trigger(triggerName || uuid.randomUUID(), "core.ChannelEventTrigger", new Configuration({
"eventSource": channel,
"eventTopic":"smarthome/channels/" + event + "/triggered",
"eventTypes":"ChannelTriggeredEvent"
}));
}
hmm .. found another forums post and also tried this:
function channelTrigger(channel, event, triggerName) {
return new Trigger(triggerName || uuid.randomUUID(), "core.ChannelEventTrigger", new Configuration({
channelUID: channel,
event: event
}));
}
ds82 commented
Ok, the latter worked ... used it like that:
channelTrigger('astro:sun:home:rise#event', 'START')
many thanks for this repo! :)
lewie commented
👍 Just moved around yet to find a solution.... Yours is best! :-)
I think most helping people could be found on
community.openhab.org
lewie commented
@ds82, I have extended and updated some classes: ChannelEventTrigger should do what you need now.