MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MM2 with dynamic configuration and style

  • Hello everybody,
    I m working on a project on MM2 and i integrated and customised a lot of modules successfully thanks to the documentation and this forum. but the thing that i want to do now, i could’t find it. that s why i m posting.
    So what i want is i can separate it in 2 steps:

    1. i need to make a different setup of modules in which the css and the modules’s config should be dynamically loaded.
    2. i need to call each setup through browser from different endpoint (exp: localhost:8080/bath, localhost:8080/hall, localhost:8080/room1, localhost:8080/room2).

    So as you have noticed, the main purpose is to put different MM in diff places (hall, bath, room1, room2) and customize each one from different folder that contains the modules config and the css files). for example the module MMM-MP3Player is available in all setups but in each place should have different ‘musicPath’ and so on

  • @mohamed-elleuch

    I think you could do the different layouts with MMM-Pages, for those modules that support using multiple instances.

    but mm can only present one page at a time.

    so I think the only way to do this is to run and instance per room, each on a different port

  • @sdetweil :
    thank you very much for your fast reply,
    The solution of an instance on different port for each room is good. but i m asking if there is another solution programmatically.
    I know that we are only showing only 1 page at a time. but let me give you another example to simplify what i want. maybe this will help you to suggest another solution:
    imagine that we will use this module MMM-RemoteCompliments which shows the content of a file on the linked google drive account. i will create a different google drive account for each room and i want to create a folder for each room that will contain the credentials, token, css for this room that will be used from this module to connect to the drive

  • @mohamed-elleuch does that module support multiple instances running concurrently?

    many modules do not. it takes extra care to.make it work.

    I know what u want, but unless u change the core mm code, you can’t get it with the current implementation.

    there is only one route / in server.js, you could edit and make more,
    but there is no route prefixing, so you would have to do that too. etc etc.

    mm is a single page app. not a web site.

  • @sdetweil
    Thank you very much for clarifying the situation.
    So in this case i will run a separated instance for each room on a different port and then i will run a http server which will get the request from the browser and redirect to the convenient mm2 server by adding redirection conditions in the .htaccess file.

    The bowser will get the request let’s suppose on localhost and the result should be like the following:
    hall: redirecting from http://localhost/hall => http://localhost:8080
    bath: redirecting from http://localhost/bath => http://localhost:8081
    room1: redirecting from http://localhost/room1 => http://localhost:8082
    room2: redirecting from http://localhost/room2 => http://localhost:8083

    The whole situation is clear now, thank you for your help

  • @mohamed-elleuch i don’t know if you can hide the port number, after the redirect, and so, the value of the redirect is minimal… just use the port in the browser for each room and be done with it… (no one will see it but you)

Log in to reply