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

MMM-Energy-Saver - an easy way to suspend/resume modules based on a PIR sensor.

Scheduled Pinned Locked Moved System
10 Posts 4 Posters 3.1k Views 4 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.
  • M Offline
    michael5r Module Developer
    last edited by Dec 28, 2018, 10:32 PM

    Hi,

    Just released a new, small module called mmm-energy-saver.

    This module works in conjunction with MMM-Pir-Sensor to automatically suspend & resume all your modules based on movement detection. Furthermore, this module allows you to specify times when all the modules are suspended and your HDMI-connected screen is turned off as well.

    Please note that the movement detection will not work unless you have the MMM-Pir-Sensor module installed (and working).

    By design, this module has fairly limited functionality - which is nice because it makes it very easy to set up & use. If you, however, want a lot more control over the individual modules including setting specific timers based on days or showing alerts, I’d recommend checking out the MMM-ModuleScheduler module instead.

    Anyway, check out the new module here:
    [card:michael5r/mmm-energy-saver]

    1 Reply Last reply Reply Quote 1
    • A Offline
      AgP42 Project Sponsor Module Developer
      last edited by Feb 10, 2019, 8:26 PM

      Hello,

      interesting module, I worked myself too a lot about this topic for my Mirror, but the main problem was that most of the module don’t define the suspend/resume functions, and consequently even when they are hidden they continue to run in background and request to update their datas…

      So my solution was to update most of the module I am using to add suspend/resume function to stop the update according to the module.hidden and the notification “USER_PRESENCE” (sent by the PIR sensor module).

      Did you find a smarter way ?
      What is your module really doing to save the energy ?

      Thank you for your clues !

      M 1 Reply Last reply Feb 18, 2019, 3:24 AM Reply Quote 0
      • S Offline
        sdetweil
        last edited by sdetweil Feb 10, 2019, 9:12 PM Feb 10, 2019, 9:11 PM

        In my MMM-SleepWake module I do module.hide(). Not suspend

        I do this cause I cannot turn off/on my TV monitor, and no HDMI signal generates the ugly no input screen

        I use a camera for motion detection

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 1 Reply Last reply Feb 18, 2019, 3:27 AM Reply Quote 0
        • M Offline
          michael5r Module Developer @AgP42
          last edited by michael5r Feb 18, 2019, 3:25 AM Feb 18, 2019, 3:24 AM

          @agp42 said in MMM-Energy-Saver - an easy way to suspend/resume modules based on a PIR sensor.:

          Hello,

          interesting module, I worked myself too a lot about this topic for my Mirror, but the main problem was that most of the module don’t define the suspend/resume functions, and consequently even when they are hidden they continue to run in background and request to update their datas…
          So my solution was to update most of the module I am using to add suspend/resume function to stop the update according to the module.hidden and the notification “USER_PRESENCE” (sent by the PIR sensor module).

          Did you find a smarter way ?
          What is your module really doing to save the energy ?

          Thank you for your clues !

          So … the mmm-energy-saver module really does 2 things:

          1. It allows you to create a simple daily schedule where all modules are hidden and where your monitor is turned off. For instance, on my own mirror, this is set to take place between midnight and 7 am. During this time, any notifications from your motion sensor is ignored.

          2. Outside of this schedule (deepsleep), it continually listens for the USER_PRESENCE notification from the mmm-pir-sensor module. When this notification is received it shows all modules (if they were previously hidden) and runs a timer in the background. If the timer runs out before any new USER_PRESENCE notifications are received, this module then hides all other modules on the mirror.

          But this doesn’t solve the issue that you also mention - even though a module is hidden, most modules continue to load data in the background - which is a huge waste.

          So I did the same thing as you - I updated all my own modules to extend the standard suspend and resume functionality that already exists in the magic mirror framework.

          You can see example code here:
          https://github.com/michael5r/mmm-nest-status/blob/fcbf291a26374e32901e993f9e109465819f59bf/mmm-nest-status.js#L613

          Basically, when the suspend command is received, I set a module state called sleeping which also stops the module from getting new data.

          When the resume command is received, the sleeping state is set to false and it immediately polls for fresh module data.

          Would be nice if more modules supported this behavior!

          S 1 Reply Last reply Feb 18, 2019, 3:29 AM Reply Quote 0
          • M Offline
            michael5r Module Developer @sdetweil
            last edited by Feb 18, 2019, 3:27 AM

            @sdetweil It’s the same thing, though - when do you module.hide(), you trigger the suspend method for that particular module.

            S 1 Reply Last reply Feb 18, 2019, 3:29 AM Reply Quote 0
            • S Offline
              sdetweil @michael5r
              last edited by Feb 18, 2019, 3:29 AM

              @michael5r also note that modules can be hidden on purpose. So wakeup should not show all modules.

              My MMM-SleepWake saves a list of modules already hidden on sleep.

              This also works across sleep/wake voice commands by MMM-voice/lucy

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              M 1 Reply Last reply Feb 18, 2019, 3:35 AM Reply Quote 0
              • S Offline
                sdetweil @michael5r
                last edited by Feb 18, 2019, 3:29 AM

                @michael5r understand and agree

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • M Offline
                  michael5r Module Developer @sdetweil
                  last edited by Feb 18, 2019, 3:35 AM

                  @sdetweil said in MMM-Energy-Saver - an easy way to suspend/resume modules based on a PIR sensor.:

                  @michael5r also note that modules can be hidden on purpose. So wakeup should not show all modules.

                  My MMM-SleepWake saves a list of modules already hidden on sleep.

                  This also works across sleep/wake voice commands by MMM-voice/lucy

                  Sure - and in that case, the mmm-energy-saver module probably isn’t a good fit. But it works great when you only need to do what I describe above :)

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jordes
                    last edited by Nov 19, 2019, 8:14 AM

                    how should the MMM-Pir-Sensor be set up for this module to work?
                    This is my code:

                      {
                                    module: 'MMM-PIR-Sensor',
                                    config: {
                    sensorPin: "23",
                                            // See 'Configuration options' for more information.
                                    }
                            }, 
                    
                    
                    {
                        module: "mmm-energy-saver",
                        config: {
                    triggerMonitor: "true",
                    timeoutInSeconds: "3",
                            // ... whatever configuration options you want to use
                        }
                    },
                    
                    
                    michael5rM 1 Reply Last reply May 20, 2020, 5:44 PM Reply Quote 0
                    • michael5rM Offline
                      michael5r Module Developer @jordes
                      last edited by May 20, 2020, 5:44 PM

                      @jordes said in MMM-Energy-Saver - an easy way to suspend/resume modules based on a PIR sensor.:

                      how should the MMM-Pir-Sensor be set up for this module to work?
                      This is my code:

                        {
                                      module: 'MMM-PIR-Sensor',
                                      config: {
                      sensorPin: "23",
                                              // See 'Configuration options' for more information.
                                      }
                              }, 
                      
                      
                      {
                          module: "mmm-energy-saver",
                          config: {
                      triggerMonitor: "true",
                      timeoutInSeconds: "3",
                              // ... whatever configuration options you want to use
                          }
                      },
                      
                      

                      This is how I have mine set up:

                      {
                          module: 'MMM-PIR-Sensor',
                          config: {
                              sensorPin: 17,
                              powerSavingDelay: 0,
                              powerSavingNotification: false,
                              powerSaving: false // Should the monitor be turned off if no user is present? (via HDMI or relay)
                          }
                      },
                      
                      1 Reply Last reply Reply Quote 0
                      • 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