Modules reaction on notifications from other modules
MWel1977 last edited by MWel1977
I need yet again some help with modules.
I would like to add the pages and page indicator modules from Edward Shen to my mirror project but I don’t get the part were these modules should get a notification from the other modules. Well … I do get that for instance the clock module should be adjusted in some way… but I don’t get what file I should alter.
In his discription it’s stated:
This module responds to the notification PAGE_CHANGED. The payload should be an integer. Note that this has strict error checking, so “3” will not work, while 3 will. Also do note that to switch to page 1, you need to send 0 to the module. This uses a zero-based numbering system.
Let’s say that you want to change the indicator to page 3. In your code, you would write:
So I get I must add that last line to a file but I have no idea to what file.
Can someone help me out?
cowboysdude last edited by
You’re asking for blind help here…would be VERY helpful to see the code…
MWel1977 last edited by
@cowboysdude Hi there.
I know it’s a bit of blind help, but as a newbie I hoped someone here used this module and could help me out.
But if someone els could help me that’s fine to.
And posting the code is just the problem.
This is a module that allow me to put other modules on a different “page” and exclude modules so they show up on all the pages. The link to the github place is this: MMM-pages.
I need to add the following to the config.je file like we do for all other modules:
[[ “weatherforecast”, “newsfeed”],
[ “calendar”, “compliments” ]],
excludes: [“clock”, “currentweather”, “MMM-page-indicator”],
But in order for this to work (judging from the discribtion) I must add: "this.sendNotification(“PAGE_CHANGED”, 2);"
to “my code”…
What code is he talking about???
Is that the code of all the modules I want to be on a specific page? Is it the code of everymodule listed in the config.js file?
Can you see my problem (as a newbie to this)?
I know what I must add and what number to change for it to work…I just don’t know were this piece of code must be added.
I’m not asking for someone to write me the code so I can just copy and paste it and I’m done…I’ll learn nothing that way (and were is the fun in that??)!
I’m hoping someone can reply to this and say: “this.sendNotification(“PAGE_CHANGED”, 2); should be added to…” and I can take it up from there.
MMM-Pagescan work alone. It can rotate pages automatically by its timer included.
So, if you want just to activate
MMM-Pagesitself, you don’t need to consider anything else.
However, you have some trigger (like a H/W button?) and want to activate
MMM-Pagesby it, you should build your module and
this.sendNotification...will be used inside of that module.
Or there might be some module which has that feature already, then just use it. In this case, you don’t need to care about this.sendNotifi… at all.
Conclusion: Are you making your own module? Not the case, don’t care about “this.sendNoti… blah lbah…”. All you have to do is just modifying your
MWel1977 last edited by
Thanks for your explanation! This helps alot!
And no… I’n not building my own module… I’m to inexperienced for that. Maybe one day…
For now I’m just setting up a nice MagicMirror for in my livingroom for me and my family. And I found so many great modules here that they can’t fit all on one page.
But okay… I must check my config.js were I went wrong because the pages aren’t switching.
At the issue page of Edward someone issues a problem and put his config.js code there. I’ll check his motition there hoping I can spot the differance.
Thanks again for your help!
With kind regards,
(from the Netherlands)