Willkommen im Loxone Community Forum. Um alle Funktionen nutzen und sehen zu können, registriere dich bitte zuerst. Dies gilt auch für das herunterladen von Dateien.
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
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?
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.
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"p1":\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"p2":\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"n1":\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"n2":\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"pwr":\i\v" Signed="true" Analog="true" SourceValLow="0" DestValLow="0" SourceValHigh="100" DestValHigh="100" DefVal="0" MinVal="-100000" MaxVal="100000"/>
</VirtualInHttp>
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?
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.
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).
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.
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
//
//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";
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.
Wir verarbeiten personenbezogene Daten über Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen, Werbung zu personalisieren und Websiteaktivitäten zu analysieren. Wir können bestimmte Informationen über unsere Nutzer mit unseren Werbe- und Analysepartnern teilen. Weitere Einzelheiten finden Sie in unserer Datenschutzrichtlinie.
Wenn Sie unten auf "Einverstanden" klicken, stimmen Sie unserer Datenschutzrichtlinie und unseren Datenverarbeitungs- und Cookie-Praktiken wie dort beschrieben zu. Sie erkennen außerdem an, dass dieses Forum möglicherweise außerhalb Ihres Landes gehostet wird und Sie der Erhebung, Speicherung und Verarbeitung Ihrer Daten in dem Land, in dem dieses Forum gehostet wird, zustimmen.
Kommentar