Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. linux lm-sensors json parsing

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    linux lm-sensors json parsing

    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tigiba last edited by

      Hallo allerseits, bin mir nicht sicher ob das der richtige Ort ist, ich glaub ich such zu dem Thema eigentlich gar keine Hilfe, wollte nur meine Lösung herzeigen nachdem ich aufgrund fehlender Suchresultate mir für diesen Zweck selbst ein Script geschrieben habe:

      
      function readSensors() {
        exec('sensors -jA', function (error, stdout, stderr) {
          setState('0_userdata.0.lm-sensors.debug',stdout);
      
          var obj = JSON.parse(stdout);
      
          setState('0_userdata.0.lm-sensors.cpu_package',
            obj['coretemp-isa-0000']['Package id 0']['temp1_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core0',
            obj['coretemp-isa-0000']['Core 0']['temp2_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core1',
            obj['coretemp-isa-0000']['Core 1']['temp3_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core2',
            obj['coretemp-isa-0000']['Core 2']['temp4_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core3',
            obj['coretemp-isa-0000']['Core 3']['temp5_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core4',
            obj['coretemp-isa-0000']['Core 4']['temp6_input']);
          
          setState('0_userdata.0.lm-sensors.cpu_core5',
            obj['coretemp-isa-0000']['Core 5']['temp7_input']);
          
          setState('0_userdata.0.lm-sensors.wifi',
            obj['iwlwifi_1-virtual-0']['temp1']['temp1_input']);
          
          setState('0_userdata.0.lm-sensors.pch',
            obj['pch_cannonlake-virtual-0']['temp1']['temp1_input']);
          
          setState('0_userdata.0.lm-sensors.acpitz',
            obj['acpitz-acpi-0']['temp1']['temp1_input']);
          
          setState('0_userdata.0.lm-sensors.battery_voltage',
            obj['BAT0-acpi-0']['in0']['in0_input']);
      
          setState('0_userdata.0.lm-sensors.battery_current',
            obj['BAT0-acpi-0']['curr1']['curr1_input']);
        });
      }
      
      schedule('*   * * * * *', function(){
      /*        │   │ │ │ │ │
                │   │ │ │ │ │
                │   │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
                │   │ │ │ └────────── month (1 - 12)
                │   │ │ └─────────────── day of month (1 - 31)
                │   │ └──────────────────── hour (0 - 23)
                │   └───────────────────────── min (0 - 59)
                └───────────────────────────── [optional] sec (0 - 59)
      --> once every seconds
       */
          readSensors();
      });
      

      Bin aber gerne für Vorschläge offen, wie man's einfacher / eleganter / effizienter / besser machen hätte können ^^

      1 Reply Last reply Reply Quote 1
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      858
      Online

      31.8k
      Users

      80.0k
      Topics

      1.3m
      Posts

      1
      1
      152
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo