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=1
Hope 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!