ianperrin / MMM-ModuleScheduler

A MagicMirror helper module to schedule the display of modules and sending of notifications.
MIT License
99 stars 13 forks source link

MMM-ModuleScheduler stops working if MMM-PIR is active #14

Closed flo269 closed 3 years ago

flo269 commented 6 years ago

Hi,

I need some help here please :-)

I’m on latest master and everything works fine. BUT when I activate MMM-PIR, one of my MMM-ModuleScheduler schedules stops working. When I comment out MMM-PIR from the config everything works as expected.

Could someone maybe point me in a direction of where to dig in deeper to find out whats going wrong?

Thanks!!

Cheers Flo

Here is my config:

/* Magic Mirror Config Sample
 *
 * By Michael Teeuw http://michaelteeuw.nl
 * MIT Licensed.
 *
 * For more information how you can configurate this file
 * See https://github.com/MichMich/MagicMirror#configuration
 *
 */

var config = {
    address: "", // Address to listen on, can be:
                          // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
                          // - another specific IPv4/6 to listen on a specific interface
                          // - "", "0.0.0.0", "::" to listen on any interface
                          // Default, when address config is left out, is "localhost"
    port: 8080,
    ipWhitelist: [],  // Set [] to allow all IP addresses
                 //["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:10.10.10.51"],                                          // or add a specific IPv4 of 192.168.1.5 :
                                                           // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                                                           // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                                                           // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
    language: "en",
    timeFormat: 24,
    units: "metric",
    electronOptions: {
        fullscreen: true,
      },

    modules: [
        {
            module: "alert"
        },
        {
      module: 'MMM-Remote-Control'
    },
        {
            module: 'MMM-ModuleScheduler',
            config: {
                    notification_schedule: [
                    // RESTART THE MAGICMIRROR PROCESS AT 2am EVERY day
                    {notification: 'REMOTE_ACTION', schedule: '0 2 * * *', payload: {action: "RESTART"}},
                    ],
                    // SHOW MODULES WITH THE CLASS 'go2work_scheduler' AT 06:00 AND HIDE AT 10:00 EVERY DAY
                    global_schedule: {from: '0 6 * * *', to: '0 10 * * *', groupClass: 'go2work_scheduler' }
                  },
    },
        {
            module: "updatenotification",
            position: "top_bar"
        },
        {
            module: "clock",
            position: "top_left"
        },
        {
          module: 'worldclock',
          position: 'top_left', // This can be any of the regions, best results in top_left or top_right regions
          config: {
            timeFormat: 'HH:mm', //defined in moment.js format()
            style: 'top', //predefined 4 styles; 'top', 'left','right','bottom'
            clocks: [
              {
                title: "Bali", // Too long title could cause ugly text align.
                timezone: "Asia/Makassar", //When omitted, Localtime will be displayed. It might be not your purporse, I bet.
                flag: "id",
              },
                ]
            }
        },
        {
            module: "calendar",
            header: "Termine",
            position: "top_left",
            config: {
              displaySymbol: false,
                calendars: [
                    {
                        url: '',
                        auth: {
                            user: '',
                            pass: '',
                            method: 'basic'
                              }
                    },
                    {
                        url: '',
                        auth: {
                                user: '',
                                pass: ''
                                method: 'basic'
                                }
                    },
                ],
            }
        },
        {
            module: "calendar",
            header: "",
            position: "top_left",
            config: {
              maximumEntries: "3",
                displaySymbol: false,
                calendars: [
                    {
                        url: '',
                        symbol: 'trash',
                        auth: {
                                user: '',
                                pass: '',
                                method: 'basic'
                                }
                    },
                ],
            }
        },
        {
            module: "currentweather",
            position: "top_right",
            config: {
                location: "",
                locationID: "",  //ID from http://www.openweathermap.org/help/city_list.txt
                appid: ""
            }
        },
        {
            module: "weatherforecast",
            position: "top_right",
            header: "Weather Forecast",
            config: {
                location: "",
                locationID: "",  //ID from http://www.openweathermap.org/help/city_list.txt
                appid: ""
            }
        },
        {
            module: "newsfeed",
            position: "bottom_bar",
            config: {
                feeds: [
                    {
                        title: "Der Postillion",
                        url: "http://feeds.feedburner.com/blogspot/rkEL?format=xml"
                    },
                    {
                        title: "Tagesschau",
                        url: "http://www.tagesschau.de/xml/rss2"
                    }
                ],
                showSourceTitle: true,
                showPublishDate: true
            }
        },
        {
    module: 'MMM-PIR',
    position: 'bottom_center',
    config: {
        sensorPin: 22,
        delay: 30000,
        turnOffDisplay: true,
        showCountdown: false
            }
        },
        {
            module: 'MMM-DWD-WarnWeather',
            position: 'top_right',
            config: {
                region: '',
                changeColor: true,
                minutes: false,
                displayRegionName: true,
                interval: 10 * 60 * 1000, // every 10 minutes
                longversion: true,
                loadingText: 'Warnungen werden geladen...',
                noWarningText: 'Keine Warnungen'
                }
        },
    {
        module: 'MMM-DWD-WarnWeather',
        position: 'top_right',
            classes: 'test_scheduler',
        config: {
                region: '',
        changeColor: true,
        minutes: false,
        displayRegionName: true,
        interval: 10 * 60 * 1000, // every 10 minutes
        loadingText: 'Warnungen werden geladen...',
        noWarningText: 'Keine Warnungen'
        }
    },
        {
        module: 'MMM-GoogleMapsTraffic',
        position: 'top_left',
            classes: 'scheduler',
        config: {
                module_schedule: {from: '0 6 * * *', to: '0 10 * * *' },
            key: '',
            lat: ,
            lng: ,
            height: '300px',
            width: '300px'
                }
    },
        {
            module: 'MMM-rfacts',
            position: 'bottom_bar'
        },
        { module: 'MMM-NiceThings',
            position: 'lower_third'
      },
        {
            module: 'DailyXKCD',
            position: 'lower_third',
            config: {
                invertColors: true,
                randomComic: true,
                titleFont: 'small',
                title: true,
                altText: false
                }
        },
    ]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}
'''

Here is the pm2 out log:

Starting MagicMirror: v2.3.1
Loading config ...
Loading module helpers ...
No helper found for module: alert.
Initializing new module helper ...
Module helper loaded: MMM-Remote-Control
Initializing new module helper ...
Module helper loaded: MMM-ModuleScheduler
Initializing new module helper ...
Module helper loaded: updatenotification
No helper found for module: clock.
No helper found for module: worldclock.
Initializing new module helper ...
Module helper loaded: calendar
No helper found for module: currentweather.
No helper found for module: weatherforecast.
Initializing new module helper ...
Module helper loaded: newsfeed
Initializing new module helper ...
Module helper loaded: MMM-PIR
Initializing new module helper ...
Module helper loaded: MMM-DWD-WarnWeather
No helper found for module: MMM-GoogleMapsTraffic.
Initializing new module helper ...
Module helper loaded: MMM-rfacts
Initializing new module helper ...
Module helper loaded: MMM-NiceThings
Initializing new module helper ...
Module helper loaded: DailyXKCD
All module helpers loaded.
Starting server on port 8080 ... 
You're using a full whitelist configuration to allow for all IPs
Server started ...
Connecting socket for: MMM-Remote-Control
Starting node helper for: MMM-Remote-Control
Connecting socket for: MMM-ModuleScheduler
Starting node helper for: MMM-ModuleScheduler
Connecting socket for: updatenotification
Connecting socket for: calendar
Starting node helper for: calendar
Connecting socket for: newsfeed
Starting module: newsfeed
Connecting socket for: MMM-PIR
Starting module helper: MMM-PIR
Connecting socket for: MMM-DWD-WarnWeather
MMM-DWD-WarnWeather helper started...
Connecting socket for: MMM-rfacts
Starting module: MMM-rfacts
Connecting socket for: MMM-NiceThings
Starting node_helper for: MMM-NiceThings
Connecting socket for: DailyXKCD
Starting node helper: DailyXKCD
Sockets connected & modules started ...
Launching application.
MMM-ModuleScheduler is removing all scheduled jobs
MMM-ModuleScheduler received CREATE_NOTIFICATION_SCHEDULE
MMM-ModuleScheduler is scheduling REMOTE_ACTION using "0 2 * * *
MMM-ModuleScheduler has scheduled REMOTE_ACTION
MMM-ModuleScheduler will next send REMOTE_ACTION at Mon Apr 23 2018 02:00:00 GMT+0200 (CEST)
Create new calendar fetcher for url: - Interval: 300000
Create new calendar fetcher for url: - Interval: 300000
Create new calendar fetcher for url:  - Interval: 300000
Create new news fetcher for url: http://feeds.feedburner.com/blogspot/rkEL?format=xml - Interval: 300000
Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
I made this website for you.
Notification: GET_COMIC Payload: [object Object]
ianperrin commented 6 years ago

@flo269 -

Can you double check your config file is valid? I suspect you have edited it to post here, but there are a couple of syntax errors in the sample above. e.g. missing lat/long values in the MMM-GoogleMapsTraffic module and missing a comma after the pass in the calendar module.

After this, can you check whether there are any errors in the browser console?

flo269 commented 6 years ago

Hi, thanks for getting back to me!

Yes, you're right: I edited the config before posting. I validated the unedited config with jshint.com and everything is fine. Plus MM does start up.

Below is the output of the browser console. I only see few errors which (to my unwitting eyes) don't seem to be related to neither MMM-ModuleScheduler nor MMM-PIR. Please prove me wrong! ;-)

localhost-1524918831553.log

Initializing MagicMirror.
Loading core translation file: translations/en.json
Loading core translation fallback file: translations/en.json
Load script: modules/default/alert//alert.js
Module registered: alert
Bootstrapping module: alert
Load script: modules/default/alert/classie.js
Load script: modules/default/alert/modernizr.custom.js
Load script: modules/default/alert/notificationFx.js
Scripts loaded for: alert
Load stylesheet: modules/default/alert/ns-default.css
Styles loaded for: alert
alert - Load translation fallback: translations/en.json
Translations loaded for: alert
Load script: modules/MMM-Remote-Control//MMM-Remote-Control.js
Check MagicMirror version for module 'MMM-Remote-Control' - Minimum version:  2.1.0 - Current version: 2.3.1
Version is ok!
Module registered: MMM-Remote-Control
Bootstrapping module: MMM-Remote-Control
Scripts loaded for: MMM-Remote-Control
Load stylesheet: modules/MMM-Remote-Control/remote-control.css
Styles loaded for: MMM-Remote-Control
Translations loaded for: MMM-Remote-Control
Load script: modules/MMM-ModuleScheduler//MMM-ModuleScheduler.js
Check MagicMirror version for module 'MMM-ModuleScheduler' - Minimum version:  2.0.0 - Current version: 2.3.1
Version is ok!
Module registered: MMM-ModuleScheduler
Bootstrapping module: MMM-ModuleScheduler
Scripts loaded for: MMM-ModuleScheduler
Styles loaded for: MMM-ModuleScheduler
Translations loaded for: MMM-ModuleScheduler
Load script: modules/default/updatenotification//updatenotification.js
Module registered: updatenotification
Bootstrapping module: updatenotification
Scripts loaded for: updatenotification
Styles loaded for: updatenotification
Translations loaded for: updatenotification
Load script: modules/default/clock//clock.js
Module registered: clock
Bootstrapping module: clock
Load script: vendor/node_modules/moment/min/moment-with-locales.js
Load script: vendor/node_modules/moment-timezone/builds/moment-timezone-with-data.js
Scripts loaded for: clock
Load stylesheet: modules/default/clock/clock_styles.css
Styles loaded for: clock
Translations loaded for: clock
Load script: modules/worldclock//worldclock.js
Module registered: worldclock
Bootstrapping module: worldclock
File already loaded: moment.js
File already loaded: moment-timezone.js
Scripts loaded for: worldclock
Load stylesheet: modules/worldclock/worldclock.css
Styles loaded for: worldclock
Translations loaded for: worldclock
Load script: modules/default/calendar//calendar.js
Module registered: calendar
Bootstrapping module: calendar
File already loaded: moment.js
Scripts loaded for: calendar
Load stylesheet: modules/default/calendar/calendar.css
Load stylesheet: vendor/node_modules/font-awesome/css/font-awesome.min.css
Styles loaded for: calendar
Translations loaded for: calendar
Bootstrapping module: calendar
File already loaded: moment.js
Scripts loaded for: calendar
File already loaded: calendar.css
File already loaded: font-awesome.css
Styles loaded for: calendar
Translations loaded for: calendar
Load script: modules/default/currentweather//currentweather.js
Module registered: currentweather
Bootstrapping module: currentweather
File already loaded: moment.js
Scripts loaded for: currentweather
Load stylesheet: vendor/node_modules/weathericons/css/weather-icons.css
Load stylesheet: modules/default/currentweather/currentweather.css
Styles loaded for: currentweather
Translations loaded for: currentweather
Load script: modules/default/weatherforecast//weatherforecast.js
Module registered: weatherforecast
Bootstrapping module: weatherforecast
File already loaded: moment.js
Scripts loaded for: weatherforecast
File already loaded: weather-icons.css
Load stylesheet: modules/default/weatherforecast/weatherforecast.css
Styles loaded for: weatherforecast
Translations loaded for: weatherforecast
Load script: modules/default/newsfeed//newsfeed.js
Module registered: newsfeed
Bootstrapping module: newsfeed
File already loaded: moment.js
Scripts loaded for: newsfeed
Styles loaded for: newsfeed
Translations loaded for: newsfeed
Load script: modules/MMM-PIR//MMM-PIR.js
Module registered: MMM-PIR
Bootstrapping module: MMM-PIR
File already loaded: moment.js
Scripts loaded for: MMM-PIR
Load stylesheet: modules/MMM-PIR/mmm-pir-style.css
Styles loaded for: MMM-PIR
MMM-PIR - Load translation fallback: translations/en.json
Translations loaded for: MMM-PIR
Load script: modules/MMM-DWD-WarnWeather//MMM-DWD-WarnWeather.js
Module registered: MMM-DWD-WarnWeather
Bootstrapping module: MMM-DWD-WarnWeather
File already loaded: moment.js
Scripts loaded for: MMM-DWD-WarnWeather
Load stylesheet: modules/MMM-DWD-WarnWeather/MMM-DWD-WarnWeather.css
Styles loaded for: MMM-DWD-WarnWeather
Translations loaded for: MMM-DWD-WarnWeather
Bootstrapping module: MMM-DWD-WarnWeather
File already loaded: moment.js
Scripts loaded for: MMM-DWD-WarnWeather
File already loaded: MMM-DWD-WarnWeather.css
Styles loaded for: MMM-DWD-WarnWeather
Translations loaded for: MMM-DWD-WarnWeather
Load script: modules/MMM-GoogleMapsTraffic//MMM-GoogleMapsTraffic.js
Module registered: MMM-GoogleMapsTraffic
Bootstrapping module: MMM-GoogleMapsTraffic
Scripts loaded for: MMM-GoogleMapsTraffic
Styles loaded for: MMM-GoogleMapsTraffic
Translations loaded for: MMM-GoogleMapsTraffic
Load script: modules/MMM-rfacts//MMM-rfacts.js
Module registered: MMM-rfacts
Bootstrapping module: MMM-rfacts
Scripts loaded for: MMM-rfacts
Load stylesheet: modules/MMM-rfacts/MMM-rfacts.css
Styles loaded for: MMM-rfacts
MMM-rfacts - Load translation fallback: translations/en.json
Translations loaded for: MMM-rfacts
Load script: modules/MMM-NiceThings//MMM-NiceThings.js
Module registered: MMM-NiceThings
Bootstrapping module: MMM-NiceThings
File already loaded: moment.js
Scripts loaded for: MMM-NiceThings
Load stylesheet: modules/MMM-NiceThings/MMM-NiceThings.css
Styles loaded for: MMM-NiceThings
Translations loaded for: MMM-NiceThings
Load script: modules/DailyXKCD//DailyXKCD.js
Module registered: DailyXKCD
Bootstrapping module: DailyXKCD
File already loaded: moment.js
Scripts loaded for: DailyXKCD
Load stylesheet: modules/DailyXKCD/xkcd.css
Styles loaded for: DailyXKCD
Translations loaded for: DailyXKCD
Load stylesheet: css/custom.css
Starting module: alert
Starting module: MMM-Remote-Control
Starting module: MMM-ModuleScheduler
Start updatenotification
Starting module: clock
Starting module: calendar
Starting module: currentweather
Starting module: weatherforecast
Starting module: newsfeed
MMM-PIR is started!
Starting module: MMM-GoogleMapsTraffic
Starting module: MMM-rfacts
Starting module: MMM-NiceThings
Object
Starting module: DailyXKCD
XKCD: Getting comic.
All modules started!
clock received a system notification: ALL_MODULES_STARTED
calendar received a system notification: ALL_MODULES_STARTED
newsfeed - received notification: ALL_MODULES_STARTED
newsfeed - unknown notification, ignoring: ALL_MODULES_STARTED
MMM-DWD-WarnWeather received a system notification: ALL_MODULES_STARTED
MMM-GoogleMapsTraffic received a system notification: ALL_MODULES_STARTED
MMM-rfacts received a system notification: ALL_MODULES_STARTED
MMM-NiceThings received a system notification: ALL_MODULES_STARTED
clock received a system notification: MODULE_DOM_CREATED
calendar received a system notification: MODULE_DOM_CREATED
newsfeed - received notification: MODULE_DOM_CREATED
newsfeed - unknown notification, ignoring: MODULE_DOM_CREATED
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.(…)
MMM-DWD-WarnWeather received a system notification: MODULE_DOM_CREATED
MMM-GoogleMapsTraffic received a system notification: MODULE_DOM_CREATED
MMM-rfacts received a system notification: MODULE_DOM_CREATED
MMM-NiceThings received a system notification: MODULE_DOM_CREATED
currentweather is resumed.
MMM-Remote-Control received a module notification: CURRENTWEATHER_DATA from sender: currentweather
clock received a module notification: CURRENTWEATHER_DATA from sender: currentweather
calendar received a module notification: CURRENTWEATHER_DATA from sender: currentweather
newsfeed - received notification: CURRENTWEATHER_DATA
newsfeed - unknown notification, ignoring: CURRENTWEATHER_DATA
MMM-DWD-WarnWeather received a module notification: CURRENTWEATHER_DATA from sender: currentweather
MMM-GoogleMapsTraffic received a module notification: CURRENTWEATHER_DATA from sender: currentweather
MMM-rfacts received a module notification: CURRENTWEATHER_DATA from sender: currentweather
MMM-NiceThings received a module notification: CURRENTWEATHER_DATA from sender: currentweather
You complete me.
Failed to load resource: the server responded with a status of 401 (Unauthorized)
weatherforecast: Your AppID does not support long term forecasts. Switching to fallback endpoint.
WARNINGS_DATA
Object
WARNINGS_DATA
MMM-Remote-Control received a module notification: CALENDAR_EVENTS from sender: calendar
clock received a module notification: CALENDAR_EVENTS from sender: calendar
calendar received a module notification: CALENDAR_EVENTS from sender: calendar
newsfeed - received notification: CALENDAR_EVENTS
newsfeed - unknown notification, ignoring: CALENDAR_EVENTS
MMM-DWD-WarnWeather received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-GoogleMapsTraffic received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-rfacts received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-NiceThings received a module notification: CALENDAR_EVENTS from sender: calendar
WARNINGS_DATA
Object
weatherforecast is resumed.
A shrimp's heart is in its head.
MMM-Remote-Control received a module notification: CALENDAR_EVENTS from sender: calendar
clock received a module notification: CALENDAR_EVENTS from sender: calendar
calendar received a module notification: CALENDAR_EVENTS from sender: calendar
newsfeed - received notification: CALENDAR_EVENTS
newsfeed - unknown notification, ignoring: CALENDAR_EVENTS
MMM-DWD-WarnWeather received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-GoogleMapsTraffic received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-rfacts received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-NiceThings received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-Remote-Control received a module notification: CALENDAR_EVENTS from sender: calendar
clock received a module notification: CALENDAR_EVENTS from sender: calendar
calendar received a module notification: CALENDAR_EVENTS from sender: calendar
newsfeed - received notification: CALENDAR_EVENTS
newsfeed - unknown notification, ignoring: CALENDAR_EVENTS
MMM-DWD-WarnWeather received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-GoogleMapsTraffic received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-rfacts received a module notification: CALENDAR_EVENTS from sender: calendar
MMM-NiceThings received a module notification: CALENDAR_EVENTS from sender: calendar
https://imgs.xkcd.com/comics/front_door.png
ianperrin commented 6 years ago

@flo269

I'd be inclined to agree, but let's see what we can find. What is the source of the errors?

The browser console you should also show the name of the file and line number for the error. e.g. in Chrome, it looks like this:

screen shot 2018-04-28 at 16 29 44

Also, you may wish to temporarily set broadcastEvents: false, for the calendar module - this will remove the logs relating to CALENDAR_EVENTS

flo269 commented 6 years ago

@ianperrin I have now disabled broadcastEvents. Here are screenshots of the log:

screen shot 2018-04-28 at 17 53 19 screen shot 2018-04-28 at 17 53 36 screen shot 2018-04-28 at 17 53 47 screen shot 2018-04-28 at 17 54 02 screen shot 2018-04-28 at 17 54 21 screen shot 2018-04-28 at 17 55 57 screen shot 2018-04-28 at 17 56 20 screen shot 2018-04-28 at 17 56 34 screen shot 2018-04-28 at 17 56 52

ianperrin commented 6 years ago

If you comment out each module in turn, starting the mirror each time, do the errors go away? If so, which module was commented when the error disappears?

ReD1470 commented 6 years ago

BUMP?!? have a similar problem. when using the schedule module, the whole display freezes. it does not update anymore. also using the PIR module. the screen goes on an doff , probably initiated by the PIR. iam now testing, have disabled the pir module and activated the schedule module

ianperrin commented 3 years ago

As it is sometime since this issue was last commented on, I'm going to close it.

Please feel free to re-open the issue and add further comments. Thanks.