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

Show some modules and config in Holidays

Scheduled Pinned Locked Moved Unsolved Requests
5 Posts 2 Posters 1.6k Views 2 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.
  • Y Offline
    Ybbet
    last edited by Oct 28, 2018, 11:07 PM

    Hi,
    I wish I could display the modules and their configuration depending on whether we are on vacation or not.

    For example, I use the AlarmClock module, some alarms are specific to the school period. So, these are of no use during the holidays.

    Has anyone already configured such a configuration?

    ? 1 Reply Last reply Oct 28, 2018, 11:25 PM Reply Quote 0
    • ? Offline
      A Former User @Ybbet
      last edited by Oct 28, 2018, 11:25 PM

      @ybbet
      I think it is possible with crontab or some simple scripts. Prepare several config files(config_weekday.js, config_holiday.js, config_sunday.js, etc.) then make a script or cron job to copy one of them to config.js by condition. Add cronjob to restart every 0am with new configuration.

      1 Reply Last reply Reply Quote 0
      • Y Offline
        Ybbet
        last edited by Ybbet Oct 29, 2018, 10:51 PM Oct 29, 2018, 10:47 PM

        Hello,

        This is exactly the answer I put in place. I wanted to know if there was a simpler solution to not multiply the config files. And so, avoid mistakes and forgetfulness.

        @daily bash ~/tools/disk_usage.sh >> /tmp/cron_log.txt
        0 0 * * * cd /home/pi/magicmirror_config; git checkout ./ ; git pull >> /tmp/cron_log.txt
        5 0 * * * bash /home/pi/magicmirror_config/update_files_config.sh >> /tmp/cron_log.txt
        10 0 * * * cd /home/pi/; pm2 restart mm.sh >> /tmp/cron_log.txt
        @monthly sudo reboot
        15 0 * * * mail -s "MagicPi : cron rapport" test@example.tld < /tmp/cron_log.txt; rm /tmp/cron_log.txt
        
        ###############
        # Summer holidays : 7 july
        30 0 8 7 * cd /home/pi/MagicMirror/config/; rm -rf config.js; ln -s /home/pi/magicmirror_config/config_vac_centre.js config.js; pm2 restart mm
        # The boys
        30 0 6 8 * cd /home/pi/MagicMirror/config/; rm -rf config.js; ln -s /home/pi/magicmirror_config/config_vac_salome_centre.js config.js; pm2 restart mm
        # First boy come back to home
        30 0 14 8 * cd /home/pi/MagicMirror/config/; rm -rf config.js; ln -s /home/pi/magicmirror_config/config_vac_salome_1garcon_centre.js config.js; pm2 restart mm
        # The last boy come back to home
        30 0 24 8 * cd  /home/pi/MagicMirror/config/; rm -rf config.js; ln -s /home/pi/magicmirror_config/config_vac_centre.js config.js; pm2 restart mm
        # 3 september
        30 0 3 9 * cd /home/pi/MagicMirror/config/; rm -rf config.js; ln -s /home/pi/magicmirror_config/config.js config.js; pm2 restart mm
        
        
        ? 2 Replies Last reply Oct 29, 2018, 11:31 PM Reply Quote 0
        • ? Offline
          A Former User @Ybbet
          last edited by Oct 29, 2018, 11:31 PM

          @ybbet
          As I know, MM doesn’t have a feature - dynamic runtime configuration or conditional( or modular) config loading. So I think that might be the easiest (?) way.

          1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User @Ybbet
            last edited by Oct 29, 2018, 11:39 PM

            @ybbet
            But if your case be somehow regularly, you could make some script or program to compose and encode “config.js” file from some defined structure with python or any other language.
            Basically, config.js is some kind of JSON object(or like-something), So you can prepare one template object, and manipulate the object with your purpose by condition. Then write it into config.js file.

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            1 / 1
            • First post
              2/5
              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