A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Syntax of MMM-NotificationTrigger
-
Hi,
I am having difficulties with the syntax of MMM-NotificationTrigger. I have this syntax working (semi):{ module: "MMM-NotificationTrigger", config: { triggers:[ { trigger: "PLAY_SOUND", fires: [ { fire:"USER_PRESENCE", payload: function(payload) { return false } }, { fire:"SHOW_ALERT", payload: function(payload) { return { type: "notification", title: "Porten", message: "Der er nogen ved porten!" } }, } ], }, ] } },
I need to add a trigger using webhook for the notification “Open_Gate” that fires a local script. Every time I change the syntax it seems to get broken. Can anyone help?
-
@MilkShake So IFTTT makes a webrequest that looks like this:
URL: https://MMPUBLICURL/webhook
Method: POST
Content type: application/json
Body: { “sender”: { “name”:“IFTTT” }, “notification”: “OPEN_GATE”}I thought I could do something like:
{ module: "MMM-NotificationTrigger", config: { useWebhook: true, triggers:[ { trigger: "PLAY_SOUND", fires: [ { fire:"USER_PRESENCE", payload: function(payload) { return false } }, { fire:"SHOW_ALERT", payload: function(payload) { return { type: "notification", title: "Porten", message: "Der er nogen ved porten!" } }, } ], }, { trigger: "OPEN_GATE", fires: [ exec: "home/pi/open_gate.py" ], }, ] } },
What is the correct syntax to fire a script?
-
@MilkShake Got it to work using:
{ module: "MMM-NotificationTrigger", config: { useWebhook:true, triggers:[ { trigger: "PLAY_SOUND", fires: [ { fire: "USER_PRESENCE", payload: function(payload) { return false } } ] }, { trigger: "OPEN_GATE", fires: [ { fire: "OPENING_THE_GATE", exec: "sudo python /home/pi/open_gate.py" } ] }, ] } },