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.

    MMM-Pir toggling

    Scheduled Pinned Locked Moved Solved Troubleshooting
    22 Posts 3 Posters 2.0k 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.
    • T Offline
      ttt126
      last edited by

      Is it possible to set the relay toggling not only when switching on or off, but during both state changes. So a toggle when switching off and a toggle when switching on.
      The background is that I want to use the relay to operate my standby button on the monitor.
      The relay currently switches off after a set time and switches on again when there is movement. This switches the supply voltage completely. It would be better to leave the power supply permanently connected and only switch the stanby button. But for this you need a change in the state of the relay with every process.
      I couldn’t get it to work in the settings. where can you change the behavior of the relay? mode 6 and mod 7 at the same time so to speak.

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

        @ttt126 said in MMM-Pir toggling:

        config: {
        triggers:[
        {
        trigger: “USER_PRESENCE”,
        fires: [
        {
        exec: (payload) => {
        return "python3 /homr/pi/neu1.py " + payload.option
        }
        },
        ],
        },
        ]
        }

        The pathon3 comand was missing. I´m not quite firm with programming.
        But a serce for executing a py script brought the answere!

        S 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil @ttt126
          last edited by

          @ttt126 best to ask the author

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • T Offline
            ttt126
            last edited by

            How can i do so?
            Is he actice on this forum?

            S 1 Reply Last reply Reply Quote 0
            • S Do not disturb
              sdetweil @ttt126
              last edited by sdetweil

              @ttt126 generally youwould open an issue on the module githib page

              @bugsounet can you please add an issues tab to the module? so we can keep track of things like this without you having to troll the forum too…

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • T Offline
                ttt126
                last edited by

                Thanks for your answer. I don’t want to troll anything here.
                On Github I can make a pull request under mmm-pir. I think that’s not the point. I can’t find a new issue there.
                So here are my questions.

                S 1 Reply Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @ttt126
                  last edited by

                  @ttt126 troll wasn’t indended for you. he is a busy guy. PIR is busted all over the place with bookworm.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    ttt126
                    last edited by

                    Thanks, opened an issue here:

                    https://github.com/KristjanESPERANTO/MagicMirror-3rd-Party-Modules/issues

                    Will see

                    bugsounetB 1 Reply Last reply Reply Quote 0
                    • bugsounetB Offline
                      bugsounet Banned @ttt126
                      last edited by

                      Hi,

                      MMM-Pir v2 is under coding
                      Unfortunately, it is not possible to use mode 6 and 7 at the same time (same GPIO)

                      This module send USER_PRESENCE notification with trueor false payload (it’s the screen state)
                      You can trigger it with this module MMM-NotificationTrigger and exec a personal script for this

                      Note:

                      • python RPi.GPIO will be deleted (in next release) because there is a compatibility problem with pi5 and with bookworm too.
                      • I will try to recode it with gpiod library for both compatibility
                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        ttt126
                        last edited by

                        Would it be possible to create a mode in which a relay is switched when detected on the PIR and after the new timer has expired.
                        So an on off toggle, so to speak. This would make it possible to switch any monitor using the Stanfby button. HDMI on/off would then not be necessary, simply a relay on the monitor button and all monitors could be used.
                        Unfortunately, I’m not that good at cascading the module.
                        Thank you for your great work

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          ttt126
                          last edited by

                          Thank you very much, I spent the whole day trying to understand notification triggers and producing a config, unfortunately without success.
                          Maybe you can help me out. how do I do the config so that the trigger can be taken over by mmmpir? I’ve already created a small py script with a gpio pin that goes on and off, it’s in the root directory.
                          But I just can’t get the execut function to be implemented.

                          {
                          module: “MMM-NotificationTrigger”,
                          config: {
                          triggers:[
                          {
                          trigger: “USER_PRESENCE”,
                          fires: [
                          {
                          exec: “/neu1.py”
                          }
                          ],
                          },
                          ]
                          }
                          },

                          S 1 Reply Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @ttt126
                            last edited by

                            @ttt126 said in MMM-Pir toggling:

                            exec: “/neu1.py”

                            that means in the root system folder’if you meant YOUR home folder
                            that would be , replace username with really logged on user for home folder

                            /home/username/neu1.py

                            there may have been messages posted to the MM startup output

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              ttt126
                              last edited by

                              Even with /home/pi/neu1.py it is not responding.
                              Do I have to devine true and fals state in the config as well?

                              S 1 Reply Last reply Reply Quote 0
                              • S Do not disturb
                                sdetweil @ttt126
                                last edited by

                                @ttt126 can you execute the script manually from the terminal window?

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  ttt126
                                  last edited by

                                  Yes, this I can.
                                  Kliking - exexute, relay klliks on an off once.

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Do not disturb
                                    sdetweil @ttt126
                                    last edited by

                                    @ttt126 ok, i was checking for permissions

                                    did you check the messages from npm start location, see if any errors were posted

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      ttt126
                                      last edited by

                                      @sdetweil said in MMM-Pir toggling:

                                      npm start location
                                      pi@MagicMirro-2:~/MagicMirror/config $ npm start

                                      magicmirror@2.29.0 start
                                      DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js

                                      [2024-10-23 17:12:16.266] [LOG] Starting MagicMirror: v2.29.0
                                      [2024-10-23 17:12:16.334] [LOG] Loading config …
                                      [2024-10-23 17:12:16.341] [LOG] config template file not exists, no envsubst
                                      [2024-10-23 17:12:17.515] [INFO] Checking config file /home/pi/MagicMirror/conf ig/config.js …
                                      [2024-10-23 17:12:17.711] [INFO] Your configuration file doesn’t contain syntax errors :)
                                      [2024-10-23 17:12:17.712] [INFO] Checking modules structure configuration …
                                      [2024-10-23 17:12:17.959] [INFO] Your modules structure configuration doesn’t c ontain errors :)
                                      [2024-10-23 17:12:17.967] [LOG] Loading module helpers …
                                      [2024-10-23 17:12:18.020] [LOG] Initializing new module helper …
                                      [2024-10-23 17:12:18.022] [LOG] Module helper loaded: MMM-Pir
                                      [2024-10-23 17:12:18.026] [LOG] Initializing new module helper …
                                      [2024-10-23 17:12:18.028] [LOG] Module helper loaded: MMM-NotificationTrigger
                                      [2024-10-23 17:12:18.031] [LOG] No helper found for module: alert.
                                      [2024-10-23 17:12:18.042] [LOG] Initializing new module helper …
                                      [2024-10-23 17:12:18.043] [LOG] Module helper loaded: updatenotification
                                      [2024-10-23 17:12:18.044] [LOG] No helper found for module: clock.
                                      [2024-10-23 17:12:18.298] [LOG] Initializing new module helper …
                                      [2024-10-23 17:12:18.299] [LOG] Module helper loaded: calendar
                                      [2024-10-23 17:12:18.300] [LOG] No helper found for module: MMM-WebView.
                                      [2024-10-23 17:12:18.303] [LOG] No helper found for module: weather.
                                      [2024-10-23 17:12:18.306] [LOG] No helper found for module: MMM-RAIN-MAP.
                                      [2024-10-23 17:12:18.488] [LOG] Initializing new module helper …
                                      [2024-10-23 17:12:18.489] [LOG] Module helper loaded: newsfeed
                                      [2024-10-23 17:12:18.490] [LOG] All module helpers loaded.
                                      [2024-10-23 17:12:18.522] [LOG] Starting server on port 8080 …
                                      [2024-10-23 17:12:20.761] [ERROR] Whoops! There was an uncaught exception…
                                      [2024-10-23 17:12:20.816] [ERROR] Error: listen EADDRINUSE: address already in u se ::1:8080
                                      at Server.setupListenHandle [as _listen2] (node:net:1904:16)
                                      at listenInCluster (node:net:1961:12)
                                      at GetAddrInfoReqWrap.doListen [as callback] (node:net:2135:7)
                                      at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:8) {
                                      code: ‘EADDRINUSE’,
                                      errno: -98,
                                      syscall: ‘listen’,
                                      address: ‘::1’,
                                      port: 8080
                                      }
                                      [2024-10-23 17:12:20.818] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                                      [2024-10-23 17:12:20.824] [ERROR] If you think this really is an issue, please o pen an issue on GitHub: https://github.com/MagicMirrorOrg/MagicMirror/issues
                                      [13489:1023/171222.609717:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.619958:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.622864:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.623145:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.623492:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.623703:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.623989:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.624237:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.624616:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.627519:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.631965:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.632229:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.632531:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.632730:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.634239:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.637235:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.639949:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.643515:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.647036:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.647506:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.648316:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.648593:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.648900:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.649075:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.649295:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.649472:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [13489:1023/171222.649704:ERROR:gbm_wrapper.cc(74)] Failed to get fd for plane.: No such file or directory (2)
                                      [13489:1023/171222.649858:ERROR:gbm_wrapper.cc(257)] Failed to export buffer to dma_buf: No such file or directory (2)
                                      [2024-10-23 17:12:24.158] [INFO] System information:

                                      SYSTEM: manufacturer: ; model: ; virtual: false

                                      OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch: arm64; kernel: 6.6.51+rpt-rpi-v8

                                      VERSIONS: electron: 31.7.1; used node: 20.18.0; installed node: 20.9.0; npm: 10.1.0; pm2: 5.4.2

                                      OTHER: timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined

                                      I think no errors according to the problem.

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Do not disturb
                                        sdetweil @ttt126
                                        last edited by

                                        @ttt126 that means you started MM AGAIN…

                                        if you are using PM2, then you need to use the pm2 commands

                                        pm2 status
                                        pm2 stop x
                                        where x is the name or number of the row of the app you want control
                                        and then pm2 start x

                                        or you can do

                                        pm2 restart x

                                        I STRONGLY recommend using manual start while you are developing your mm solution
                                        changing config, adding modules

                                        pm2 stop all
                                        
                                        cd ~/MagicMirror
                                        npm start 
                                        

                                        to stop MM in this mode, hit ctrl-q on the MM screen

                                        if you do this over ssh cause you have no keyboard on the mm system (like me all the time) press ctrl-c in the ssh window where you did npm start

                                        (if you do this when PM2 is controlling, it will do its job, “keep the app running”,
                                        you stop it, and pm2 will restart it… )

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

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

                                          so this is the aktual config
                                          the command python3 /home/pi/neu1.py is acting the relay if executed in termnal
                                          I use fire and exec both with no action.
                                          maybe there is no trigger natification.

                                          module: "MMM-NotificationTrigger",
                                                                 config: {
                                                                   triggers:[
                                                                     {
                                                                        trigger: "USER_PRESENCE",
                                                                        fires: [
                                                                          {
                                                                            fire:"python3 /home/pi/neu1.py",
                                                                            exec: (payload) => {
                                                                              return "python3 /homr/pi/neu1.py " + payload.option
                                                                            }
                                                                          },
                                                                         ],
                                                                       },
                                                                     ]
                                                                   }
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • T Offline
                                            ttt126
                                            last edited by

                                            I got it working, many thanks for your Help :-)

                                            S 1 Reply Last reply Reply Quote 1
                                            • S Do not disturb
                                              sdetweil @ttt126
                                              last edited by sdetweil

                                              @ttt126 what was the issue? might help others in the same predicament

                                              Sam

                                              How to add modules

                                              learning how to use browser developers window for css changes

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