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
    • RE: Any MMM-Hive Users that can help, please?

      The config I have just tested with:

      		{
      			module: "MMM-Hive",
      			position: "top_right",
      			header: "Hive",
      			config: {
      				username: '',
      				password: '',
      				postcode: '',
      				updateInterval: 10 * 60000,
      				outsideUrl: 'http://weather-prod.bgchprod.info/weather?postcode=',
      				temperatureSuffix: ' °C',
      				showNext: true,
      				highestTemp: '30',
      				highTemp: '25',
      				lowTemp: '20',
      				lowestTemp: '15',
      				animatedLoading: true,
      				debug: true,
      					},
      
      posted in Troubleshooting
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      @Damian I didn’t make any changes to the config really, apart from adding some other settings, but these default to false if not defined.

      Could you enable debug in the config for MMM-Hive (debug: true,) and then load the magic mirror in a browser and enable developer tools (F12). In this window, ensure Console is the selected tab and then refresh the page (it’s easier to remove all other modules). When refreshed, you should then see a load of text when the hive module loads, something like the following:

      Tue, 10 Apr 2018 14:45:16 GMT MMM-Hive received notification: INSIDE - Payload: [{“id”:“xxx”,“type”:“heating”,“sortOrder”:1,“created”:1521812393853,“parent”:“xxx”,“props”:

      If you could copy / paste the text into notepad and then search for “type”

      The bit I am interested in, is the text straight after “type” - so in the above example it’s “heating”

      I am using the “type” to determine whether to pull back data for heating or hot water so if yours is named differently that is probably the issue. There might be more than one instance of “type”, so if you could let me know all.

      Hopefully it’s just that and I can then add a new setting so you can choose the name.

      Thanks

      posted in Troubleshooting
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      I was just testing and realised that when I was seeing the target temperature, it was when the system was in boost mode. So when not in boost mode, but the heating on, it’s not the same as previously, so it won’t show it’s heating. I need to look at how this is now working and update. You should see current temperature correctly using he updated code, but not target unless boost is on.

      posted in Troubleshooting
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      @Damian Hi, I’ve updated https://github.com/flick116/MMM-Hive, do you want to try it and let me know. I’ve added some test bits and bobs, but if you haven’t got the settings then these shouldn’t show up.

      posted in Troubleshooting
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      Looks like British Gas have just changed the way the api works, so there are changes to be made, not loads, but will take a bit of time. Got to fit it around DIY!

      posted in Troubleshooting
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      I have got the temperature showing now (borrowed a hive login for testing) and I am looking at now adding whether hot water is on or off, and also a battery icon for the thermstat. I cannot for the life of me remember how to use github, but I will get these changes made, tested and update the module. No telling how long I will take, but it shouldn’t take too long - just need to find some time to finish coding and tidying it up.

      Thanks

      posted in Troubleshooting
      M
      mongo116
    • RE: sendSocketNotification not working

      Got this sorted - found there is another url that holds the information so added another request. The request I was having issues with was a post request, whereas the one I am using is a get.

      posted in Development
      M
      mongo116
    • RE: sendSocketNotification not working

      If you look at the MMM-Hive code, what I am trying to do, is add a sendSocketNotification to the 2nd request in the node_helper.js. The second and third requests in node_helper.js are the ‘nested’ ones.

      posted in Development
      M
      mongo116
    • sendSocketNotification not working

      Hi,

      Does anybody know whether you can use sendSocketNotification when using nested Request functions?

      Basically, the way the api works, is that you have to login to get a sessionID and then I have another request using that sessionID to pull back JSON data. For some reason the second requests sendSocketNotification is working fine, but the first one isn’t.

      The first request is definitely working, as the sessionID is being pulled from the response.

      I’m trying to do this so I can update the MMM-Hive module as British Gas made some changes and the module no longer works.

      posted in Development
      M
      mongo116
    • RE: Any MMM-Hive Users that can help, please?

      @Damian I think I am making some headway into this issue. I will spend a bit of time when I can and hopefully get a new version out soonish

      Cheers

      posted in Troubleshooting
      M
      mongo116
    • 1 / 1