IR control of presentations?
Hey everyone - i’m looking to run https://revealjs.com/demo/ on MM, in a web browser module. I have a basic MM setup but otherwise a newbie
The idea would be to able to able navigate through the slides with an IR remote (either mimicking keystrokes, or issuing api calls to the revealjs server.
Does this seem realistic to do? Any pointers on implementation would be very helpful!
@DrFalken don’t know why you would want to use a web browser to open a web browser to do this… but
if you put the demo in an iframe, it would be isolated from MM in terms of operation…
and you can send events to that iframe from an MM module
if you google search, ‘raspberry pi ir remote control gpio python tutorial’, there are a number of exmaples of using an IR report on a pi…
collect the events in python, and pass to a module node_helper.js
which can forward the events up to your controller module (that injected the iframe and forwards the events)
my python print module, https://github.com/sdetweil/MMM-PythonPrint
shows how to launch the python script and collect its output and forward up to module…
so you need some IR receiver hardware, the python IR receiver code (library) , and what keys/gestures you want to pass on,
and the module side that injects the iframe, with url … etc…
nothing exists today…
doc on building modules here
my SampleModule, which implemnnts the spec
the PythonPrint module is built from the sample…
you should be able to get the iframe up and running in less than an hour using the sample… all yo u have to do is generate the right html iframe tag content in getDom() sample… (or maybe print is better)
@sdetweil Thanks! Awesome writeup.
Why would it be a browser to open a web browser? I meant to use the browser module to open a revealjs URL (which would represent a desired slideshow), or would that not be possible? Maybe I’m missing something.
@DrFalken MagicMirror is an app inside a browser to present its stuff…
@DrFalken in MM a module creates a small section of html content
div ->iframe <end-div
and then gives that to MM which places it inside the div matching the position declared for the modules content… (see index.html for the raw mm html page layout)
so, you create the div, create iframe, add the url to the iframe, add the iframe to the div and return the div to MM (return from getDom() function.). and mm does the placement, and browser does all the rest of the work…
@sdetweil ah I get it. So what’s the point of browser modules? Just to provide a UI to navigate?
@DrFalken mm is a composite ( built from parts) information display. the ‘modules’ each from different author, control their content and update frequency, without knowledge of any other module.
because the parts are independent, anyone can construct the information display any way they want
technically mm is an output only medium, which has tiny bits of input nowadays… button push, limited voice, and some externally submitted events.
no general keyboard or mouse. no office type desktop.
due to some creative invention, mm has the ability to fake multiple pages, and allow externally invoked page change
@sdetweil Thank you!
If you are looking for an IR remote module, I wrote one some months ago to control a radio player embedded in the mirror. This module send notifications to other modules (or actions to show, hide or toggle modules).
This module work with lirc (the Linux infrared control) and has been tested on a RPi (4).
The module is available at https://github.com/thierry7100/MMM-Infrared-Remote
Hope this can help you.
@Thierry7100 Awesome, thank you! Will give it a shot.