MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. mongo116
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    M
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 9
    • Posts 65
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: MMM-Hive

      Not sure whether many are using this module but figured I’d provide an update on the changes I made today. I’ve now updated the module so that it works again! I have updated to include the new login process and from testing it all appears to work - would welcome any feedback though :)

      posted in Utilities
      M
      mongo116
    • MMM-atHome

      This is pretty niche, but I wanted to show my next rubbish collections as we have multiple that are on different weeks. My local council doesn’t appear have an API and the website to view the next collections isn’t the easiest to pull data from. They do however use the @HOME app, and from this I have pulled back the relevant JSON.

      More details can be found at: MMM-atHome

      screenshot.png

      posted in Utilities
      M
      mongo116
    • RE: MMM-Hive

      @rick Thanks for that. Github has been updated :thumbs_up_light_skin_tone:

      posted in Utilities
      M
      mongo116
    • RE: MMM-Hive

      @rick Cheers for the details. I’ve updated and added some config options in case this changes again, so you only then need to update the config.

      posted in Utilities
      M
      mongo116
    • MMM-qnapDownloadStation

      I’ve created a module, MMM-qnapDownloadStation, that will show the current downloads from Download Station running under a QNAP NAS.

      example.png

      posted in Utilities
      M
      mongo116
    • RE: Convert bytes to megabytes - JSON

      Thanks for the replies :thumbs_up_light_skin_tone:

      I’ve got the bytes string converting to a number, so that’s all good. Now the next question, @Bugsounet how do I use your function within the JSON.parse function?

                      var payload = JSON.parse(payload, function (key, value) {
                          if ( key === 'down_rate' ) {
                          var num = Number(value);
                          return (num/(1024*1024)).toFixed(2);
                          }
      

      Just to add, I had tried the following and receive a this.convert is not a function

                          var downrate = this.convert(value,0);
                          return downrate;
      
      posted in Development
      M
      mongo116
    • RE: Convert bytes to megabytes - JSON

      I figured this out in the end, with the help of google :) I used the JSON.parse() reviver function to take the down_rate and up_rate from the payload and divide it by 1024 (and again by 1024) to convert the bytes to megabytes. What confused me at first was I was trying to do this in the node_helper.js, which didn’t work. It needed to be in the socketNotificationReceived of the .js file.

                      var payload = JSON.parse(payload, function (key, value) {
                          if ( key === 'down_rate' ) {
                          return (value / 1024 / 1024).toFixed(2);
                          }
                          else if ( key === 'up_rate' ) {
                          return (value / 1024 / 1024).toFixed(2);
                          }
                          else {
                          return value;
                          }
                      });
      

      I’m sure there is a proper way of doing this, but for my needs this is now working as needed.

      posted in Development
      M
      mongo116
    • RE: Convert bytes to megabytes - JSON

      @sdetweil Thanks for the reply.

      basically t.data[i].down_rate / 1024 for kilobytes

      posted in Development
      M
      mongo116
    • Convert bytes to megabytes - JSON

      I’m creating a module that connects to my QNAP NAS and shows the current downloads (DownloadStation). It’s mostly working, but the download rate is in bytes and I’d like to display it in megabytes (or possibly kilobytes).

      The download list is in JSON format and I currently display the download name and download rate in a table as follows ( t being the JSON data):

                  for (var i = 0; i < t.data.length; i++)
              {
                  var row = document.createElement("tr");
                  var name = document.createElement("td");
                  name.innerHTML = t.data[i].source;
                  var downrate = document.createElement("td");
                  downrate.innerHTML = t.data[i].down_rate;
                  row.appendChild(name);
                  row.appendChild(downrate);
                  table.appendChild(row);
              }
              wrapper.appendChild(table);
      
      		return wrapper;
      
      posted in Development
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      @Damian Hi, glad that it’s now working. I’m still going to work on it when I can, but at least no urgency now :)

      For the outside temperature thermometer, check the readme on the github page (https://github.com/flick116/MMM-Hive), specifically the following settings:

      highestTemp - Set the highest temperature value, which when reached will use the ‘full thermometer’ icon, plus turn the icon red

      highTemp - Set the high temperature value, which when reached will use the ‘three quarters full thermometer’ icon

      lowTemp - Set the low temperature value, which when reached will use the ‘half full thermometer’ icon

      lowestTemp - Set the lowest temperature value, which when reached will use the ‘quarter full thermometer’ icon
      (anything below this temperature will use the ‘empty thermometer’ icon)

      Only when the temperature equals or is greater than the highestTemp value will the icon turn red.

      posted in Troubleshooting
      M
      mongo116
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 1 / 7