MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. sdetweil
    3. Best
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    S
    Offline
    • Profile
    • Following 0
    • Followers 108
    • Topics 88
    • Posts 20,668
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Help developing first module, displaying webscraped text.

      @enderflop cool

      key here is module name = foldername = filename = register name
      and node_helper.js has to be in the same folder

      posted in Development
      S
      sdetweil
    • RE: MMM-EveryNews goes off every time when MMM-GoogleMapsTraffic is on

      @Dimasua there is a bug in GoogleMapsTraffic

      I have an updated version that seems to work, and have submitted to the author, but they have not taken the fix.

      try this
      https://github.com/sdetweil/MMM-GoogleMapsTraffic

      posted in Troubleshooting
      S
      sdetweil
    • RE: Config option with array of multiple values?

      @UncleRoger said in Config option with array of multiple values?:

      great conversation topic

      validSenders: [ { "mom@example.com", "Mom", "#ff0000" },
                      { "dad@example.com", "Dad", "#00ff00" },
                      { "son@example.com", "Son", "#0000ff" },
                    ]
      

      generally when you expand the number of items in an array to objects ({}) you start to get thinking about what happens if you decide to add another entry in the object…

      so in javascript you can NAME the elements

      validSenders: [ 
                      {  name:"Mom", color:"#ff0000",url:"mom@example.com", },
                      { url"dad@example.com", name:"Dad", color:"#00ff00" },
                      {  name:"Son", url:"son@example.com",color:"#0000ff" },
                    ]
      

      that way the code is not sensitive to the order of the elements

           validSenders.forEach(sender =>{
                   if (sender.name =="Dad") {
                        do_something(sender.url)
                   }
           })
      

      you can also use the array.filter() function

      let selected_sender = validSenders.filter(sender=>{
            if(sender.url==mailObj.sender[0].address)
                 return true
           else
                 return false
       })
      if(selected_sender.length>0){
          // we found a matching sender
      }
      

      the filter function passes each element array in turn to the function
      if you want the element in the output array return true,
      if not return false

      on the combined statements you don’t need the backslash

      if (that.config.validSenders.includes(mailObj.sender[0].address) && 
          daysAgo >= 0 && daysAgo <= that.config.daysToDisplay) {
      

      but this is THREE comparisons

      • that.config.validSenders.includes(mailObj.sender[0].address)
      • daysAgo >= 0
      • daysAgo <= that.config.daysToDisplay

      the last two CANNOT be true at the same time

      maybe what you wanted was

      if (
           that.config.validSenders.includes(mailObj.sender[0].address) && 
          (daysAgo >= 0 && daysAgo <= that.config.daysToDisplay)  
           ) {
      

      this is two outer compares (with one inner)

      posted in Development
      S
      sdetweil
    • RE: MagicMirror Newsfeed continually "loading"...

      @spblat if the module has a node_helper.js, you need to restart MM for any changes to take place

      posted in Troubleshooting
      S
      sdetweil
    • RE: How difficult would it be to change the data an existing module receives?

      @Tippon you can clone (fork) the module and add on what you want…

      there are two parts of the module… the browser/ui part MMM-Fitbit2.js
      and the helper, node_helper.js

      the MMM-Fitbit2.js cannot access hardware or files directly, so it has to call the helper

      so, you could add on access to the spreadsheet (csv)
      and send that data back as part of the response… the front end would never know

      one of my modules uses a csv

      in the node_helper
      (you have to npm install csvtojson in the module folder to be able to use it)

      const cvt = require("csvtojson");
      

      and then

                                     cvt().fromFile(payload.tmpfile) // input xls  // changed to tmpfile
           				.subscribe((jsonObj, index) => { 
                                             // handle each row
                                         })
      
      posted in Development
      S
      sdetweil
    • RE: Complete Walkthrough - Install MagicMirror on a PC - Windows 7/10

      @Uwe-Kretsen do not install under mingw, just open a command prompt/ powershell prompt and do the git clone/npm install

      u need git of course and node/npm (google how to install)

      then u need to do some more steps as the setup is for linux

      cd MagicMirror
      cd vendor
      npm install
      cd ..
      cd fonts
      npm install
      cd ..
      

      then edit package.json and change the start line
      from

      		"start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
      

      to

      		"start": "node_modules/.bin/electron js/electron.js",
      

      then npm start works as expected

      also, you must manually copy the MagicMirror/config/config.js.sample to the initial config.js
      also create the empty MagicMirror/css/custom.css

      posted in Troubleshooting
      S
      sdetweil
    • modules using openweather api need review

      we have received notice from Openweather, that they are shutting down the version 2.5 weather endpoint in June 2024

      see
      https://github.com/MagicMirrorOrg/MagicMirror/issues/3424

      for the weather provided by MagicMirror, you will also have to change or add the apiVersion property

      see the documentation for exact format
      https://docs.magicmirror.builders/modules/weather.html

      posted in Development
      S
      sdetweil
    • RE: Problems loading config resources

      @Envynot sounds like you are running on windows…
      .
      two extra steps

      cd MagicMirror 
      cd vendor
      npm install
      cd ..
      cd fonts
      npm install
      cd ..
      

      now u can start mm again

      posted in Troubleshooting
      S
      sdetweil
    • RE: Do you need to list moment and moment-timezone as dependencies in modules?

      @dathbe you should list them , we can change the base at any time. there have been discussions to move away from moment.

      we moved away from request, and etc,etc…

      if you do require(x)
      then you should list x in package.json

      posted in Development
      S
      sdetweil
    • RE: MagicMirror² v2.15.0 is available don't work.

      @wenike deprecated doesn’t mean no longer works… just means you “shouldn’t use it for NEW development”

      SO, if its not loaded, YOU can still load it…

      npm install valid-url

      in whatever module needs it

      posted in Troubleshooting
      S
      sdetweil
    • 1
    • 2
    • 13
    • 14
    • 15
    • 16
    • 17
    • 165
    • 166
    • 15 / 166