MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MMM-ModuleScheduler (how to use MMM-RemoteControl to HIDE/SHOW modules)?


  • Project Sponsor

    Hi all,

    I’m using MMM-RemoteControl also from other devices to HIDE/SHOW modules (e.g. MMM-iFRAME with a video stream) via HTTP Get requests and that works nicely.

    http://My_MM_IP:8080/remote?action=SHOW&module=module_11_MMM-iFrame
    
    http://My_MM_IP:8080/remote?action=HIDE&module=module_11_MMM-iFrame
    

    This command is send from a Raspi running Motion with a connected USB CAM and will show/hide the videostream when this RasPi detects any motion. This works great.

    Now I’m also using MMM-traffic but would like to show the module only in the mornig hours during the working days and hide afterwards.

    I tried something like:

    // SHOW traffic module  on weekdays between 6:00 and 9:30
    {notification: 'REMOTE_ACTION', schedule: '0 6 * * MON-FRI', payload: {action: "SHOW&module=module_15_MMM-Traffic"}},
    {notification: 'REMOTE_ACTION', schedule: '30 9 * * MON-FRI', payload: {action: "HIDE&module=module_15_MMM-Traffic"}}
    

    but the module does not hide.
    For testing purposes I also tried this:

    {notification: 'REMOTE_ACTION', schedule:  '*/2 * * * MON-FRI', payload: {action: 'SHOW {"identifier":"module_15_MMM-Traffic"}'}},
                                    {notification: 'REMOTE_ACTION', schedule:  '1-59/2 * * * MON-FRI', payload: {action: 'HIDE {"identifier":"module_15_MMM-Traffic"}'}}
    

    Actually the moudle should be sown/hidden every other minute. In PM2 log I can see that there is some action going on, but I expect that simply my paload description is wrong.

    Any hints?
    Many thanks form Neuss/DE


  • Module Developer

    Hi,

    what are the logs showing? (npm start dev [on Raspberry]) or (F12 [on broser like Firefox]).

    AxLED


  • Project Sponsor

    @axled
    this is the PM2 logs output directly after restarting MM:

    pi@raspberrypi:~/MagicMirror $ pm2 logs MagicMirror
    [TAILING] Tailing last 15 lines for [MagicMirror] process (change the value with --lines option)
    /home/pi/.pm2/logs/MagicMirror-error-0.log last 15 lines:
    0|MagicMir |     at /home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:68:31
    0|MagicMir |     at Git. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1482:10)
    0|MagicMir |     at done (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    0|MagicMir | TypeError: Cannot read property 'hash' of null
    0|MagicMir |     at /home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:68:31
    0|MagicMir |     at Git. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1482:10)
    0|MagicMir |     at done (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    
    /home/pi/.pm2/logs/MagicMirror-out-0.log last 15 lines:
    0|MagicMir | MMM-ModuleScheduler is sending SEND_NOTIFICATION to REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send SEND_NOTIFICATION to REMOTE_ACTION at Sat Jun 16 2018 14:53:00 GMT+0200 (CEST) based on "1-59/2 * * * *"
    0|MagicMir | Shutting down server...
    0|MagicMir | Stopping module helper: updatenotification
    0|MagicMir | Stopping module helper: calendar
    0|MagicMir | Stopping module helper: MMM-DWD-WarnWeather
    0|MagicMir | Stopping module helper: MMM-Remote-Control
    0|MagicMir | Stopping module helper: MMM-NetworkScanner
    0|MagicMir | Stopping module helper: MMM-Traffic
    0|MagicMir | Stopping module helper: MMM-ModuleScheduler
    0|MagicMir | Stopping module helper: newsfeed
    0|MagicMir | 
    0|MagicMir | > magicmirror@2.3.1 start /home/pi/MagicMirror
    0|MagicMir | > sh run-start.sh
    0|MagicMir | 
    
    0|MagicMir | Starting MagicMirror: v2.3.1
    0|MagicMir | Loading config ...
    0|MagicMir | Loading module helpers ...
    0|MagicMir | No helper found for module: alert.
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: updatenotification
    0|MagicMir | No helper found for module: clock.
    0|MagicMir | No helper found for module: calendar_monthly.
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: calendar
    0|MagicMir | No helper found for module: MMM-EasyPix.
    0|MagicMir | No helper found for module: currentweather.
    0|MagicMir | No helper found for module: weatherforecast.
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: MMM-DWD-WarnWeather
    0|MagicMir | No helper found for module: MMM-iFrame.
    0|MagicMir | No helper found for module: MMM-RandomPhoto.
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: MMM-Remote-Control
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: MMM-NetworkScanner
    0|MagicMir | No helper found for module: compliments.
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: MMM-Traffic
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: MMM-ModuleScheduler
    0|MagicMir | Initializing new module helper ...
    0|MagicMir | Module helper loaded: newsfeed
    0|MagicMir | All module helpers loaded.
    0|MagicMir | Starting server on port 8080 ... 
    0|MagicMir | You're using a full whitelist configuration to allow for all IPs
    0|MagicMir | Server started ...
    0|MagicMir | Connecting socket for: updatenotification
    0|MagicMir | Connecting socket for: calendar
    0|MagicMir | Starting node helper for: calendar
    0|MagicMir | Connecting socket for: MMM-DWD-WarnWeather
    0|MagicMir | MMM-DWD-WarnWeather helper started...
    0|MagicMir | Connecting socket for: MMM-Remote-Control
    0|MagicMir | Starting node helper for: MMM-Remote-Control
    0|MagicMir | Connecting socket for: MMM-NetworkScanner
    0|MagicMir | Starting module: MMM-NetworkScanner
    0|MagicMir | Connecting socket for: MMM-Traffic
    0|MagicMir | MMM-Traffic helper started ...
    0|MagicMir | Connecting socket for: MMM-ModuleScheduler
    0|MagicMir | Starting node helper for: MMM-ModuleScheduler
    0|MagicMir | Connecting socket for: newsfeed
    0|MagicMir | Starting module: newsfeed
    0|MagicMir | Sockets connected & modules started ...
    0|MagicMir | Launching application.
    0|MagicMir | Whoops! There was an uncaught exception...
    0|MagicMir | TypeError: Cannot read property 'replace' of undefined
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_helper.js:240:24
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:768:18
    0|MagicMir |     at Git. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:808:18)
    0|MagicMir |     at done (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    0|MagicMir | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    0|MagicMir | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    0|MagicMir | Whoops! There was an uncaught exception...
    0|MagicMir | TypeError: Cannot read property 'replace' of undefined
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_helper.js:240:24
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:768:18
    0|MagicMir |     at Git. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:808:18)
    0|MagicMir |     at done (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    0|MagicMir | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    0|MagicMir | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    0|MagicMir | Whoops! There was an uncaught exception...
    0|MagicMir | TypeError: Cannot read property 'replace' of undefined
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_helper.js:240:24
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:768:18
    0|MagicMir |     at Git. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:808:18)
    0|MagicMir |     at done (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    0|MagicMir | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    0|MagicMir | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    0|MagicMir | Whoops! There was an uncaught exception...
    0|MagicMir | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    0|MagicMir | TypeError: Cannot read property 'replace' of undefined
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_helper.js:240:24
    0|MagicMir |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:768:18
    0|MagicMir |     at Git. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:808:18)
    0|MagicMir |     at done (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1354:21)
    0|MagicMir |     at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1379:16)
    0|MagicMir |     at emitTwo (events.js:106:13)
    0|MagicMir |     at ChildProcess.emit (events.js:191:7)
    0|MagicMir |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    0|MagicMir | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    0|MagicMir | Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/***secret-stuff***/basic.ics - Interval: 300000
    0|MagicMir | Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics - Interval: 300000
    0|MagicMir | Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/***Secret-stuff***.calendar.google.com/public/basic.ics - Interval: 300000
    0|MagicMir | MMM-NetworkScanner received CONFIG
    0|MagicMir | MMM-ModuleScheduler is removing all scheduled jobs
    0|MagicMir | MMM-ModuleScheduler received CREATE_NOTIFICATION_SCHEDULE
    0|MagicMir | MMM-ModuleScheduler is scheduling REMOTE_ACTION using "30 6 * * *
    0|MagicMir | MMM-ModuleScheduler has scheduled REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send REMOTE_ACTION at Sun Jun 17 2018 06:30:00 GMT+0200 (CEST)
    0|MagicMir | MMM-ModuleScheduler is scheduling REMOTE_ACTION using "30 22 * * *
    0|MagicMir | MMM-ModuleScheduler has scheduled REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send REMOTE_ACTION at Sat Jun 16 2018 22:30:00 GMT+0200 (CEST)
    0|MagicMir | MMM-ModuleScheduler is scheduling REMOTE_ACTION using "0 2 * * SUN
    0|MagicMir | MMM-ModuleScheduler has scheduled REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send REMOTE_ACTION at Sun Jun 17 2018 02:00:00 GMT+0200 (CEST)
    0|MagicMir | MMM-ModuleScheduler is scheduling REMOTE_ACTION using "*/2 * * * *
    0|MagicMir | MMM-ModuleScheduler has scheduled REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send REMOTE_ACTION at Sat Jun 16 2018 14:54:00 GMT+0200 (CEST)
    0|MagicMir | MMM-ModuleScheduler is scheduling REMOTE_ACTION using "1-59/2 * * * *
    0|MagicMir | MMM-ModuleScheduler has scheduled REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send REMOTE_ACTION at Sat Jun 16 2018 14:53:00 GMT+0200 (CEST)
    0|MagicMir | Create new news fetcher for url: https://www.n-tv.de/rss - Interval: 300000
    0|MagicMir | Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
    0|MagicMir | MMM-ModuleScheduler is sending SEND_NOTIFICATION to REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send SEND_NOTIFICATION to REMOTE_ACTION at Sat Jun 16 2018 14:55:00 GMT+0200 (CEST) based on "1-59/2 * * * *"
    0|MagicMir | MMM-ModuleScheduler is sending SEND_NOTIFICATION to REMOTE_ACTION
    0|MagicMir | MMM-ModuleScheduler will next send SEND_NOTIFICATION to REMOTE_ACTION at Sat Jun 16 2018 14:56:00 GMT+0200 (CEST) based on "*/2 * * * *"
    
    
    

    Thanks for the hint with “npm start dev”
    As beeing a newbie to npm this was not known to me.
    Within the “console” tab I can see notifications send from MMM-ModuleScheduler on a minute bais as expected.
    Is there a chance to see the content of the payload?

    I also recognized several error mesages from MM. …
    Thanks, Peter


  • Module Developer

    @blup said in MMM-ModuleScheduler (how to use MMM-RemoteControl to HIDE/SHOW modules)?:

    {notification: ‘REMOTE_ACTION’, schedule: ‘0 6 * * MON-FRI’, payload: {action: “SHOW&module=module_15_MMM-Traffic”}},

    Hi Peter,

    1st Tip:
    I think your syntax in config.js is wrong.
    You use:

    {notification: 'REMOTE_ACTION', schedule: '0 6 * * MON-FRI', payload: {action: "SHOW&module=module_15_MMM-Traffic"}},
    

    and i think (didnt test it) it should be

    {notification: 'REMOTE_ACTION', schedule: '0 6 * * MON-FRI', payload: {action: "SHOW", module: "module_15_MMM-Traffic"}},
    

    2nd Tip:
    Have you checked the config options of MMM-Traffic, see this entries:

    showWeekend, startHr, endHr, hideOffHours
    

    AxLED


  • Project Sponsor

    @axled
    Thanks for the tipps. I’ll check that.

    Yes, I checked the config options in MMM-traffic, but if you use them and the module is hidden, you can’t use MMM-remoteControl to Show them again.
    Nevertheless I’ll try your information to see what happens.
    Thanks a lot. I’ll keep you updated! 🙂


  • Project Sponsor

    @axled
    Thanks a lot!
    Your syntax check did the trick. Now it works as expected!
    Many thanks!👍


  • Module Developer

    You are welcome, i had some visual basic skills in the past an trained myself javascript skills the last weeks, for modifying and writing own modules.
    I am sure in a few weeks, you are helping other MM Users to do some customizing on their mirrors.

    AxLED


Log in to reply