MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-SystemStats (cpu temp/load, fre ram ...)

    Scheduled Pinned Locked Moved Utilities
    74 Posts 36 Posters 63.7k Views 35 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lavolp3L Offline
      lavolp3 Module Developer @Lordy
      last edited by lavolp3

      @Lordy try tr:nth-child(6n+1)

      You have 5 children in the table element, which are the 5 table rows.
      nth-child counts every “nth” children from 0.
      So if you have nth-children(3n+0) it takes the 3rd 6th 9th. Only the 3rd is there so voila.

      nth-children(6n+1) SHOULD count the 1st, 7th, 13th children, of these only the 1st is available. So, hopefully again, voila.

        getDom: function() {
          var self = this;
          var wrapper = document.createElement('table');
      
          var sysData = {
            cpuTemp: {
              text: 'CPU_TEMP',
              icon: 'fa-thermometer',
            },
            sysLoad: {
              text: 'SYS_LOAD',
              icon: 'fa-tachometer',
            },
            freeMem: {
              text: 'RAM_FREE',
              icon: 'fa-microchip',
            },
            upTime: {
              text: 'UPTIME',
              icon: 'fa-clock-o',
            },
            freeSpace: {
              text: 'DISK_FREE',
              icon: 'fa-hdd-o',
            },
          };
      

      How to troubleshoot modules
      MMM-soccer v2, MMM-AVStock

      1 Reply Last reply Reply Quote 1
      • lavolp3L Offline
        lavolp3 Module Developer @Lordy
        last edited by

        @Lordy I’m honestly amazed it worked.

        How to troubleshoot modules
        MMM-soccer v2, MMM-AVStock

        LordyL 1 Reply Last reply Reply Quote 0
        • LordyL Offline
          Lordy @lavolp3
          last edited by

          @lavolp3
          Now I understand it.
          It also works that “tr:nth-child(5n+1)”.
          With the background knowledge, it is clear to me.
          Nice Weekend

          1 Reply Last reply Reply Quote 0
          • BKeyportB Offline
            BKeyport Module Developer
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • BKeyportB Offline
              BKeyport Module Developer @BenRoe
              last edited by

              @BenRoe Hey, ben - love your module - would like to see a “quick” change if possible. Could you update the module to show both imperial and metric for CPU temp? This is only needed because I’m in a backwards country that hasn’t adopted sensable measurements, and it would be nice to have both temps on screen at the same time, so I can compare easily with others on how cool my system is.

              Thanks!

              lavolp3L 1 Reply Last reply Reply Quote 0
              • lavolp3L Offline
                lavolp3 Module Developer @BKeyport
                last edited by lavolp3

                @BKeyport I think this sound more like a change you could do to your own version instead of a general change for the module.
                You could insert e.g.

                this.stats.cpuTemp = payload.cpuTemp + " / " + (payload.cpuTemp * 9 / 5 + 32).toFixed(1) + "°F";
                

                into line 62

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                BKeyportB 1 Reply Last reply Reply Quote 0
                • BKeyportB Offline
                  BKeyport Module Developer @lavolp3
                  last edited by

                  @lavolp3 that’s not working, just get NaN… I think that’s because the string’s already got the “°C” at that point.

                  On another point, how do you link back to the code and highlight like that?

                  lavolp3L 2 Replies Last reply Reply Quote 0
                  • lavolp3L Offline
                    lavolp3 Module Developer @BKeyport
                    last edited by

                    @BKeyport said in MMM-SystemStats (cpu temp/load, fre ram ...):

                    On another point, how do you link back to the code and highlight like that?

                    You can get a direct link by clicking on the line in github.

                    How to troubleshoot modules
                    MMM-soccer v2, MMM-AVStock

                    1 Reply Last reply Reply Quote 0
                    • lavolp3L Offline
                      lavolp3 Module Developer @BKeyport
                      last edited by

                      @BKeyport said in MMM-SystemStats (cpu temp/load, fre ram ...):

                      that’s not working, just get NaN… I think that’s because the string’s already got the “°C” at that point.

                      ah the parsefloat is missing.
                      How about

                      this.stats.cpuTemp = payload.cpuTemp + " / " + (parseFloat(payload.cpuTemp) * 9 / 5 + 32).toFixed(1) + "°F";
                      

                      How to troubleshoot modules
                      MMM-soccer v2, MMM-AVStock

                      BKeyportB 1 Reply Last reply Reply Quote 0
                      • BKeyportB Offline
                        BKeyport Module Developer @lavolp3
                        last edited by

                        @lavolp3 That did it, thank you.

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 7
                        • 8
                        • 6 / 8
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy