Thanks so much @strawberry-3.141, that’s just what I needed to set me in the right direction. I’ll do a bit of reading and follow this approach,. I’ll be sure to post how I get on :)
Read the statement by Michael Teeuw here.
Posts
-
RE: Parsing stdout into a module for display
-
Parsing stdout into a module for display
Is anyone able to provide an example of a simple module that can parse/display a printf output on the mirror? I’m trying to do this but really struggling to understand how to. I can use fprintf to get to a file but that’s not much help to me either.
Ideally I would like to printf a value that will then be displayed in my module on the mirror…
-
RE: MMM-Hue
Not directly - I think it’d be a lot of work and as you say, would need a way of interfacing with the mirror. At the end of all that you could just use The Hue/Elgato Eve/Siri app to do the same thing.
What I wondered though, was if something like MMM-Schedule was installed, it’d be really easy to put a schedule in the config.js to turn specific lights on and off on certain schedules - it could send the notification schedule which MMM-Hue could react to. It’d mean you/the mirror could schedule the lighting schemes automatically to run while you were away from home.
If MMM-Hue could react to a HUE_LIGHT_ON and HUE_LIGHT_OFF notification, perhaps with a light-ID and Brightness value as the payload, that’d do the trick wouldn’t it?
A scheduling GUI would be uber-cool, but hard-coding the config.js would be enough for most, I’d have thought…
It’s on my (very long) list of things to have a go at, if I get a chance :)
-
RE: MMM-Hue
Hi @Mitchfarino, I was just wondering if you’d considered extending the module to control lighting schedules?
It suddenly struck me that as the mirror is always on and stays in the house, it might be very really cool (not to mention useful when you’re away) to have a capability in the module to turn on/off dim lights on a hardcoded schedule or time/day combo.
From there it could even be a short hop to link it up the the MMM-RemoteControl module, to set schedules remotely.
-
RE: MMM-forecast-io -- Localized up to the minute weather
Hi @dmcinnes, thank you for sharing an awesome module. It’s fantastic - the first one I installed and I think it must be the only one I haven’t swapped out since :)
Is there any chance of having a precipitation/temperature graph like the one from Jangellx’s variant of @MichMich’s MagicMirror1, which could be swapped out for the current precipitation graph?

The bulk of the javascript looks to be in the bottom half of this code: GitHub, uses d3 and d3min but it’s completely beyond me how to Frankenstein the code together…
It’d give a superb optional look to a lovely module!
-
RE: Airplay 'Now Playing' module - help badly needed
Hmm, using a child process doesn’t return anything either :(
The shairport metadata reader is a compiled C program which uses printf to return the metadata to the console:
pi@raspberrypi:~/fifo-js $ ~/shairport-sync-metadata-reader/shairport-sync-metadata-reader < /tmp/shairport-sync-metadata Artist: "Sohn". Title: "Tremors". ^C pi@raspberrypi:~/fifo-js $But I dont’ seem to be able to parse what’s being sent to stdout from my javascript
If anyone has any examples that work, I’d be grateful.
-
RE: Please help
have you tried a sudo apt-get update ?
It might be worth giving that a try - afterwards, reboot then try re-running npm start again -
RE: Airplay 'Now Playing' module - help badly needed
So a bit more testing and things aren’t looking as rosy as I’d first thought. Before trying fifo-js, I’d experimented with the filesystem readStream - If i try looping that I end up with a java out of memory condition.
The fifo-js approach works with a fifo file that I echo things into to test, but doesn’t return anything while the Shairport service has it open for some reason?
There is a metadata reader script which I could use to read the metadata and parse it. I’ve compiled the executable and it runs fine. I should be able to call that from my javascript module through child process, right?
-
RE: Please help
@Moris, when you use the copy (cp) command, I think you have spaces where you shouldn’t.
if you are in the MagicMirror folder, the command should be;
cp(space)config/config.js.sample(space)config/config.jsit is possible to use to auto-complete the text where a file or folder exists if you want to.
I am not sure why you are getting the Npm ERR! messages. I’m hoping someone else can help here. Are you using npm start on the pi locally or are you SSH’ing into it? I’ve only ever started mine when I am on the Pi itself.Edit: @bhepler is a faster typer than me! :)
your /boot/config.txt should only have =1 and not =:1 for the display_rotate command. Here is an example;
# For more options and information see # http://www.raspberrypi.org/documentation/configuration/config-txt.md # Some settings may impact device functionality. See link above for details # uncomment if you get no picture on HDMI for a default "safe" mode #hdmi_safe=1 # uncomment this if your display has a black border of unused pixels visible # and your display can output without overscan #disable_overscan=1 # uncomment the following to adjust overscan. Use positive numbers if console # goes off screen, and negative if there is too much border #overscan_left=16 #overscan_right=16 #overscan_top=16 #overscan_bottom=16 # uncomment to force a console size. By default it will be display's size minus # overscan. #framebuffer_width=1280 #framebuffer_height=720 # uncomment if hdmi display is not detected and composite is being output #hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (this will force VGA) #hdmi_group=1 #hdmi_mode=1 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes #hdmi_drive=2 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2c_arm=on #dtparam=i2s=on #dtparam=spi=on # Uncomment this to enable the lirc-rpi module #dtoverlay=lirc-rpi # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on display_rotate=1Hope that helps!
-
RE: Airplay 'Now Playing' module - help badly needed
Luckily there is a fifo-js package available, which makes things super-easy!
npm install fifo-jsconst FIFO = require('fifo-js') let fifo = new FIFO('fifo-testfile') var count = 1 while (count == 1) { let text = fifo.readSync(fifo) console.log(text) } fifo.close()I’m getting there. I have an IN and I have an OUT in javascript. Now the hard work of joining the two together - interpreting and the decoding the appropriate metadata begins!
-
RE: Airplay 'Now Playing' module - help badly needed
So step 2, I have made a short javascript file that will read a fifo file and decode what it sees in the buffer.
var fs = require('fs') var fifo = fs.createReadStream('shairport-sync-metadata') fifo.on('data', function(fifoHexBuffer) { fifoHexBuffer = fifoHexBuffer.toString(); console.log(fifoHexBuffer) })At the moment, the code runs once and stops once it reads. My next task is to have it continue, then I’ll have to make it into a node-helper script, to interact with my base64 decoder/display
-
RE: First attempt on a 40" Flatscreen
Fantastic work @PaulB - it looks awesome. I look forward to seeing the new modules once you get around to them :)
-
RE: Airplay 'Now Playing' module - help badly needed
Ah! Thanks so much @alexyak - that’s fantastic. I can now move forwards :)
So parenthesis are needed to call the function and explicitly not pass it a parameter. Is that right?
-
RE: Airplay 'Now Playing' module - help badly needed
The first step of my module, which simply displays a base64-decoded string in the mirror reads like this.
/* global Module */ /* Magic Mirror * Module: base64 * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. */ Module.register("base64",{ // Default module config. defaults: { text: "Hello World!" }, frombase64: function() { var string = 'RGFycmVu'; var decodedString = atob(string); return decodedString; }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); var decstr = this.frombase64 var msgstr = document.createTextNode(decstr); wrapper.appendChild(msgstr); return wrapper; } });It seems like it should work, but I get a literal string rather than a value returned…

-
RE: Please help
Hi @moris, i’m sorry nobody else has responded.
The automatic Magicmirror2 installation should have done everything necessary. You might need to rotate the screen. If you need to do this, just type sudo /boot/config.txt and put rotate_display=1 at the end. If it all looks okay already, don’t bother with this!
to run the Magic mirror, make sure you are in the Magicmirror directory:
cd MagicMirror
You will need to make a file in the config folder, called config.js. There is a config.js.sample you can use. Just use cp config/config.js.samaple config/config.js to copy it to the file that is neededthen type:
npm start
and the mirror should start :)Hallo @moris, es tut mir leid, dass niemand sonst reagiert hat.
Die automatische Magicmirror2 Installation sollte alles Notwendige getan haben. Möglicherweise müssen Sie den Bildschirm drehen. Wenn Sie dies tun müssen, geben Sie einfach sudo /boot/config.txt und setzen rotate_display = 1 am Ende. Wenn alles schon okay aussieht, kümmere dich nicht darum!
Um den Magic-Spiegel auszuführen, stellen Sie sicher, dass Sie sich im Magicmirror-Verzeichnis befinden:
cd MagicMirror
Sie müssen eine Datei im config-Ordner namens config.js erstellen. Es gibt eine config.js.sample, die Sie verwenden können. Verwenden Sie einfach
cp config / config.js.samaple config / config.js
um es in die Datei zu kopieren, die benötigt wirdDann geben Sie ein:
npm start
Und der Spiegel sollte beginnen :) -
Airplay 'Now Playing' module - help badly needed
I’ve really been struggling to write my first module.
I’ve used Shairport-Sync to allow my mirror to act as an Airplay device - something which works a treat.
I’ve added Shairport-Sync-Metadata-Reader in order to base64-decode the playing track metadata, which Shairport outputs in xml format to a FiFo file.What I’m trying to do is create a module to read the FiFo stream, base64-decode the values and it sees, and display a couple of the fields (Artist/Track)
I think I’ll need a node-helper to do the watch/decode/filter and then send any Artist & Track fields it sees to the module which then displays it.
I’ve created this which pops up the decoded result for a hardcoded string
<script> var string = 'RGFycmVu'; var decodedString = atob(string); window.alert(decodedString); </script>I’ve tried without success though to incoporate this as a function into a .js file, so that I can display my test-decode on the mirror.
I’ve been looking through all the modules I can find to find something I can use as an example but no luck. I know I need to pass the decodedString variable somehow but have struggled to work out how :( -
RE: Withings
So the Python module I was trying to re-use didn’t work. I suspect Withings have changed their API or something else has changed. Following the steps on their website though, did work and I was able to send a command to retrieve my data.
Now it’s a case of trying to code it up into a module!
-
RE: Withings
I’ve been having a very quick play with this python script on my Pi, which demonstrates the API which could form the basis of a simple weight-data retrival module.
I’m struggling with a few issues at the moment though - I’ve git clone’d and npm install’d, created a test.py file as indicated by the readme and in it I’ve put in it my Withings API key and secret values.
I had to sudo pip install requests_oauthlib as that was a requirement which wasn’t installed.
I’m SO nearly there I think! when my test.py file runs, it generates a Withings URL to authorise the app, I authorise on the website and am given an oauth response verification code, but when I paste it back into the script response, I get an error which i think is at the point the script tries to parse them through auth.get_credentials (after this point, the script gets my last measured weight):
File "test.py", line 8, in <module> creds = auth.get_credentials(oauth_verifier) File "/home/pi/MagicMirror/modules/python-withings/withings/__init__.py", line 107, in get_credentials tokens = oauth.fetch_access_token('%s/access_token' % self.URL) File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth1_session.py", line 304, in fetch_access_token token = self._fetch_token(url, **request_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth1_session.py", line 361, in _fetch_token raise ValueError(error) ValueError: Unable to decode token from token response. This is commonly caused by an unsuccessful request where a non urlencoded error message is returned. The decoding error was No JSON object could be decoded.Oh well. It’s progress I suppose.
-
Audio visualiser
If anyone could spare the time to write a small, attractive visualiser for audio output, I’d be eternally grateful. It’s on my list of things to try and do but I’m struggling to find the time I need.
I think it could be a useful option for anyone using sound-orientated modules.
I’m trying to come up with something along the lines of the Siri speech waveform

Some clever soul has already come up with a JS implementation of the waveform on GitHub, which means a lot of the heavy lifting is already done…
-
Suggestions for relocated screen buttons?
I’d be interested to hear from anyone who has a neat solution to reusing and relocating the control buttons from their monitor. I’ve done a bit of searching but haven’t really found anything much…
I’ve decided to follow @trividar 's Ikea Hovet frame idea for my mirror. I’d like to re-use the montior buttons somehow and make them easy to access. The best idea I have at the moment, is to buy some small, maybe illuminated micro-buttons and get out the soldering iron :)