• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

2 Mirrors and one Sensor ( MMM-PIR-Sensor )

Scheduled Pinned Locked Moved Hardware
11 Posts 3 Posters 3.1k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    binia
    last edited by Feb 11, 2019, 11:37 AM

    is it posible to add only one sensor to 2 Raspberry Pi?
    Regards

    1 Reply Last reply Reply Quote 0
    • B Offline
      binia
      last edited by Mar 4, 2019, 11:26 AM

      noone?
      I have in 1 Mirror 2 Display and Pi and want to add a sensor.

      1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil
        last edited by Mar 4, 2019, 11:34 AM

        sorry, do not understand question… typically one uses ONLY 1 PIR sensor…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • B Offline
          binia
          last edited by Mar 5, 2019, 1:35 PM

          Sorry for my bad English.

          I have 2 Magic.Mirrors in a mirror and just wanted to use 1 PIR module for both.

          Therefore the question if this is technically possible or if I have to use a module for each raspberry.

          S 1 Reply Last reply Mar 5, 2019, 1:39 PM Reply Quote 0
          • S Away
            sdetweil @binia
            last edited by Mar 5, 2019, 1:39 PM

            @binia oh!.. you have two monitors inside your single mirror!.. wow…

            all u need is the signal pin of the PIR… and connect the grounds together on the two PI devices…

            otherwise you could have one PI send a MMM message to the other to wakeup…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • B Offline
              binia
              last edited by Mar 6, 2019, 8:37 AM

              0_1551861410991_IMG_20180916_150055.jpg 0_1551861416010_IMG_20180916_150101.jpg 0_1551861420245_IMG_20181218_144954.jpg 0_1551861424435_IMG_20181218_145005.jpg

              S 1 Reply Last reply Mar 6, 2019, 12:21 PM Reply Quote 0
              • B Offline
                binia
                last edited by Mar 6, 2019, 8:39 AM

                its 160cm x 65cm
                One is a TV and one a Display

                1 Reply Last reply Reply Quote 0
                • ? Offline
                  A Former User
                  last edited by A Former User Mar 6, 2019, 8:57 AM Mar 6, 2019, 8:56 AM

                  You can install one PIR on one RPI(A).
                  Then, you can modify or build a module to send HTTPRequest to other RPI(B) on RPI(A) which has PIR sensor
                  Then, you can also modify or build a module to catch HTTPRequest on RPI(B) to use it as a signal for your job.

                  • MMM-PIR-Sensor (RPI(A)) : You can modify socektNotificationReceived() to emit your custom notification,
                    Or send HTTPRequest directly to RPI(B)
                  • MMM-NotificationTrigger (RPI(A)) : Or you can translate notification from MMM-PIR-Sensor to your custom notification for further relayed module,
                    Or you can execute directly external shell command/internal javascript for sending HTTPRequest when notification is coming from MMM-PIR-Sensor
                  • Or … you can build your own module for this job.

                  • MMM-Remote-Controller (RPI(B)) : You can get HTTPRequest from RPI(A) to do something
                  • MMM-NotificationTrigger(RPI(B)) : This module also can catch HTTPRequest and do something
                  • Or … you can build your module for this job.

                  • Or you can make scripts with javascript or python or any other language to communicate between two RPIs. It will be not so difficult to expert, but…
                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    binia
                    last edited by Mar 6, 2019, 10:10 AM

                    Thanks for your answer.
                    I will try it.

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User
                      last edited by A Former User Mar 6, 2019, 11:45 AM Mar 6, 2019, 11:39 AM

                      Here is a simple example for using MMM-NotificationTrigger. Not tested, but you can catch the concept.

                      Assumption

                      • RPI_A
                        • MM IP : 192.168.178.101:8080
                        • PIR_SENSOR is installed
                        • This will emit notification "USER_PRESENCE" with payload true/false
                      • RPI_B
                        • MM IP : 192.168.178.102:8080
                        • PIR_SENSOR IS not installed.
                        • It needs payload value of USER_PRESENCE from RPI_A

                      RPI_A MMM-NotificationTrigger config

                      {
                        module: "MMM-NotificationTrigger",
                        config: {
                          triggers: [
                            {
                              trigger: "USER_PRESENCE",
                              triggerPayloadFilter: (payload) => {
                                return payload
                              },
                              fires: [
                                {
                                  fire: "DUMMY_NOTIFICATION",
                                  exec: `curl -d "notification=RELAYED_USER_PRESENCE&payload=true" http://192.168.178.102:8080/webhook`
                                }
                              ]
                            },
                            {
                              trigger: "USER_PRESENCE",
                              triggerPayloadFilter: (payload) => {
                                return !payload
                              },
                              fires: [
                                {
                                  fire: "DUMMY_NOTIFICATION",
                                  exec: `curl -d "notification=RELAYED_USER_PRESENCE&payload=false" http://192.168.178.102:8080/webhook`
                                }
                              ]
                            },
                          ]
                        }
                      },
                      

                      If USER_PRESENCE notification is emitted from MMM-PIR-Sensor, it will be translated to DUMMY_NOTIFICATION and curl shell command will be executed to transfer message(RELAYED_USER_PRESENCE) to RPI_B

                      RPI_B MMM-NotificationTrigger config

                      {
                        module: "MMM-NotificationTrigger",
                        config: {
                          useWebhook: true,
                          triggers: [
                            {
                              trigger: "RELAYED_USER_PRESENCE",
                              fires: [
                                {
                                  fire: "DOING_MY_JOB",
                                  payload: (payload) => {
                                    return (payload == "true") ?  true : false
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      },
                      

                      By useWebhook:true it can listen message from RPI_A. When RELAYED_USER_PRESENCE is coming, DOING_MY_JOB (or whatever you want) notification will be emitted on RPI_B

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy