Ankündigung

Einklappen
Keine Ankündigung bisher.

Smart Meter: YouLess LS120

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Smart Meter: YouLess LS120

    Recently, I bought a YouLess LS120 to read the smart meter via the P1 port. Other samples on this forum helped me a great deal, but I wanted to retrieve some more information than actual power use alone.

    So, I collected other pieces of small PicoC code on the web and created a new program that reads all relevant attributes from the JSON file that is returned when you query the YouLess device with http://ip_address/e?f=j

    The code is as follows:

    (Please download YouLess LS120 Parser.txt as I can't paste the code correctly in this editor)

    The script is easy to adapt to your own specifications, so please do and let me know any comments that you have.
    Angehängte Dateien
    Zuletzt geändert von Gast; 22.03.2019, 10:01.

  • #2
    Hello and thanks for your script. I don't have too much PicoC experience and can't get the script to run properly. I've copied your code and changed the IP address in my own. It won't produce any output however. When I pull my log file I'm getting the following fault message:

    float p1 = GetValue(""p1":", 0);
    ^
    Youless Fetcher:65:30 identifier not expected here


    Anyone any thoughts on what I'm doing wrong or should alter?

    Thanks a lot in advance!

    Kommentar


    • #3
      Zitat von rverkaik Beitrag anzeigen
      Recently, I bought a YouLess LS120 to read the smart meter via the P1 port. Other samples on this forum helped me a great deal, but I wanted to retrieve some more information than actual power use alone.

      So, I collected other pieces of small PicoC code on the web and created a new program that reads all relevant attributes from the JSON file that is returned when you query the YouLess device with http://ip_address/e?f=j

      The code is as follows:

      [PHP]

      The script is easy to adapt to your own specifications, so please do and let me know any comments that you have.

      Does this actually work for you? I want to check this before I try to load it into my own MiniServer... thing is that this shows PHP as code, which makes me worried to ruin my config.

      Also how do you feed AQ1/AQ2/AQ3 to the energy monitor function block (which parameters on that block)? maybe a screenshot would help.
      Zuletzt geändert von HBeumer; 21.03.2019, 14:29.

      Kommentar


      • #4
        I tried the program, but don't get any values other then zero.
        in the Log I get the same message as RvdB ...

        float p1 = GetValue(""p1":", 0);
        ^
        Youless Fetcher:65:30 identifier not expected here



        Was this ever solved?
        Zuletzt geändert von HBeumer; 21.03.2019, 15:52.

        Kommentar


        • #5
          @HBeumer

          could it be, that before the inner " (string) the escape character \ is missing ?

          try this

          Code:
          [COLOR=#000000][COLOR=#007700]if([/COLOR][COLOR=#0000BB]result [/COLOR][COLOR=#007700]!= [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700])
              {[/COLOR]
          [COLOR=#0000BB]float p1 [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]p1[/COLOR][COLOR=#DD0000]\":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]float p2 [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]p2[/COLOR][COLOR=#DD0000]\":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]setoutput[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]EnergyConsumption[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]p1[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]p2[/COLOR][COLOR=#007700]);[/COLOR]
          
          [COLOR=#0000BB]float n1 [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]n1[/COLOR][COLOR=#DD0000]\":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]float n2 [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]n2[/COLOR][COLOR=#DD0000]\":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]setoutput[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]EnergyProduction[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]n1[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]n2[/COLOR][COLOR=#007700]);[/COLOR]
          
          [COLOR=#0000BB]float pwr [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]pwr[/COLOR][COLOR=#DD0000]\":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]setoutput[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]ActualPowerUse[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]pwr [/COLOR][COLOR=#007700]/ [/COLOR][COLOR=#0000BB]1000[/COLOR][COLOR=#007700]);[/COLOR]
          
          [COLOR=#0000BB]float gas [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]GetValue[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"\"[/COLOR][COLOR=#0000BB]gas\[/COLOR][COLOR=#DD0000]":"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]);[/COLOR]
          [COLOR=#0000BB]setoutput[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]GasConsumption[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]gas[/COLOR][COLOR=#007700]);[/COLOR]
          
          [COLOR=#0000BB]free[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]result[/COLOR][COLOR=#007700]);
              }[/COLOR][/COLOR]
          Zuletzt geändert von Labmaster; 21.03.2019, 16:20.

          Kommentar


          • HBeumer
            HBeumer kommentierte
            Kommentar bearbeiten
            Awesome, seems to do the trick.. some values are now coming through.

          • Labmaster
            Labmaster kommentierte
            Kommentar bearbeiten
            I guess the escape characters are gone as the code was posted as PHP Code

        • #6
          Based on the script I've created a XML file, which can be used to easily create a Virtual Input for loxone.

          Simply paste the following in an XML file, update the IP address and safe it in the right loxone directory.
          Please note that in the Netherlands we have a high and a low price tariff, hence the P1/P2 and N1/N2 values.

          Code:
          <?xml version="1.0" encoding="utf-8"?>
          <VirtualInHttp Title="Youless" Comment="" Address="http://192.168.xxx.xxx/e?f=j" PollingTime="10">
              <VirtualInHttpCmd Title="import from network low tariff" Comment="" Check="\i&quot;p1&quot;:\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
              <VirtualInHttpCmd Title="import from network high tariff" Comment="" Check="\i&quot;p2&quot;:\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
              <VirtualInHttpCmd Title="export to network low tariff" Comment="" Check="\i&quot;n1&quot;:\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
              <VirtualInHttpCmd Title="export to network high tariff" Comment="" Check="\i&quot;n2&quot;:\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
              <VirtualInHttpCmd Title="Current PWR to or from power provider" Comment="" Check="\i&quot;pwr&quot;:\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
          </VirtualInHttp>

          Kommentar


          • #7
            I tried the program and it works. Only the "current power" is always positive, even when my PV installation is producing more power them I am using. Any idea how to change this?

            Kommentar


            • #8
              Zitat von Domoluxe Beitrag anzeigen
              I tried the program and it works. Only the "current power" is always positive, even when my PV installation is producing more power them I am using. Any idea how to change this?
              on the VI in loxconfig you have to check the "signed values" checkbox.

              Kommentar


              • #9
                Hello All,

                i updated the script for use with two inputs:
                1. electrical counter with 1000 led pulses / kWh
                2. gas counter on S0 input with 100 pulses / m3

                Attached is the updated script.

                The original has been update with:
                1. Labmaster's code update
                2. i added a check of the strfind output to make sure the code does not crash the miniserver when looking for the last value - in my case s0 was the last output, and the original code looked for a "," that wasnt there - crashing the miniserver (infinite loop).


                Mike

                Angehängte Dateien

                Kommentar


                • #10
                  Hi i am using the Youless 120 meter (latest firmware enerlogic)

                  With Virtual Input i get the following values:

                  "net": Netto counter,
                  "pwr": Actual power use in Watt
                  "p1": P1 consumption counter (low tariff)
                  "p2": P2 consumption counter (high tariff)
                  "n1": N1 production counter (low tariff)
                  "n2": N2 production counter (high tariff)
                  "Gas": counter gas-meter (in m3)
                  "cs0": S0: kWh counter of S0 input
                  "ps0": S0: Computed power

                  But i am having a little trouble with the visualisation of the youless in Loxone. I want to see more statistics for my "Gas" use and "power consumption"

                  Question1: How can i use the statistics of "gas" value per day / week / month / year?

                  For the power consumption i am using the utility meter block. The " pwr" value of youless is connected "P" of the Meter blok

                  Question2: When i look at the statistics the actual power usage is correct. But the total value is high. I guess it is te total youless metered over many days/weeks. Can i change this value?

                  I included screens of my setup of the energy and gas values.




                  Kommentar


                  • joakin
                    joakin kommentierte
                    Kommentar bearbeiten
                    its "gas" not "Gas" it wont work with capital

                • #11
                  I have this logic atm in loxone. Have a readout on the gas every 10 min them make the subtraction and convert to kWh.

                  I have changed the code a bit to alow negative values (solar panels)

                  //
                  // YouLess LS120 Parser
                  // Tested with YouLess LS120 firmware 1.4.2-EL.DEbg
                  // Tested with Loxone firmware v10
                  //
                  // By: Richard Verkaik
                  //
                  // Version 20190818 (Modified by Mike Stamm)
                  // Useful if only led input and S0 input is used, with S0 JSON output at end of string.
                  // Richard´s version looks for a "," at the end of a value, while if S0 is the last value available, there is no comma after the value.
                  // so looking up S0 in my configuration will crash the miniserver!

                  // AQ1 returns actual power use (kW)
                  // AQ2 returns total gas used (M3) S0 output
                  //

                  enum OutputPorts
                  {
                  PowerRateUsage, // AQ1
                  PowerMeterUsage, // AQ2
                  PowerRateProduction, // AQ3
                  PowerMeterProduction, // AQ4
                  GasUsage // AQ5
                  };

                  // float pwr = GetValue(""pwr":", 0);
                  float GetValue(char *name, float def)
                  {
                  float value = def;
                  int pos = strfind(result, name, 0);

                  if(pos > 0)
                  {



                  if(strfind(result, ",", pos) < 0)
                  {
                  int posend = strfind(result, "}", pos);
                  } else {
                  int posend = strfind(result, ",", pos);
                  }

                  int lenName = strlen(name);
                  int lenValue = posend - (pos + lenName ) + 1;
                  char *svalue = calloc(1, lenValue);

                  //printf ("Name %s found. Pos = %d. Length = %d", name, pos, lenValue);
                  strncpy(svalue, result + pos - 1 + lenName, lenValue);
                  value = batof((char *)svalue+1);

                  //printf ("sValue = %s | Value = %f", svalue, value);

                  free(svalue);
                  svalue = 0;
                  }

                  // printf ("%s = %f", name, value);

                  return value;
                  }

                  //
                  // Main loop
                  // JSON expected: [{"tm":1537431308,"net": 33873.178,"pwr": 336,"ts0":1537365600,"cs0": 0.000,"ps0": 0,"p1": 18736.471,"p2": 15136.707,"n1": 0.000,"n2": 0.000,"gas": 11207.046,"gts":1809201000}]
                  // JSON with only LED electrical power input and S0 input [{"tm":1566393127,"net": 78678.481,"pwr": 363,"ts0":1566393117,"cs0": 16200.848,"ps0": 433}]
                  // ps0 is in gas litres/hr, while cs0 is in m3
                  while(TRUE)
                  {
                  char *host = "192.168.0.32";
                  char *page = "/e?f=j";

                  char *result = httpget(host, page);
                  // printf ("Result: %s", result);

                  if(result != 0)
                  {

                  float elPU = GetValue(""pwr":", 0);
                  setoutput(PowerRateUsage, elPU / 1000);

                  float elEU = GetValue(""net":", 0);
                  setoutput(PowerMeterUsage, elEU);

                  float elPP = GetValue(""ps0":", 0);
                  setoutput(PowerRateProduction, elPP / 1000);

                  float elEP = GetValue(""cs0":", 0);
                  setoutput(PowerMeterProduction, elEP);

                  float GasU = GetValue(""gas":", 0);
                  setoutput(GasUsage, GasU);

                  free(result);
                  }

                  // Sleep
                  int sleepTime = 10;
                  sleeps(sleepTime);
                  }

                  Klicke auf die Grafik für eine vergrößerte Ansicht  Name: Loxone Logic.PNG Ansichten: 123 Größe: 321,4 KB ID: 232016
                  Zuletzt geändert von joakin; 20.03.2020, 10:23.

                  Kommentar


                  • #12
                    Hello

                    I also would like to read out the actual consumed and the actual power my solar panels produce at the moment.
                    I now read out the values from n1,n1,pwr,p1 and p2 like a virtual input from http://192.168.1.254/e?f=j

                    I think those are the values V2 and V4 from the photo but i am unable to find the url where i can find these.

                    Anyone who can help?
                    Thanks


                    Kommentar


                    • #13
                      Hi all,

                      I've made a Fluvius (BE) version of the XML template, which should be compatible with the Youless 1.4.3el firmware.

                      You'll need to add both import and export values and convert the power rate to kwh

                      I don't use the s0 counter from Youless for my PV installation. I can read out the current power value from the inverter by modbus TCP (SMA Tripower).

                      What is the added value of the C-program over the HTTP version?

                      Angehängte Dateien

                      Kommentar


                    • #14
                      I ran the software but got no results other than zero.



                      super mario bros

                      Kommentar

                      Lädt...
                      X