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

Is hidden the same as disabled?

Scheduled Pinned Locked Moved Unsolved Troubleshooting
10 Posts 4 Posters 2.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.
  • R Offline
    rudibarani Project Sponsor
    last edited by Nov 22, 2018, 11:28 PM

    Is there a way to start a module hidden (or is this the same as disabled)?

    I would like to have MMM-Snow on „standby“ to be shown at specific times.

    ? 1 Reply Last reply Nov 23, 2018, 12:08 AM Reply Quote 0
    • ? Offline
      A Former User @rudibarani
      last edited by Nov 23, 2018, 12:08 AM

      @rudibarani
      https://github.com/ianperrin/MMM-ModuleScheduler

      1 Reply Last reply Reply Quote 0
      • R Offline
        rudibarani Project Sponsor
        last edited by Nov 23, 2018, 5:28 AM

        Thanks @Sean for the idea.

        I plan to use MMM-Snow during some days in the winter. The problem with MMM-Module Scheduler is, that it only seems to hide/show models when passing the point in time that triggers an event. Therefore, I would like to have MMM-Snow reliably hidden when restarting the mirror.

        I did find that MMM-Remote-Control allows to manually hide / show modules and save the “state”. But this information is lost every time the config is changed and does not seem to work fully reliably.

        I tried to show modules that are marked “disabled” in the config via show / hide notifications, but that does not seem to work…

        ? J 2 Replies Last reply Nov 23, 2018, 10:28 AM Reply Quote 0
        • ? Offline
          A Former User @rudibarani
          last edited by A Former User Nov 23, 2018, 10:31 AM Nov 23, 2018, 10:28 AM

          What could be the trigger to reveal that module from hiding? by manual?

          I think to add this modifying in MMM-Snow.js could be help, but not tested.

          start: function() {
            this.hide()
          },
          

          Or,

          notificationReceived: function(noti, payload, sender) {
            if (noti == "DOM_OBJECTS_CREATED") {
              this.hide()
            }
          },
          
          R 1 Reply Last reply Nov 23, 2018, 11:04 AM Reply Quote 1
          • R Offline
            rudibarani Project Sponsor @Guest
            last edited by Nov 23, 2018, 11:04 AM

            @sean I will try your code - thanks for the advice. I wanted to use the notification system to show and re-hide a module when the time is due.

            ? 1 Reply Last reply Nov 23, 2018, 11:11 AM Reply Quote 0
            • ? Offline
              A Former User @rudibarani
              last edited by A Former User Nov 23, 2018, 11:12 AM Nov 23, 2018, 11:11 AM

              @rudibarani said in Is hidden the same as disabled?:

              the notification system to show and re-hide a module when the time is due.

              This is somehow obvious. Is it by a schedule? In that case MMM-Scheduler can control its showing and hiding. Even start with hiding.
              https://github.com/ianperrin/MMM-ModuleScheduler#individual-module-schedules
              Or any other trigger? But MMM-Snow itself has no feature of self hiding/revealing by notification. Other module should hide/show MMM-Snow.

              1 Reply Last reply Reply Quote 0
              • J Offline
                j.e.f.f Project Sponsor Module Developer @rudibarani
                last edited by Nov 24, 2018, 11:37 AM

                @rudibarani if it’s disabled in the config then it’s not available to MagicMirror. It wouldn’t be able to show it at a scheduled time because it wouldn’t even be running.

                To do what you want to do is perhaps have a script that modifies your config, or replaces one config file with another that enables the module, then have it restart magic mirror. Schedule the script using a cron job. There are plenty of articles online that can help you write such a script and schedule it using cron.

                You can use the module scheduler as others suggest but it requires the module to be running even when it is hidden. Since you want it available only during the winter months, this means cpu cycles wasted during the summer. On a low powered device like the Pi, this could be a significant waste, especially if you have other modules that do a lot of heavy lifting.

                1 Reply Last reply Reply Quote 1
                • R Offline
                  rudibarani Project Sponsor
                  last edited by Nov 24, 2018, 1:46 PM

                  Dear j.e.f.f,

                  thanks - this is really good to know and helpful advice.
                  I am new to JS programming - but I am willing to tinker and learn. My current plan was to:

                  • Add notification support to MMM-Snow analog to “USER_PRESENCE”
                  • Add a config option to start inactive, e.g. “start_inactive:true”
                  • Add a temp-file that stores the current state of “state_inactive” in case the system reboots.

                  Then I could send a notification to MMM-Snow to set it active and inactive at the time needed. This might also be interesting for others…

                  I had a look at other modules and hope, that I can pick up all necessary info from the way, these features have been implemented there.
                  What do you think of this plan?

                  ? 1 Reply Last reply Nov 24, 2018, 4:39 PM Reply Quote 0
                  • C Offline
                    cowboysdude Module Developer
                    last edited by Nov 24, 2018, 4:00 PM

                    Sending and receiving notifications is the easy part of modules :) Just look in a few of them and see how it works… you’ll pick right up on it!!

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User @rudibarani
                      last edited by A Former User Nov 24, 2018, 4:44 PM Nov 24, 2018, 4:39 PM

                      @rudibarani
                      Prepare two config - config.snowon.js and config.snowoff.js.
                      Make a code to copy one of both to config.js when your trigger is activated. The next time rebooted, it will be applied.
                      Instead of copying file, you can read config.js and rewrite it directly. but a bullet-proof-parsing js code is not so easy for unexperienced one.)

                      However, MMM-Snow has no node_helper.js to refer. You have to build node_helper.js to do your job. (In MMM-Snow.js itself, approaching filesystem is limited.)

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      1 / 1
                      • First post
                        4/10
                        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