Read the statement by Michael Teeuw here.
MMM-NotificationTrigger transform payload
-
@corius So I tamed the beast but I’m getting the feeling that @Sean is right.
The following would alert you of the next event every time the calendar sends a calendar_event notification:
{ module: "MMM-NotificationTrigger", config: { triggers:[ { trigger: "CALENDAR_EVENTS", fires: [ { fire:"SHOW_ALERT", payload: (payload) => { var testMessage = ""; var nextEvent = payload.find(event => event.startDate > moment().format("x")); testMessage = nextEvent.title + " " + moment(nextEvent.startDate, "x").format("HH:mm"); return { type: "notification", title: "Next event:", message: testMessage } }, } ], }, ] } },For some yet unknown reason, I am getting this alert 8 times! The alert then vanishes quite shortly after.
It is a good idea, but what I would do, no, WILL do, is implement a “Notification Alert Function” directly into the calendar module (or into MMM-CalendarExt, if you’re interested, @Sean).
I think that would be a better way of ontrolling the alert created from a calendar event appearing. -
@lavolp3 said in MMM-NotificationTrigger transform payload:
For some yet unknown reason, I am getting this alert 8 times! The alert then vanishes quite shortly after.
because it still sends an alert notification, with an empty payload
fire:“SHOW_ALERT”, (always)
-
@sdetweil As far as I understand, it triggers when receiving the CALENDAR_EVENTS noti, and then “fires” a new notification, which is the “SHOW_ALERT” with the new payload.
This does not explain to me why it sends the “SHOW_ALERT” noti apparently 8 times in a row. -
@lavolp3 cause calendar payload events is an array, fires once per
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login