@wfsaxton I had also faced this problem and have already built my own solution with React and Node, over the past year and continuing, as I had to learn all the front end technologies. It’s been a great project and I’ve included all touch features on it, and it’s currently running on a touch screen monitor in my living room, and visitors get awestruck when they see such a thing, and some have even said that I’m living in the future! 🤣 I am also including a boatload of features to it, which I will disclose elsewhere. This is not the place to sell such a thing, buddy.
Read the statement by Michael Teeuw here.
Posts made by aderoks
-
RE: Creating a modular dashboard platform similar to MM
-
RE: What comes into your mind when someone says "calendar"? 🤔
@BKeyport exactly my opinion. I really don’t get why people say “let me check my calendar” when they can say “let me see my availability or schedule”. The calendar is just the list of dates, arranged in a weekly and monthly grid, nothing more, nothing less.
-
RE: What comes into your mind when someone says "calendar"? 🤔
@sdetweil let me add on some more. 😆 What if you want to see the calendar for a different month or a different year altogether?
-
RE: What comes into your mind when someone says "calendar"? 🤔
@sdetweil how about animated backgrounds, like live wallpapers for mobile? Can we have them? Also, say, I want to change the fonts of the days and/or the colors, is that easy?
-
What comes into your mind when someone says "calendar"? 🤔
The reason I ask this is because, 9 times out of 10, I’ll see people talking about the tasks or activities which they have scheduled for the day, or the week. Like, I know there are meetings to attend for the busy executive, and children’s soccer games and dramas to attend for parents, and they should have reminders for them, but should the calendar on the wall be clogged up with lists of such tasks? Nowadays, I see implementations of Magic Mirror here which don’t show the monthly calendar at all, and instead, just a list of tasks for the day or the week and maybe the time and the weather. And that might be enough for you if you’re trying to be minimalistic. There are other digital wall calendars like dakboard which do show monthly calendars, but more often than not, each of the day boxes put the day number in the smallest font possible and full the remaining space with the tasks, and the whole thing looks crammed and ugly! Cant calendars just have a monthly view of the days with a nice pic above or in the background so that it also serves as a beautiful piece of home decor without being so severe and professional or crammed to the teeth with tasks? What are your opinions?
-
Customising MMM-Wallpaper to remotely control wallpapers
I don’t know whether anyone has already done this, but just wanted to share with you something which I have created.
So, I have been using the MMM-Wallpaper module and changing up the sources to find some other wallpapers and I found that I liked the firetv source best. I tried reddit sources, but those tended to contain many personal photos and not quality wallpapers. But after a few months, I found that only the same wallpapers were being repeated, so I dug into the code, and found, as of course, many of you perhaps know as well, there is a fixed cache of firetv wallpapers which are cycled through, and even though the list is long, it’s still finite.
So I started thinking about how can I get more wallpapers for my magic mirror. I knew that there is one custom option in the module which would let me use my own images through a specific folder that I specify in the config. So I started creating a background application that will scrape a wallpaper website, download many wallpapers into a particular location and then, as the config is pointing to that folder, the wallpapers would be new.
But that would mean that I had to go into my raspberry Pi, run the script manually, perhaps changing the wallpaper genre as well to get new wallpapers. So, I made a basic Android app as well with just a drop-down and a submit button. The app, when started, would query my background application in the pi for the list of genres in the site, and populate them in the drop-down. Then, when I select a genre and click submit, it automatically scrapes that particular genre in the wallpaper site, downloads the wallpapers and in the next refresh cycle, the new wallpapers would appear.
How do you like my concept?
-
RE: How to send notification to module via external REST API call?
@sdetweil @mumblebaj Thanks so much for your responses. I have been trying to implement them. However, I am facing some obstacles, and at every step, I am feeling that a deeper understanding of the Magic Mirror framework itself is required which I am not being able to find anywhere. Let me start with my problems:
-
I am using a headless setup with my Raspberry Pi 4B, so my magic mirror is being displayed onto the monitor with which it’s directly connected, but I am doing all the development by opening a remote connection to it from another PC. So I am not understanding which browser window console would give me the output, since the Chromium window which I have open in this remote desktop is perhaps, surely not the one in which the Magic Mirror is running, isn’t it?
-
I tried giving the export ELECTRON_ENABLE_LOGGING=true code in the module.js, outside of the Module.register statement, since I felt that inside it, there are only functions and not variable declarations. The module refused to even load.
-
I considered that as you have said, let me consider that the notification is actually being sent to my main module.js file, even though I am not being able to see any output. Now what I actually want to do is refresh the calendar monthly view (I have taken this implementation: https://github.com/KirAsh4/calendar_monthly) with a month that the user will pass in from the REST API call. Here, I am facing the challenge that I don’t really know how the getDom() and refreshDom() functions work and if I can parameterize them, or they are overriden methods with a fixed signature. So, understandably, when I tried to just lamely copy the getDom method into a new one and parameterized it with the passed input and tried to call it from the socketNotificationReceived() method in module.js file to refresh the output to the desired month, nothing happened. Now of course, I don’t even know whether the notification even reached the module.js, but I am assuming it did, based on what all you have said.
This all is leading me to understand that I need to know more about what underlying JS framework Magic Mirror uses for its development. For instance, when I do Module.register(), what am I actualy doing? Are the functions inside it being made visible for external access? If so, how can I access them? I tried to use MMM-NotificationTrigger’s webhook functionality to achieve my end (https://github.com/MMRIZE/MMM-NotificationTrigger#usewebhook), however, after using MMM-Api (https://github.com/juzim/MMM-Api), I found that whatever custom function I am writing within the Module.register() code block is not being exposed as actions, so that if I try to fire a notification to it using MMM-NotificationTrigger, it probably isn’t collecting it. Which is why I moved to the current approach of exposing my own REST endpoints in node_helper.js and trying to collect data from there. However, now also, I am not being able to achieve my expectation. On the other hand, I now have a stream of “Received date_sent: [object Object]” messages being printed to the console from the socketNotificationReceived function of node_helper.js from the very startup of the application. What mechanism is responsible for sending these notifications? All these are questions which I haven’t found satisfactory answers in the forum, maybe because people already know how this framework works. If so, please point me to the framework I should learn, and I would get to learning it. But please also suggest ways for me to fix these problems in the meantime so that I can get my functionality up and running.
Sorry for the long response.
Thank you.
-
-
RE: How to send notification to module via external REST API call?
@sdetweil Thank you for the response. I tried your suggested approach. My code looks like the following now:
node_helper.js
const NodeHelper = require("node_helper") const bodyParser = require("body-parser") const exec = require('child_process').exec module.exports = NodeHelper.create({ start: function() { var self = this; this.expressApp.use(bodyParser.json()) this.expressApp.use(bodyParser.urlencoded({extended: true})) this.expressApp.post("/date_sent", (req, res) => { console.log("datePost?", req.body); self.sendSocketNotification("date_sent", req.body); res.status(200).send({status: 200}) }); console.log("Starting node helper for: " + this.name); }, socketNotificationReceived: function(noti, payload) { var self = this; if (noti == "date_sent") { console.log("Received date_sent: " + payload); self.sendSocketNotification("date_sent", payload); } } })
module.js
socketNotificationReceived: function (notification, payload) { console.log("Receiving notification from MMM-Test"); if(notification === "date_sent") { console.log("Received"); // set dataNotification date_sent(payload); //this.dataNotification = payload; //this.updateDom(); } }, date_sent: function(payload) { console.log("Date received: " + payload); }
Now, I am seeing that whenever I restart magic mirror, I am having a constant stream of logs with the following line:
Received date_sent: [object Object]
This is coming from the socketNotificationReceived method of the node_helper.js itself. I am trying to send the notification again from there, but the socketNotificationReceived method in the module.js still doesn’t print anything.
-
How to send notification to module via external REST API call?
Re: [Building my first module](using MMM-API) I tried following the module which @PTcrusher has created, i.e. MMM-Piggybank, but still could not understand how the main module.js socketNotificationReceived() method gets called when a notification is sent from the node_helper.js. In my case, I tried sending a socket notification in node_helper.js right from the POST block:
this.expressApp.post("/date_sent", (req, res) => { //console.log("datePost?", req.body); this.sendSocketNotification("date_sent", req.body); res.status(200).send({status: 200}) });
and trying to receive it in module.js:
socketNotificationReceived: function (notification, payload) { console.log("Receiving notification from MMM-Test"); if(notification === "date_sent") { console.log("Received"); // set dataNotification date_sent(payload); //this.dataNotification = payload; //this.updateDom(); } }
but to no avail. Nothing ever gets printed. If I uncomment the console.log() in the node_helper.js POST method, I can see that the POST request is received fine and well, but the socket notification is lost. Please help me.