MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. Veldrovive
    V
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 53
    • Best 12
    • Controversial 0
    • Groups 1

    Veldrovive

    @Veldrovive

    Module Developer

    19
    Reputation
    1187
    Profile views
    53
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Veldrovive Unfollow Follow
    Module Developer

    Best posts made by Veldrovive

    • MMM-Bob-Ross: For putting a happy little painting up on your mirror

      Demo
      Bottom Left Corner

      Description

      Bob Ross is the quintessential wholesome TV guy, and now he can be on your mirror too. His paintings of nature scenes are sure to put you in a good mood and his voice could calm a charging bull so about what you need after a stressful day.

      Usage

      modules: [
          ...
          {
            module: "MMM-Bob-Ross",
            position: "bottom_left",
            config: {
              imgHeight: "30vh", //Defines the height of the painting.
              videoHeight: "30vh", //Defines the height of the video.
              updateInterval: 1*60*60*1000, //How often does the painting change?
              autoPlay: true //Should the video start as soon as it switches?
            }
          }
          ...
        ]
      

      More specifics available on the GitHub page.

      Interaction

      Any other module can control the behavior of MMM-Bob-Ross through the notification system. For specifics of the notifications and payloads, refer to the GitHub page.

      posted in Entertainment
      V
      Veldrovive
    • RE: How to keep a history of values on Mirror

      The only way I could see not having to modify other modules would be to only use modules that already emit notifications when events happen. Then all you would need to do is create a simple module that receives, saves, and recalls those notifications and looks for changes. You could use something like json-store to make the whole process even easier. If you wanted to get more information, you could do a very simple modification to modules to just spit out more notifications with more data.

      posted in General Discussion
      V
      Veldrovive
    • MMM-Page-Selector: A page switcher that can set positions of modules

      I just finished up the final touches on MMM-Page-Selector and I feel like it turned out quite well. I couldn’t find a module that would do pages/profiles the way I wanted them done so I created my own.

      Description

      Well, it’s pretty simple. You define the page names and positions and then Page-Selector manages the visibility and positions of your modules to give you a seamless transition between fully configurable pages.

      demo

      On top of just switching visibility of modules, the position can also be swapped in an aesthetically pleasing way.

      Basic Usage

      Setting up pages is easy, all you need to do is add

      pages: {"page_name_one": "position", "page_name_two": "another_position"}
      

      below the position string in its config for any modules you want to appear on separate pages.
      For more information, look at the GitHub page

      Interaction

      This was developed alongside MMM-Voice-Commands so it works well with that. I also added support for MMM-page-indicator, but it is also really easy to add support to any other module. To switch pages, simply send a notification to “PAGE_SELECT” with a payload that contains either the name of the page as a string or the index of the page.

      There have been no major issues I have seen with compatibility while I have been developing, but that doesn’t mean they don’t exist. If you find any, feel free to create an issue on github or reply below.

      posted in System
      V
      Veldrovive
    • MMM-Inspirational-Quotes is now here

      The moment we have all been waiting for is upon us. That is if you have been waiting for the moment when bot-created inspirational quotes can be delivered directly to you through the medium of a magic mirror.
      Just to be clear, most of these quotes will not make you inspired, but they will all make you laugh so I think that’s a good trade-off.
      The image generation is done using inspirobot and this module is simply a wrapper for it.
      demo2

      Download and usage instructions can be found on the Github Page

      posted in Entertainment
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      I’ve worked with changing the classes of modules on the fly during my work on this module.
      In order to change the class of a module or some modules:

      MM.getModules().withClass(/*Your module name or list of names*/).enumerate(module => {
          ref = document.getElementById(module.data.identifier);
          if(ref === null){
              Log.log("Module does not exist")
          }else{
              ref.classList.add("Your new class")
              // Or if you want to get rid of a class
              ref.classList.remove("Your old class")
          }
      })
      
      posted in System
      V
      Veldrovive
    • RE: How to run as "https"?

      As far as I know, it is pretty simple.
      In your js/server.js file, you are going to want to convert the http server it is using to an https one.
      First thing you are going to want to do is to create a self-signed certificate which is explained much better than I can on stack overflow.

      You can store those in any folder you want, but I just put them under js/https/* in order to have them close by.

      Then, in the server.js file, comment out var server = require("http").Server(app); near the top of the file. Underneath the imports, add a line importing your key and cert like so:

      var options = {
        key: fs.readFileSync(path.join(__dirname, "/https/key.pem")),
        cert: fs.readFileSync(path.join(__dirname, "/https/cert.pem"))
      };
      

      Underneath that, insert the line var server = require("https").Server(options, app); to substitute an https server for the http one. Finally, copy the line var io = require("socket.io")(server); below that and start your mirror.

      posted in Troubleshooting
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      Changes that edit the way users must set up their config.js file have been made to this module. The position prop is no longer necessary to have inside the module config and the way to exclusions are handled has changed. For more information, look at the updated readme in the development branch of the GitHub page.
      These changes will be merged into the master branch in a couple of days which will cause errors if your config is not updated.

      posted in System
      V
      Veldrovive
    • RE: How to run as "https"?

      As a slightly more easy to deal with version, you can just add

      var server = require("http").Server(app);
      if(config.useHttps){
          var options = {
              key: fs.readFileSync(path.join(config.httpCertPath, "key.pem")),
              cert: fs.readFileSync(path.join(config.httpCertPath, "cert.pem"))
          }
          server = require("https").Server(options, app);
      }
      
      
      var io = require("socket.io")(server);
      

      in the same server.js file right under the var Server = function(config, callback) { line.
      In your config.js, you can modify it to be

      var config = {
          useHttps: true,
          httpCertPath: "ABSOLUTE_PATH",
      }
      

      and then you can switch back and forth if you need.

      posted in Troubleshooting
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Brandenborg
      This is not a default function of this module. However, if you can edit a small amount of code, it should be easy to implement.
      Just copy these lines of code right after line 235 of MMM-Page-Selector.js. This lines should be selectPage(payload);

      clearTimeout(self.default_timeout);
      if(![0, this.config.defaultPage].includes(payload)){
          self.default_timeout = setTimeout(() => {
              selectPage(this.config.defaultPage);
          }, TIME)
      }
      

      Then just replace TIME with the number of milliseconds you want to remain on the page before it automatically switches back to default. You may also have to change the 0 in the if statement if your default page isn’t at the 0th position.

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Brandenborg
      The 0 should be the position of your default page in the page list. The furthest left is 0.

      posted in System
      V
      Veldrovive

    Latest posts made by Veldrovive

    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @m1scha
      I checked out MMM-Remote-Control and it is just a problem with string representations.

      remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=0 sends the literal notification “SELECT_PAGE” including the quotes. A more correct request would be remote?action=NOTIFICATION&notification=SELECT_PAGE&payload=Main which would switch the the page called main.

      However, in order to support other modules, pages are 1 indexed by notification so to switch to the first page, you would send remote?action=NOTIFICATION&notification=SELECT_PAGE&payload=1

      Strings that are numbers are handled correctly by MMM-Page-Selector.

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @m1scha
      Hello, glad you’re enjoying the module.

      I am assuming that your page has some name that is not "0".

      I haven’t extensively tested with magic mirror remote, but I imagine the issue is with setting payload to be a string. When it gets a string, MMM-Page-Selector assumes it is the name of the page, not a page index. If an integer is sent, it assumes it is a page index.

      I don’t know how remote works, but you might be able to use
      http://ip:8080/remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=0

      Or you could specify your page name as
      http://ip:8080/remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=“YOUR_PAGE_NAME”

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Brandenborg
      The latest version of this module now has this as a (Not very well tested) feature.
      You can now specify a restoreDefault prop in the MMM-Page-Selector config with the number of seconds you want before it returns to the default page.

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Brandenborg
      The 0 should be the position of your default page in the page list. The furthest left is 0.

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Brandenborg
      This is not a default function of this module. However, if you can edit a small amount of code, it should be easy to implement.
      Just copy these lines of code right after line 235 of MMM-Page-Selector.js. This lines should be selectPage(payload);

      clearTimeout(self.default_timeout);
      if(![0, this.config.defaultPage].includes(payload)){
          self.default_timeout = setTimeout(() => {
              selectPage(this.config.defaultPage);
          }, TIME)
      }
      

      Then just replace TIME with the number of milliseconds you want to remain on the page before it automatically switches back to default. You may also have to change the 0 in the if statement if your default page isn’t at the 0th position.

      posted in System
      V
      Veldrovive
    • RE: How to run as "https"?

      I’m not familiar with how a PWA works so I’m not quite sure what you are asking here. Are you saying that you have a PWA running that has a valid ssl encryption and you want to send requests from the PWA to your magic mirror, but they are being blocked due to mixed content policies?
      What happens when you request to the magic mirror that is using the unsigned certificate?
      A wildcard certificate handles subdomains so if you wanted to use the same certificate you would need to point a subdomain to your magic mirror.

      posted in Troubleshooting
      V
      Veldrovive
    • RE: How to run as "https"?

      @Lorenz
      In order to get a signed certificate, you need to go through a CA or certificate authority. Most of the time, magic mirrors are run on localhost and therefore cannot get a signed certificate so you just have to trust the IP on your browser and deal with the fact that it is not “trusted”.
      If you do happen to have a domain lying around, you can get a signed certificate for that and then use it to have a trusted website, but that’s a bunch of work and usually not worth it. If you do decide to go that route, there are a couple of places to sign certificates for free and I would suggest a quick google search to find them.

      posted in Troubleshooting
      V
      Veldrovive
    • RE: How to run as "https"?

      @Lorenz
      Could you post your server.js file so we can just make sure there aren’t many spelling mistakes?

      • The first thing that you should do is make sure that the path you supplied to the key and cert is correct. This error can arise if you are not pointing to the correct files.
      • Second, you can try to remake the cert and key and see if there was just some error the first time.
      • Third, I would try to figure out if the SSL version is correct. I’m not especially sure how this works, but when I ran into this issue once, somebody had said that the TLS version was incorrect.
      • Last, I would just try to reinstall openSSL and generate a new key.
      posted in Troubleshooting
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @rudibarani
      If I am understanding what you are asking for correctly, this function seems to be out of the scope that Page-Selector encompasses. I would develop a module to include this functionality, but I have been inactive in the world of Magic Mirror as of lately. As it stands, I would post this request to the module suggestions forum or ask somebody to include it in a module that has a closer association with this type of purpose. MMM-Remote-Control could be a good candidate.

      posted in System
      V
      Veldrovive
    • RE: MMM-Page-Selector: A page switcher that can set positions of modules

      @Johans,
      Ah, I believe the confusion comes from the fact that old discussions on this forum do not reflect the current functionality of the module. I try not to make any changes that break old config files, but one was necessary.
      In order to fix this config, you need to replace any instance of pages: "all" with pages: {"all": "some_position"}
      New versions don’t require you to have a position prop at all and you can just use the pages one.
      For more information, refer to the README.
      Hope this helps.

      posted in System
      V
      Veldrovive