Read the statement by Michael Teeuw here.
Text per week
-
Does anyone know if there is a module that let’s you show a different text each week? My son is learning letters in school and each week they have a certain letter, like this:
week 38: R
week 39: E
week 40: P
…My though was to show this week’s letter on my mirror.
-
@retroflex
As far as I know, there is nothing like that. :D
But I think it could be easily developed.
withmoment.jslibrary, you can easily get the order of the current week.const letterOfWeek = ["", "", "A", ... "R", "E", "P", ...], var curWeekNumber = moment().week() //will return 1~52. You can use `isoWeek()` also. var letterOfThisWeek = letterOfWeek[curWeekNumber]This is just an idea, anyway, I believe you can make a simple module to display this.
-
@retroflex
Here. not fully tested.Module.register("letterOfWeek",{ defaults: { letterOfWeek: { "default": "?", "38": "A", "39": "B", "40": "C", }, updateInterval: 1000*60*60*3, // refresh per 3 hour. }, getScripts: function() { return ["moment.js"] }, getStyles: function() { return ["letterOfWeek.css"] // You need to parepare your own css. }, getDom: function() { var getLetter = ()=> { var thisWeek = moment().week() var letter = (this.config.letterOfWeek.hasOwnProperty(thisWeek)) ? this.config.letterOfWeek[thisWeek] : this.config.letterOfWeek["default"] return letter } var dom = document.createElement("div") dom.innerHTML = getLetter() dom.classList.add("letterOfWeek") return dom }, notificationReceived: function(noti, payload) { if (noti == "DOM_OBJECTS_CREATED") { this.refresh() } }, refresh: function() { this.updateDom() setTimeout(()=>{ this.refresh() }, this.config.updateInterval) } }) -
@Sean Thanks a lot! My thought was to make a module, but wanted to check first if one existed. And now you did the work for me :) I will try it out tonight. Maybe even upload it so others can download it.
-
So a lot later I finally managed to make a module out of this:
https://github.com/retroflex/MMM-TextPerWeekThanks again @Sean !
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login