Read the statement by Michael Teeuw here.
notification array
-
Hello, great module, simple and precise.
Just one question (I’m not a JS expert), is there any simple way to trigger the notificaion based on an array of triggers?
eg:{
module: “MMM-NotificationTrigger”,
config: {
triggers:[
{
trigger: “DOM_OBJECTS_CREATED”,
fires: [
{
fire: [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”],
exec: “sleep 5; ls -l”
},
],
},
]
}
},Thanks
-
@MrDondoT
But is it too complex?fires:[ {fire: "NOTI_A"}, {fire: "NOTI_B"}, {fire: "NOTI_C"}, ],
-
@MrDondoT
Or you can do like this tricky way;fires: [ { fire: "DUMMY", payload: (payload) => { MM.getModules().enumerate(module=>{ if (module.name == "MMM-NotificationTrigger") { module.sendNotification("NOTI_A") module.sendNotification("NOTI_B") module.sendNotification("NOTI_C") } }) return null } } ]
-
Sorry Sean, my bad example! Thank you for reply but in reality I was looking for an array of triggers like so:
triggers:[
{
trigger: [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”],
fires: [
{fire: “NOTI_A”},
],
… -
@MrDondoT
You’d better make a new simple module. (Really simple)Module.register("MyTriggerModule", { notificationReceived: function (notification, payload, sender) { const myTriggers = [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”] if (myTriggers.include(notification)) { this.sendNotification("MY_NOTIFICATION") } } })
Really that’s all.
-
Thanks Sean! I appreciate your help. :thumbs_up_light_skin_tone: