Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing pages doesn't work - bugs in the console #51

Closed
majdzik84 opened this issue Dec 8, 2020 · 9 comments
Closed

Changing pages doesn't work - bugs in the console #51

majdzik84 opened this issue Dec 8, 2020 · 9 comments

Comments

@majdzik84
Copy link

Thank you for the great module.
Unfortunately, I have a problem with page switching.

My config:

{
        module: 'MMM-pages',
        config: {
                modules:
                    [[ "weatherforecast", "newsfeed"],
                     [ "calendar", "compliments" ]],
                fixed: [],
				homePage: 0,
        }
    },

When I trigger the page change command I get errors and the page does not change.
http://192.168.2.200:8080/api/notification/PAGE_CHANGED?payload=1

image

@edward-shen
Copy link
Owner

Please post your full config, removing any personally identifiable information (including API keys).

Are you sure you have all those modules present in your config.js? This looks like an error from MagicMirror itself, rather than MMM-pages.

@majdzik84
Copy link
Author

majdzik84 commented Dec 8, 2020

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


var config = {
	//address: "localhost", 	// Address to listen on, can be:
	address: "0.0.0.0",
							// - "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 or empty, is "localhost"
	port: 8080,
	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
					// you must set the sub path here. basePath must end with a /
	ipWhitelist: [],
	//ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.2.98", "::ffff:192.168.2.199"], 	// Set [] to allow all IP addresses
															// 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"],

	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true

	language: "pl",
	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
	timeFormat: 24,
	units: "metric",
	// serverOnly:  true/false/"local" ,
	// local for armv6l processors, default
	//   starts serveronly and then starts chrome browser
	// false, default for all NON-armv6l devices
	// true, force serveronly mode, because you want to.. no UI on this device

	modules: [
		{
			module: "alert",
			config: {
				effect: "genie",}
		},
		{
			module: "updatenotification",
			position: "top_bar"
		},
		{
			module: "clock",
			position: "top_left"
		},
		{
			module: "calendar",
			header: "KALENDARZ",
			position: "top_left",
			config: {
                maximumEntries: 8,
                maximumNumberOfDays: 365,
                showLocation: false,
                maxTitleLength: 25,
                maxLocationTitleLength: 25,
                wrapEvents: true,
                wrapLocationEvents: false,
                maxTitleLines: 3,
                maxEventTitleLines: 3,
                animationSpeed: 2000,
                fade: false,
                fadePoint: 0.25,
                displayRepeatingCountTitle: true,
                dateFormat: "MMM Do HH:mm",
                dateEndFormat: "MMM Do HH:mm",
                //showEnd: true,
                fullyDayEventDateFormat: "MMM D",
                timeFormat: "absolute",
                getRelative: 6,
                urgency: 1,
                broadcastEvents: true,
                hidePrivate: false,
                sliceMultiDayEvents: false,
                nextDaysRelative: true,
				colored: true,
				calendars: [{
						symbol: "calendar-check-o",
						url: "xxxxics"
					},
{
						symbol: "birthday-cake",
						color: '#ebd234',
						url: "xxxcs"
					},
					
{						
						symbol: "calendar-times",
						color: "#d60000",
						url: "https://www.thunderbird.net/media/caldata/PolishHolidays.ics"
					}]
			}
		},
		{
			module: "compliments",
			position: "lower_third"
		},
		{
			module: "currentweather",
			disabled: true,
			position: "top_right",
			config: {
				location: "Potępa",
				locationID: "xx", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				appid: "xxx"
			}
		},
{
	module: "MMM-Currentweather-MQTT",
	disabled: false,
	position: "top_right",
	config: {
				location: "xxx",
				locationID: "xxx", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				appid: "xxx",
		roundTemp: false,
		degreeLabel: true,
		showWindDirection: true,
		showWindDirectionAsArrow: true,
		showHumidity: true,
		showFeelsLike: true,
		useBeaufort: false,
		useKMPHwind: true,
		logging: true,
		useWildcards: false,
		showIndoorTemperature: true,
		mqttServers: [
			{
				address: '192.168.2.98',  // Server address or IP address
				port: '1883',                // Port number if other than default
				user: 'xxx',
				password: 'xxx!',
				subscriptions: [             // for now, all seven values must be 
				                             // specified in the config, 
							     // even if they are not delivered and not displayed.
					{
						topic: 'mirror/pogoda/temperatura', // Topic to look for
						suffix: '°C',             // Displayed after the value
						decimals: 1,              // Round numbers to this number of decimals
						sortOrder: 10,            // sortOrder 10 has to contain the temperature 
						maxAgeSeconds: 18000,     // take Openweather value if older than 5 hours
					},
					{
						topic: 'mirror/pogoda/wilgotnosc',
						suffix: '%',
						decimals: 0,
						sortOrder: 20,            // sortOrder 210 has to contain the humidity
						maxAgeSeconds: 18000,
					},
					{
						topic: 'mirror/pogoda/temp_piec',
						suffix: '°C',
						decimals: 1,
						sortOrder: 30,            // sortOrder 30 has to contain the illumination
						maxAgeSeconds: 18000,
					},
					{
						topic: 'mirror/pogoda/wiatr',
						suffix: '°C',
						decimals: 1,
						sortOrder: 40,            // sortOrder 40 has to contain the wind speed
						maxAgeSeconds: 18000,
					},
					{
						topic: 'wetter/act-wind-dir',
						suffix: '°',
						decimals: 0,
						sortOrder: 50,            // sortOrder 50 has to contain the wind direction
						maxAgeSeconds: 18000,
					},
					{
						topic: 'wetter/raining',
						suffix: '',
						decimals: 0,
						sortOrder: 60,            // sortOrder 60 has to contain the boolean if its just raining
						maxAgeSeconds: 18000,
						conversions: [
							{ from: "true", to: "tak" },
							{ from: "false", to: "nie" }
						]
					},
					{
						topic: 'wetter/rain-today',
						suffix: '',
						decimals: 1,
						sortOrder: 70,            // sortOrder 70 has to contain the amount of rain today
						maxAgeSeconds: 18000,
					},

				]
			}
        ],
	}
},
		{
			module: "weatherforecast",
			disabled: false,
			position: "top_right",
			header: "Prognoza pogody",
			config: {
				lang: "pl",
				locationID: "xx", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				appid: "xxx",
				maxNumberOfDays: 5,
                                //colored: "false",
                                fade: false,
                                //fadePoint: 1,
                                showRainAmount: true,
                                scale: false,
								
			}
		},
{
    module: 'MMM-MQTT',
    position: 'top_right',
    header: '',
    config: {
        logging: false,
        useWildcards: false,
        mqttServers: [
            {
                address: '192.168.2.98',  // Server address or IP address
                port: '1883',          // Port number if other than default
                user: 'xxxx',          // Leave out for no user
                password: 'xxxx!',  // Leave out for no password
                subscriptions: [
                    {
                        topic: 'mirror/pogoda/powietrze', // Topic to look for
                        label: 'Powietrze jest', // Displayed in front of value
                        suffix: '',         // Displayed after the value
                        maxAgeSeconds: 350,    // Reduce intensity if value is older
                    },
                ]
            }
        ],
    }
},

	{
		module: 'MMM-iFrame-Ping',
		disabled: true,
		config: {
			// See 'Configuration options' for more information.
		url: "http://192.168.2.98:8123/magic-mirror/kamera", //url to display

			height:"100%", 
			width:"100%",
			autoRefresh: true, //set to false for video
			updateInterval: 1, //in min. Only if autoRefresh: true
			displayLastUpdate: false,
			width: "100%", // Optional. Default: 100%
			height: "100%", //Optional. Default: 100px
			scrolling: "no" 
			}
	},

{
        module: 'MMM-pages',
		disabled: true,
        config: {
                modules:
                    [[ "weatherforecast", "newsfeed"],
                     [ "calendar", "compliments" ]],
                fixed: [],
				homePage: 0,
        }
    },


{
  module: "MMM-NowPlayingOnSpotify",
  position: "center",
  disabled: false,
  config: {
	showCoverArt: true,
    clientID: "xxx",
    clientSecret: "xxx",
    accessToken: "xxx",
    refreshToken: "xxxxx"

  }
},
        {
		module: 'MMM-Screencast',
		position: 'bottom_center', // This position is for a hidden <div /> and not the screencast window
		config: {
			position: 'middle_center',
			x: 420,
			y: 420,
			height: 400,
			width: 600,
		}
        },
		{
			module: "newsfeed",
			position: "bottom_bar",
			config: {
				feeds: [
					{
						title: "Wiadomości TVN24",
						url: "https://www.tvn24.pl/najnowsze.xml"
					},
					{
						title: "Wiadomości TVN24",
						url: "https://www.tvn24.pl/najwazniejsze.xml"
					}
				],
				showSourceTitle: false,
				showPublishDate: true,
				broadcastNewsFeeds: true,
				broadcastNewsUpdates: true
			}
		},

{
      module: 'MMM-Remote-Control',
      config: {
      }
    },


{
    module: 'MMM-MQTT',
    position: 'bottom_right',
    header: '',
    config: {
        logging: false,
        useWildcards: false,
        mqttServers: [
            {
                address: '192.168.2.98',  // Server address or IP address
                port: '1883',          // Port number if other than default
                user: 'xxx',          // Leave out for no user
                password: 'xxx!',  // Leave out for no password
                subscriptions: [
                    {
                        topic: 'mirror/pogoda/temp_piec', // Topic to look for
                        label: 'Temp.ogród: ', // Displayed in front of value
                        suffix: '°C',         // Displayed after the value
                        maxAgeSeconds: 350,    // Reduce intensity if value is older

                    },

                    {
                        topic: 'mirror/pogoda/co2', // Topic to look for
                        label: 'CO2 w salonie: ', // Displayed in front of value
                        suffix: 'ppm',         // Displayed after the value
                        maxAgeSeconds: 350,    // Reduce intensity if value is older
                         colors: [             // Value dependent colors
                            { upTo: 500, value: "green", label: "green", suffix: "green" },
                            { upTo: 600, label: "yellow", value: "yellow", suffix: "yellow" },
                            { upTo: 900, label: "#ff4d00", value: "#ff4d00", suffix: "#ff4d00" },
                            { upTo: 2000, label: "red", value: "red", suffix: "red"  }, // The last one is used for higher values too
                        ],
                    },

                ]
            }
        ],
    }
},
{
    module: 'MMM-WiFiPassword',
    position: "bottom_right",
      config: {
        //See 'Configuration options' for more information.
        network: "xxx",
        password: "xx",
		header: "WiFi - Internet",
		qrSize: 80,
		showNetwork: false,
		showPassword: false,
		showAuthType: false,
      }
  },
{
		module: 'MMM-homeassistant-sensors',
		disabled: false,
		position: 'bottom_left',
		config: {
			host: "xxx",
			port: "xx",
			https: false,
			token: "xxxx",
			prettyName: false,
			stripName: false,
			debuglogging: false,
			updateInterval: 120000,
			values: [{
					sensor: "sensor.natalka_temperature",
					alertThreshold: 26,
					icons: [{
							"default": "thermometer"
						}
					]
				},{
					sensor: "sensor.alicja_temperature",
					alertThreshold: 26,
					icons: [{
							"default": "thermometer"
						}
					]
				},{
					sensor: "sensor.sypialnia_temperature",
					alertThreshold: 26,
					icons: [{
							"default": "thermometer"
						}
					]
				},
{
					sensor: "sensor.salon_temperatura",
					alertThreshold: 26,
					icons: [{
							"default": "thermometer"
						}
					]
				},
				{
					sensor: "binary_sensor.zamek_front",
					icons: [{
							"state_off": "lock",
							"state_on": "lock-open-variant"
						}
					]
				},
				{
					sensor: "binary_sensor.zamek_tyl",
					icons: [{
							"state_off": "lock",
							"state_on": "lock-open-variant"
						}
						
					]
				},
				{
					sensor: "binary_sensor.brama_wjazdowa",
					icons: [{
							"state_off": "gate",
							"state_on": "gate-open"
						}
					]
				}, 
				{
					sensor: "binary_sensor.brama_lewa",
					icons: [{
							"state_off": "garage",
							"state_on": "garage-open"
						}
					]
				},
				{
					sensor: "binary_sensor.brama_prawa",
					icons: [{
							"state_off": "garage",
							"state_on": "garage-open"
						}
					]
				},

			]

		}
	}, /*Tu*/
	


	]
};


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

@edward-shen
Copy link
Owner

By chance, do you have errors about your config file? On line 224-225 (right after the weatherforcast config), you have an extra }, -- can you try removing one of them?

@majdzik84
Copy link
Author

Sorry, I got things mixed up recently. I updated the code. You can check now ?

@edward-shen
Copy link
Owner

This looks like a problem with MMM-Remote-Control: Jopyth/MMM-Remote-Control#155. I would suggest asking there for a possible workaround instead. MMM-pages does strict type checking, so it won't accept string payloads.

To verify this, you should've gotten a log message as well in the console: [Pages]: received a notification to change to page ... where it mentions type string instead of type number.

I unfortunately don't know how others interface MMM-pages with MMM-Remote-Control, so I can't provide any help beyond this.

@majdzik84
Copy link
Author

Thank you for your help. I will then have to think about it and look for a solution.
image

@edward-shen
Copy link
Owner

Yeah, there you go. Since it's not related to MMM-pages now, I'm going to close this issue, but feel free to continue discussion if you find a workaround.

@majdzik84
Copy link
Author

majdzik84 commented Dec 12, 2020

"Actually, it's working as expected. You guys have to use /api/notification/PAGE_CHANGED/2 instead of sending a payload.
That actually parse the number into an integer, and send it as a payload. ;D" - Yeah !

@edward-shen
Copy link
Owner

Ah, glad to see it working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants