MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. MilkShake
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    M
    Offline
    • Profile
    • Following 1
    • Followers 0
    • Topics 11
    • Posts 68
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Syntax of MMM-NotificationTrigger

      @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?

      posted in General Discussion
      M
      MilkShake
    • 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?

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      @Bugsounet Thanks Bugs! I will look into that when I have time for it.

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      I went the way of dataplicity.io/wormhole, NGINX, IFTTT and MMM-NotificationTrigger. That way I should be able to use a webhook to execute the python script.

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      @retroflex The mirror and the gate are on the same LAN. The assistant understands the “Open Gate” command and replies with “Ok, Opening the gate”, but if I were to use a Google Action to do the GET, it would come from the internet.

      I don’t know how to catch the event locally on the mirror. If I did, I would just call the python script and the gate would open.

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      @sdetweil my whole point is, since the action happens on the google assistant I would need to do port forwards in my firewall to be able to call a LAN URL with a GET method. I guess it would be possible to catch the event locally on the mirror and then call the python script or do the GET method in some other manner, but I don’t know how to do that.

      One option would be to just add a physical button to the raspberry pi and when pressed it runs the GET method. It just annoys me that you can make the assistant understand a command, but not utilize it locally on LAN.

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      @sdetweil I’m not following your point. I get it that I could do the GET from javascript instead of running a script, but the rest you might elaborate a bit more on :)

      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      @sdetweil this is two lines:

      import requests
      
      x = requests.get('http://USERNAME:PASSWORD@192.168.1.XXX/bha-api/open-door.cgi')
      print(x.status_code)
      
      
      posted in General Discussion
      M
      MilkShake
    • RE: Ideas Needed

      It doesn’t really matter how I do it. The point is that it has to be done from LAN, so I need a way to interact with the mirror and get it to fire the script.

      posted in General Discussion
      M
      MilkShake
    • Ideas Needed

      Hi,
      So I build a magic mirror with MMM-AssistantMk2 and it works pretty good. I have the assistant/mirror integrated with the following:

      Roborock vacuumers (1 on each floor)
      Siemens EQ9 automatic coffeemachine
      Hue Lighting
      Video feed from the gate camera (doorbird 101D)

      So, I got the assistant to recognize the open gate “Open Gate” command and respond with “Ok, Opening the front gate”. However, in order to actually open the front gate, a HTTP GET needs to be sent to the gate camera. I can do that with a python script on the Raspberry PI, however in order to get the assistant to call that script I would need to do port forwards in my firewall, which I would rather not.

      I need some way to interact with the mirror, so it calls the python script. It could be a physical button but I am looking for alternatives.

      Does anyone have any ideas?

      Best
      MilkShake

      posted in General Discussion
      M
      MilkShake
    • RE: Doorbird IP camera integration

      You have to have AMk2 and the screen Addon by Bugsounet.

      But basicly, I used the https string you gave me for the HTTP call to MMM-Sounds. That triggers the event PLAY_SOUND which can be picked up by MMM-Notification-Trigger:

      {
            module: "MMM-NotificationTrigger",
            config: {
              triggers:[
                {
                  trigger: "PLAY_SOUND",
                  fires: [
                    
      //wakes up the screen using the screen addon
                    {
                      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!",
                          timer: 1000
                        }
                      },
                    }
                  ],
                },
              ]
            }
      },
      

      I’m struggling a bit with the multiple fires within one trigger, but I had it working at a certain point :)

      posted in General Discussion
      M
      MilkShake
    • RE: Doorbird IP camera integration

      Hi,
      I used the MMM-Notification-Trigger to wake up the screen and display an alert when it receives the PLAY_SOUND event.

      Best
      MilkShake

      posted in General Discussion
      M
      MilkShake
    • RE: MMM-NotificationTrigger

      @Sean I got it to work using:

      {
            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!"
                      },
                    },
                  ],
                },
              ]
            }
       },
      

      Thanks for helping!

      posted in System
      M
      MilkShake
    • RE: MMM-NotificationTrigger

      @Sean Yeah, I see that. When I fire this

      http://MM_IP:8080/remote?action=SHOW_ALERT&message=Der%er%nogen%ved%porten!&title=PORT&timer=10&type=alert

      it displays the alert.

      posted in System
      M
      MilkShake
    • RE: MMM-NotificationTrigger

      @Sean I also tried that. The Alert does not show up in MM. It wakes the screen with USER_PRESENCE and plays the sound, but no Alert.

      posted in System
      M
      MilkShake
    • RE: MMM-NotificationTrigger

      Hi Everyone,
      Can some help me create a Notification trigger that fires multiple commands?

      So I have a gate that calls PLAY_SOUND when the gate button is pressed. Besides playing the sound I would like to show an alert and wake up the screen.

      So playing the sound and wakening the screen works. But I would like to add an Alert as well. The working config is like this:

      {
            module: "MMM-NotificationTrigger",
            config: {
              triggers:[
                {
                  trigger: "PLAY_SOUND",
                  fires: [
                    {
                      fire:"USER_PRESENCE",
                      payload: function(payload) {
                        return false
                      },
                    },
                  ],
                },
              ]
            }
       },
      

      Now, if I wan’t and alert on the same event, I tried this:

      {
            module: "MMM-NotificationTrigger",
            config: {
              triggers:[
                {
                  trigger: "PLAY_SOUND",
                  fires: [
                    {
                      fire:"USER_PRESENCE",
                      payload: function(payload) {
                        return false
                      },
      
      		{
                      fire:"SHOW_ALERT",
                  	payload: function() {
                    	return {
                      type:"notification",
                      title:"Porten",
                      message: "Der er nogen ved porten!"
                      },
                    },
                  ],
                },
              ]
            }
       },
      

      But it does not work.

      Any help appreciated…

      Best
      MilkShake

      posted in System
      M
      MilkShake
    • RE: Doorbird IP camera integration

      @mmourcia would be an option, thanks. I will check it out! My initial thought was that the code executing the wavfile, would also be able to execute a shell script on the PI, but a HTTP listener would also do the job.

      Evidently, I can only set the Doorbird to do ONE http call pr event, otherwise a tweaked version of the monitor on http call (MMM-Remote-Control) could be used together with the call for playing a sound.

      posted in General Discussion
      M
      MilkShake
    • RE: Doorbird IP camera integration

      @mmourcia And I need to find out how to run a script on the same event :)

      posted in General Discussion
      M
      MilkShake
    • RE: Doorbird IP camera integration

      @mmourcia Hey man, just tested, it works! Why would the schedule for a HTTP call not be allowed in the scheduler by default is beyond me! :)

      posted in General Discussion
      M
      MilkShake
    • RE: Magic mirror first try (France, ~Lille)

      Thanks man. I think I’ll keep the feed open for the camera and use the MMM-Sounds for notification when someone pushes the button. That is, if I can get it to work :)

      But a nice way to get the module data, thanks!

      posted in Show your Mirror
      M
      MilkShake
    • 1
    • 2
    • 3
    • 4
    • 2 / 4