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.

    Another PIR sensor

    Scheduled Pinned Locked Moved Requests
    19 Posts 3 Posters 3.5k 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.
    • D Offline
      DaVinki @sdetweil
      last edited by

      @sdetweil said in Another PIR sensor:

      {

      Code directly taken from the module page https://github.com/tosti007/MMM-ProfileSwitcher. Seems to me you need the bracket for a per module assignment of the class.

      I Have never done it before, so I think I can do it.

      1 Reply Last reply Reply Quote 0
      • D Offline
        DaVinki @sdetweil
        last edited by

        @sdetweil said in Another PIR sensor:

        @DaVinki said in Another PIR sensor:

        {
            module: 'MMM-ProfileSwitcher',
            config: {
                // See 'Configuration options' for more information.
            {                                    // < ----- what is that ?
             module: 'MMM-Wallpaper',
             classes: 'pageOneEveryone',
            },                                   // < ----- what is that?
            } 
        }
        

        seems there are too many {}

        Removing the brackets results in a black screen. Assigning the wallpaper module to IgnoredModules class doesn’t change that. Using square brackets [] also breaks the config.

        I Checked for comma’s, opening and closing brackets, the usual suspects, but as far as I can see I didn’t miss any.

        I Have never done it before, so I think I can do it.

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil
          last edited by

          @DaVinki said in Another PIR sensor:

          MMM-GPIO-Notifications

          do

          cd ~/MagicMirror
          npm config:check
          

          black screen, open the developers console, ctrl-shift-i on the keyboard,
          and select the tab labeled ‘console’ and scroll up to see any errors, usually red text.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            DaVinki @sdetweil
            last edited by

            @sdetweil said in Another PIR sensor:

            @DaVinki said in Another PIR sensor:

            MMM-GPIO-Notifications

            do

            cd ~/MagicMirror
            npm config:check
            

            black screen, open the developers console, ctrl-shift-i on the keyboard,
            and select the tab labeled ‘console’ and scroll up to see any errors, usually red text.

            npm config:check is an incorrect command.

            The black screen shows no errors. It states that the modules are hidden. Even the wallpaper module, which should be ignored.

            MMM-Wallpaper is suspended. module.js:198:7
            MMM-Wallpaper is hidden. MMM-ProfileSwitcher.js:113:25
            
            

            I Have never done it before, so I think I can do it.

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @DaVinki
              last edited by sdetweil

              @DaVinki said in Another PIR sensor:

              npm config:check is an incorrect command.

              yeh,

              npm run config:check

              i would disable each module one at a time til I found the one hiding everything

              add
              disabled: true,
              after the module statement

              {
              module: name,
              disabled: true,
              position:
              config: {
              }
              }

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                DaVinki @sdetweil
                last edited by

                @sdetweil said in Another PIR sensor:

                @DaVinki said in Another PIR sensor:

                npm config:check is an incorrect command.

                yeh,

                npm run config:check

                i would disable each module one at a time yil I found the one hiding everything

                add
                disabled: true,
                after the module statement

                {
                module: name,
                disabled: true,
                position:
                config: {
                }
                }

                Yeah, the culprit is MMM-ProfileSwitcher. Somehow I can not get that config working.

                I Have never done it before, so I think I can do it.

                1 Reply Last reply Reply Quote 0
                • wishmaster270W Online
                  wishmaster270 Module Developer
                  last edited by

                  @DaVinki said in Another PIR sensor:

                  MMM-ProfileSwitcher

                  Hi,
                  your configuration of MMM-ProfileSwitcher is wrong. In your case it will simply look like this:

                  {
                      module: 'MMM-ProfileSwitcher',
                      config: {
                          // See 'Configuration options' for more information.
                      } 
                  }
                  

                  But you need to add the classes part to your MMM-Wallpaper module:

                   {  
                        module: 'MMM-Wallpaper',
                        config: {
                            ...
                        }
                        classes: 'pageOneEveryone',
                  }, 
                  

                  So your config will look like this:

                  {
                      module: 'MMM-ProfileSwitcher',
                      config: {
                          defaultClass: "pageOneEveryone",
                          ignoreModules: ["moduleVisiableOnEveryPageOne", "moduleVisibleOnEveryPageTwo"]
                      } 
                  },
                  {  
                        module: 'MMM-Wallpaper',
                        config: {
                           //Add your wallpaper config here
                        }
                        classes: 'pageOneEveryone',
                  }, 
                  {
                       module: 'MMM-ProfileControl',
                       position: 'bottom_bar',
                       config: {
                          profiles: [
                             ['pageOneEveryone'],
                             ['pageTwoEveryone'],
                          ],
                       }
                  },
                  {
                       module: 'MMM-GPIO-Notifications',
                       config: {
                           '22': {
                               gpio_state: 1,
                               gpio_debounce: 10,
                               delay: 1000,
                               notifications: [
                                   {
                                      notification: 'PROFILE_DECREMENT_HORIZONTAL',
                                   },
                               ]
                          }
                    }
                  },
                  

                  The result will be two pages “pageOneEveryone” and “pageTwoEveryone”.
                  Every time your PIR triggers an “1” the GPIO Module will send an Notification to switch to the next page (and start again with “pageOneEveryone” if the end is reached).

                  You then can add “classes: ‘pageOneEveryone’,” to every module you want to be displayed an “pageOneEveryone” and “classes: ‘pageTwoEveryone’,” to every module you want to be displayed on “pageTwoEveryone”.

                  If you want to have modules displayed on every page you can add them to the ignore list of MMM-ProfileSwitcher.

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    DaVinki @wishmaster270
                    last edited by

                    @wishmaster270 Hi,

                    Almost there. :-) . I’ve got two pages, PIR sensor is working. I can see notifications switching from page one to page two. However, the sensor seems to bounce. I can see the “enter” notification for page two, and almost immediately see the “leave” notification for page two. Sometimes it indeed accidentally switches to page two though, so the mechanism itself is working.

                    I Have been playing around with the debounce and delay timers, with no success.

                    What I’m trying to accomplish is switch to page two when the PIR is triggered, and return to page one using a timer in ProfileSwitcher.

                    Current config for GPIO-Notifications:

                         {
                               module: 'MMM-GPIO-Notifications',
                                config: {
                              '22': {
                              gpio_state: 1,
                              gpio_debounce: 1000,
                              delay: 1000 * 20,
                              notifications: [
                                {
                                    'notification': 'PROFILE_DECREMENT_HORIZONTAL',
                                    'profiles': 'pageOneEveryone',
                                     },
                                    ]
                                    }
                                    }
                            },
                    
                    

                    Doesn’t the “profiles” flag only trigger an action when that specific profile is active?

                    I Have never done it before, so I think I can do it.

                    1 Reply Last reply Reply Quote 0
                    • wishmaster270W Online
                      wishmaster270 Module Developer
                      last edited by

                      Sorry, my mistake. Sure the profiles option in the GPIO config will cause the module to only fire the notification on pageOneEveryone.

                      What kind of PIR are you using, a HC-SR501? Maybe your jumper is set to pulse a signal as long as a object is in distance.

                      D 1 Reply Last reply Reply Quote 0
                      • wishmaster270W Online
                        wishmaster270 Module Developer
                        last edited by

                        Ps.: My modules write a lot of debug output to the log file. Maybe there is a hint in “~/.pm2/logs/MagicMirror-out.log”

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          DaVinki @wishmaster270
                          last edited by

                          @wishmaster270 I’m using one of the cheaper sensors from a Chinese store. Doesn’t even have jumpers on it. Seems to me that setting the debounce ridiculously high would solve the issue of it keeping firing.

                          Kind of at a lost here. Reading the PIN with a Python script gives a contiinue high, with an occasional low. However, setting the gpio_state to 0 doesn’t give any reaction. It also does not seem to react to changing the debounce or delay timers.

                          I Have never done it before, so I think I can do it.

                          1 Reply Last reply Reply Quote 0
                          • wishmaster270W Online
                            wishmaster270 Module Developer
                            last edited by wishmaster270

                            Maybe the problem is not the GPIO. Did you find same useful information in the log. Is the GPIO module fireing that often?

                            If an delay is configured in the GPIO module any events within this time range will be ignored. It is a simple mechanism and does not depend on the sensor. I use it with three PIRs in my setup without any problems.

                            Edit: There should be some entry like “MMM-GPIO-Notifications: : Skipped notifcation…” in the log if the delay works and the sensor fires

                            D 1 Reply Last reply Reply Quote 0
                            • D Offline
                              DaVinki @wishmaster270
                              last edited by

                              @wishmaster270 The GPIO does indeed fire a lot. I’m sure it is a simple mechanism. I’m trying to figure out a way to “filter” the signals. Be it by a delay, a debounce or whatever… there should be a simple work-around, right? (Don’t take this personally please, my work as IT engineer let’s me think in solutions and workarounds)

                              A small piece from the mm-out.log:

                              [2020-04-26 12:58:43.092] [LOG]    [12:58:43] - MMM-OpeningHours : : Error:  timeout
                              [2020-04-26 12:59:00.692] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
                              [2020-04-26 12:59:00.694] [LOG]    MMM-GPIO-Notifications: Sending notifications of pin 22...
                              [2020-04-26 12:59:00.695] [LOG]    CurProfile: pageOneEveryone
                              [2020-04-26 12:59:00.696] [LOG]    CurProfileString: pageOneEveryone
                              [2020-04-26 12:59:00.702] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
                              [2020-04-26 12:59:00.872] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
                              [2020-04-26 12:59:01.039] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:01.111] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:02.201] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:02.252] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:09.191] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
                              [2020-04-26 12:59:09.192] [LOG]    MMM-GPIO-Notifications: Skipping pin 22 because the delay is not exceeded !
                              [2020-04-26 12:59:17.471] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
                              [2020-04-26 12:59:17.472] [LOG]    MMM-GPIO-Notifications: Skipping pin 22 because the delay is not exceeded !
                              [2020-04-26 12:59:27.987] [LOG]    MMM-GPIO-Notifications: Watched pin: 22 triggered!
                              [2020-04-26 12:59:27.989] [LOG]    MMM-GPIO-Notifications: Sending notifications of pin 22...
                              [2020-04-26 12:59:27.991] [LOG]    CurProfile: pageOneEveryone
                              [2020-04-26 12:59:27.992] [LOG]    CurProfileString: pageOneEveryone
                              [2020-04-26 12:59:28.005] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
                              [2020-04-26 12:59:28.102] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:28.112] [LOG]    MMM-ProfileControl: Received notification PROFILE_DECREMENT_HORIZONTAL
                              [2020-04-26 12:59:28.537] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              [2020-04-26 12:59:29.213] [LOG]    MMM-ProfileControl: Received notification CHANGED_PROFILE
                              
                              

                              I Have never done it before, so I think I can do it.

                              1 Reply Last reply Reply Quote 0
                              • wishmaster270W Online
                                wishmaster270 Module Developer
                                last edited by wishmaster270

                                Sorry if it look liked i am taking the things personal that wasn’t my goal.
                                I want my modules to work and not to cause problems…

                                Could it be that you run two Browser (maybe build in and a second head) because the notifications get fired twice?

                                Edit: The delay seems to work. Because there are 20 seconds between the first time the gpio fires and the second time.

                                D 1 Reply Last reply Reply Quote 0
                                • D Offline
                                  DaVinki @wishmaster270
                                  last edited by

                                  @wishmaster270 No, it didn’t look like you took it personal, I just didn’t want you to on forehand.
                                  I Have indeed a second browser open on my laptop. Never thought of that being the issue… :-D

                                  Let’s close that one, and fiddle around with the timers a bit. My laptop shut down during lunchtime, and then I indeed saw the second screen show up.

                                  I Have never done it before, so I think I can do it.

                                  1 Reply Last reply Reply Quote 0

                                  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
                                  • 1 / 1
                                  • 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