Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Absolute Feuche Berechnung

    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

    Absolute Feuche Berechnung

    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      paul.honka last edited by paul.honka

      Hallo,
      ich versuche gerade ein abs. Feuchte Script zum laufen zu bringen. Das von paul53, etwas abgeändert.
      Zum Testen auf 10 sec.
      Gelingt nicht, es meldet Fehler in Zeile 13
      12:52:57.424 error javascript.0 (1373) script.js.common.Homematic.Feuchte_WZ compile failed: at script.js.common.Homematic.Feuchte_WZ:13

      '*/10 * * * * *'
      // von paul53 übernommen und angepasst
      // http://forum.iobroker.net/viewtopic.php?f=20&t=2437&hilit=L%C3%BCftung%2A#p21476
      createState('WZ.Temperatur', 0);            // °C
      createState('WZ.rel_Feuchte', 0);           // %
      createState('WZ.Feuchtegehalt', 0);         // g/kg  (nicht g/m3 !)
      createState('WZ.Taupunkt', 0);              // °C
      createState('WZ.Enthalpie', 0);             // kJ/kg
      // Ordner Common/Variablen
      // Offsets
      var toffset = 0.0; // in K zur Korrektur, falls nötig
      var rhoffset = 0;  // in % zur Korrektur, falls nötig
      var tsid = "hm-rpc.2.LEQ0002879.1.TEMPERATURE"     ;HM Sensor WZ
      var hsid = "hm-rpc.2.LEQ0002879.1.HUMIDITY";
      var tid = "WZ.Temperatur";
      var rhid = "WZ.rel_Feuchte";
      var xid = "WZ.Feuchtegehalt";
      var dpid = "WZ.Taupunkt";
      var enth = "WZ.Enthalpie";
      var t = getState(tsid).val + toffset; // Temperatur, korrigiert in °C
      var rh = getState(hsid).val + rhoffset; // rel. Feuchte, korrigiert in %
      var x;  // Feuchtegehalt in g/kg
      var dp; // Taupunkt in °C
      var  DP = require('dewpoint');
      // 70 m über NN
      var xdp = new DP(36); 
      function calc() {
         var y = xdp.Calc(t, rh);
         x = y.x;
         dp = y.dp;
         setState(xid, x);
         setState(dpid, dp);
      }
      function anzeige() {
        // Enthalpie berechnen
         var h = (1.00545 * t + (2.500827 + 0.00185894 * t) * x).toFixed(1);
         var tanz = t.toFixed(1);
         dp = dp.toFixed(1);
         var rhanz = rh.toFixed(0);
        x = x.toFixed(2);
          setState(tid, t);
         setState(rhid, rh);
         setState(xid, x);
         setState(dpid, dp);
         setState(enth, h);
      }
      function klima() {
        calc();
        anzeige();
      }
      klima(); // Script start
      on(tsid, function (dp) {
         t = dp.state.val + toffset; 
         setState(tid, t);
        klima();
      });
      on(hsid, function (dp) {
         rh = dp.state.val + rhoffset; 
         setState(rhid, rh); 
        klima();
      });
      
      

      Das Script findet die Variable hm-rpc.2.LEQ0002879.1.TEMPERATURE nicht,
      Nur gibt es diese!
      aadcf87e-a98c-4f8e-a757-130b55ec8e1c-image.png
      Wo muss ich suchen?
      Beste Grüsse paul

      sigi234 paul53 3 Replies Last reply Reply Quote 0
      • sigi234
        sigi234 Forum Testing Most Active @paul.honka last edited by sigi234

        @paul-honka sagte in Absolute Feuche Berechnung:

        var tsid = "hm-rpc.2.LEQ0002879.1.TEMPERATURE" ;HM Sensor WZ

        Korrektur //

        var tsid = "hm-rpc.2.LEQ0002879.1.TEMPERATURE"; // HM Sensor WZ
        
        1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @paul.honka last edited by paul53

          @paul-honka sagte:

          var tsid = "hm-rpc.2.LEQ0002879.1.TEMPERATURE"     ;HM Sensor WZ
          

          Kommentar machen:

          var tsid = "hm-rpc.2.LEQ0002879.1.TEMPERATURE"; // HM Sensor WZ
          
          P 1 Reply Last reply Reply Quote 0
          • P
            paul.honka @paul53 last edited by

            @paul53 , @sigi234 ,
            Danke manchmal sieht man den Wald........
            Die Hürde hat das Script genommen, jetzt kommen folgende Meldungen:

            16:26:49.716 error javascript.0 (1373) script.js.common.ioBroker.WZ__Feuchte: Error: Cannot find module '/opt/iobroker/node_modules/iobroker.javascript/lib/../../dewpoint'
            16:26:49.718 error javascript.0 (1373) at script.js.common.ioBroker.WZ__Feuchte:24:11
            16:26:49.720 error javascript.0 (1373) script.js.common.ioBroker.WZ__Feuchte: script.js.common.ioBroker.WZ__Feuchte:26
            16:26:49.722 error javascript.0 (1373) at script.js.common.ioBroker.WZ__Feuchte:26:11
            Dewpoint ?
            Beste Grüsse paul

            paul53 1 Reply Last reply Reply Quote 0
            • paul53
              paul53 @paul.honka last edited by paul53

              @paul-honka sagte: Cannot find module '/opt/iobroker/node_modules/iobroker.javascript/lib/../../dewpoint'

              dewpoint muss als zusätzliches NPM-Modul in die Konfiguration der Javascript-Instanz eingetragen werden, damit es installiert wird und genutzt werden kann.

              P 1 Reply Last reply Reply Quote 0
              • P
                paul.honka @paul53 last edited by

                @paul53
                so ?
                c7688a64-b961-42b4-8173-e71b2a05dbc2-image.png
                Beste Grüsse paul

                paul53 1 Reply Last reply Reply Quote 1
                • paul53
                  paul53 @paul.honka last edited by

                  @paul-honka sagte: so ?

                  Ja.

                  1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @paul.honka last edited by paul53

                    @paul-honka sagte: Feuchte Script zum laufen zu bringen. Das von paul53

                    Du hast ein Script mit meinen ersten Javascript-Versuchen gegriffen. Das würde ich heute anders machen und Alias-Datenpunkte verwenden, etwa so:

                    // Feuchtegehalt, Taupunkt und Enthalpie berechnen
                    const raum = 'WZ';
                    // Alias-Werte sind um einen Offset korrigiert
                    const idTemp = 'alias.0.' + raum + '.Klima.Temperatur';
                    const idHum = 'alias.0.' + raum + '.Klima.rel_Feuchte';
                    const idX = '0_userdata.0.' + raum + '.Klima.Feuchtegehalt';
                    const idDp = '0_userdata.0.' + raum + '.Klima.Taupunkt';
                    const idEnth = '0_userdata.0.' + raum + '.Klima.Enthalpie';
                    
                    var t = getState(idTemp).val; // Temperatur in °C
                    var rh = getState(idHum).val; // rel. Feuchte in %
                    
                    const DP = require('dewpoint');
                    const xdp = new DP(70); // 70 m über NN
                    
                    function klima() {
                        let y = xdp.Calc(t, rh);
                        let x = y.x; // Feuchtegehalt in g/kg
                        let dp = y.dp; // Taupunkt in °C
                        let h = 1.00545 * t + (2.500827 + 0.00185894 * t) * x; // Enthalpie in kJ/kg
                        setState(idX, Math.round(x * 10) / 10, true);
                        setState(idDp, Math.round(dp * 10) / 10, true);
                        setState(idEnth, Math.round(h * 10) / 10, true);
                    }
                    
                    klima(); // Script start
                    on(idTemp, function (dp) {
                        t = dp.state.val; 
                        klima();
                    });
                    on(idHum, function (dp) {
                        rh = dp.state.val; 
                        klima();
                    });
                    
                    P 1 Reply Last reply Reply Quote 0
                    • P
                      paul.honka @paul53 last edited by

                      @paul53
                      Alias ist mir hier zu aufwendig. Wann ist mal ein Homematic Temp. Sensor defekt. Hatte noch keinen!
                      Nochmals besten Dank für das Script, paul

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

                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      806
                      Online

                      31.9k
                      Users

                      80.1k
                      Topics

                      1.3m
                      Posts

                      3
                      9
                      678
                      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