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.

    Hide modules when display goes off through PIR (power saving)

    Scheduled Pinned Locked Moved Unsolved Requests
    22 Posts 7 Posters 10.2k Views 6 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.
    • ejay-ibmE Offline
      ejay-ibm Project Sponsor Module Developer @thedk
      last edited by

      @thedk Hi ,
      I finally manage to find a solution that works quite good.
      I do not deserve the credit for the solutions, only for the implementation as it merges multiple sources.
      First : PIR need a first trigger to work .
      Workaround : Make the HDMI OFF when the mirror start ( so your screen doesn’t stay ON always until someone pass in front of the miror )

      For this Edit :
      in the MMM-PIR-SENSOR folder
      node_helper.js
      around line 139

      this.started = true;
          self.deactivateMonitor();  // add this to turn off monitor at startup . 
      

      Then to deactivate the idle / sleep mode of the modules due to MMM-Assistant

      Still in the node_helper.js modify line 34 like :

      exec(“/usr/bin/vcgencmd display_power 1 && xdotool key ctrl+r”, null); // add here xdotool key ctrl+r

      You need to install xdotool for this. That will allow to simulate the ctrl+r from keybaord that refresh the module therefore bring them back on screen .

      I set in the config.js file the pir module to put the screen off after 15 mins

      “powerSavingDelay”: “900”,

      I applied the same setting in MMM-AssistantMk2.js

      onIdle: {
      timer: 10006015, // if you don’t want to use this feature, just set timer as 0 or command as “”
      command: “HIDEMODULES”

      Summary When I start my mirror the screen is off. The PIR detect my presence and turn it ON .
      After 15 mins the screen goes off and the modules goes in sleep .

      As soon as the user presence is detected again , the screen goes on and modules are refreshed and come back .

      Hope this helps .

      EJ

      1 Reply Last reply Reply Quote 0
      • brobergB Offline
        broberg Project Sponsor
        last edited by

        Maybe I don’t understand your question… but

        Hiding modules only with css (i.e hiding them on screen) does nothing for the power saving.
        You need the monitor to go in to sleep for any power to be saved.

        The Pi still runs when you hide the modules, not much power to save there, And I don’t really think the modules reload when hiding/showing them. But I can be wrong haven’t looked in to the code on the Hide/show part.

        ejay-ibmE 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil
          last edited by

          modules do not reload… their content is not shown when hidden

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 1
          • T Offline
            thedk
            last edited by

            But it would save CPU Power if the Modules would be hide or not?

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

              @thedk unlikely… or so small as to be unmeasurable

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              J 1 Reply Last reply Reply Quote 1
              • ejay-ibmE Offline
                ejay-ibm Project Sponsor Module Developer @broberg
                last edited by

                @broberg
                Indeed you don’t save power but when placing the module “on sleep” you stop them for making them network request with API calls .

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

                  @ejay-ibm yes, a well written module will suspend operations while hidden or suspended.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  cowboysdudeC Mykle1M 2 Replies Last reply Reply Quote 2
                  • cowboysdudeC Offline
                    cowboysdude Module Developer @sdetweil
                    last edited by

                    @sdetweil I’d be willing to bet the majority don’t … I don’t have any provisions in mine to stop polling but since you brought it up it is something I will most certainly want to do!! It’s a VERY good idea!

                    S 1 Reply Last reply Reply Quote 0
                    • Mykle1M Offline
                      Mykle1 Project Sponsor Module Developer @sdetweil
                      last edited by

                      @sdetweil said in Hide modules when display goes off through PIR (power saving):

                      a well written module will suspend operations while hidden or suspended.

                      That leaves me out. :-)

                      Create a working config
                      How to add modules

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

                        @cowboysdude @Mykle1 just add routines for suspend and resume. Set a variable on suspend, and don’t do anything til the variable is cleared on resume

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 2
                        • J Offline
                          j.e.f.f Project Sponsor Module Developer @sdetweil
                          last edited by

                          @sdetweil said in Hide modules when display goes off through PIR (power saving):

                          @thedk unlikely… or so small as to be unmeasurable

                          Also, if the modules keep running while the display is off, they will all be up to date when you trigger the presence sensor to bring it out of sleep.

                          I’d recommend not hiding the modules during power save.

                          S 1 Reply Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @j.e.f.f
                            last edited by

                            @j-e-f-f I have a mopdule that tracks water usage and tank levels, once every 5 minutes… calls an api, gets all the values, and draws the graphs…

                            my SleepWake module puts the mirror to sleep when no one is around… but when it wakes up, it updates…
                            in like 5-10 seconds…

                            no point pulling all that data overnight, or when I am gone for the day…

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 1
                            • T Offline
                              thedk
                              last edited by

                              Nice discussion :)
                              My thought just was to reduce the temperature of the CPU when the display switches of.
                              But the point with the network requests is also good!

                              cowboysdudeC 1 Reply Last reply Reply Quote 0
                              • cowboysdudeC Offline
                                cowboysdude Module Developer @thedk
                                last edited by

                                @thedk Well if it’s not pulling it may cool it down by the virtue of not having to work to get the data. The other way to cool it down is put a fan on or near it…

                                J 1 Reply Last reply Reply Quote 0
                                • J Offline
                                  j.e.f.f Project Sponsor Module Developer @cowboysdude
                                  last edited by

                                  @cowboysdude a fan adds noise. If you’re really concerned about heat, then suspending the modules when it goes to sleep is a good approach if you’re ok with waiting 5-10 seconds for your modules to update after your mirror wakes up.

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

                                    A fan wouldnt be a solution. The 5-10 seconds waiting would be ok.

                                    1 Reply Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @j.e.f.f
                                      last edited by

                                      @j-e-f-f if I am willing to wait 5 minutes for the next update, why would I NOT be willing to wait 5-10 SECONDS for a refresh after sleeping all night?

                                      I don’t sleep the mirror for power or heat savings…(cpu runs at the same speed al the time) I sleep the mirror for darkness…

                                      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