knaxman
(Ralph Burgstahler)
January 26, 2020, 2:36pm
#1
Hi guys,
I have a StecaGrid PV inverter and want to get that into Openhab.
Now I figured I can access the actual values via an IP Adress and XML File call.
So now I could call that every 60 seconds and get them into my OpenHab ecosystem.
The XML Looks like this:
<root>
<Device Name="StecaGrid 3600" Type="Inverter" Platform="Net11" HmiPlatform="HMI13" NominalPower="3680" UserPowerLimit="nan" CountryPowerLimit="nan" Serial="742119XC004700500044" OEMSerial="" BusAddress="1" NetBiosName="INV004700500044" WebPortal="Steca sunCloud" ManufacturerURL="www.steca.com" IpAddress="192.168.178.205" DateTime="2020-01-26T15:16:48">
<Measurements>
<Measurement Value="232.4" Unit="V" Type="AC_Voltage"/>
<Measurement Value="0.914" Unit="A" Type="AC_Current"/>
<Measurement Value="201.9" Unit="W" Type="AC_Power"/>
<Measurement Value="50.007" Unit="Hz" Type="AC_Frequency"/>
<Measurement Value="400.3" Unit="V" Type="DC_Voltage"/>
<Measurement Value="0.513" Unit="A" Type="DC_Current"/>
<Measurement Value="22.1" Unit="°C" Type="Temp"/>
<Measurement Unit="V" Type="LINK_Voltage"/>
<Measurement Unit="W" Type="GridPower"/>
<Measurement Unit="W" Type="GridConsumedPower"/>
<Measurement Unit="W" Type="GridInjectedPower"/>
<Measurement Unit="W" Type="OwnConsumedPower"/>
<Measurement Value="100.0" Unit="%" Type="Derating"/>
</Measurements>
</Device>
</root>
Could someone give me some ideas how to do this.
namraccr
(namraccr)
January 26, 2020, 4:17pm
#2
Why should anyone do your research for you?
knaxman
(Ralph Burgstahler)
January 26, 2020, 4:45pm
#3
Dsn’t want all work done from you guys, but some hints regarding how you would do it, which binding etc. would help me a lot. I just started with OpenHab easily start completly in the wrong direction.
knaxman
(Ralph Burgstahler)
January 27, 2020, 8:59pm
#5
great thanks,
I’m trying to get the right XPath expression to extract e.g. AC_Voltage; an proceed in the http binding.
Number AC_Power “AC_Power [%s]” {http="<[http://192.168.178.205/measurements.xml:6000:XPATH(/Device/Measurements/Measurement/[@Type=“AC_Voltage”]/Value/text() )]"}
XPath expression is wrong, I’ve been trying with https://www.freeformatter.com/xpath-tester.html
How can I get the values in this XML structure?
knaxman
(Ralph Burgstahler)
January 29, 2020, 9:07pm
#6
String PV_AC_Voltage "AC_Voltage [%s] " { http="<[http://192.168.178.205/measurements.xml:6000:XPATH(number(//Measurements/Measurement[@Type='AC_Voltage']/@Value))]" }
The Result ist:
2020-01-29 22:02:37.935 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type XPATH
2020-01-29 22:02:37.940 [WARN ] [ab.binding.http.internal.HttpBinding] - Couldn't transform response because transformationService of type 'XPATH' is unavailable
2020-01-29 22:02:37.961 [vent.ItemStateChangedEvent] - PV_AC_Voltage changed from <?xml version='1.0' encoding='UTF-8'?><root><Device Name='StecaGrid 3600' Type='Inverter' Platform='Net11' HmiPlatform='HMI13' NominalPower='3680' UserPowerLimit='nan' CountryPowerLimit='nan' Serial='742119XC004700500044' OEMSerial='' BusAddress='1' NetBiosName='INV004700500044' WebPortal='Steca sunCloud' ManufacturerURL='www.steca.com' IpAddress='192.168.178.205' DateTime='2020-01-29T22:01:27' ><Measurements><Measurement Value='222.2' Unit='V' Type='AC_Voltage'/><Measurement Unit='A' Type='AC_Current'/><Measurement Unit='W' Type='AC_Power'/><Measurement Value='47.285' Unit='Hz' Type='AC_Frequency'/><Measurement Value='0.0' Unit='V' Type='DC_Voltage'/><Measurement Unit='A' Type='DC_Current'/><Measurement Unit='°C' Type='Temp'/><Measurement Unit='V' Type='LINK_Voltage'/><Measurement Unit='W' Type='GridPower'/><Measurement Unit='W' Type='GridConsumedPower'/><Measurement Unit='W' Type='GridInjectedPower'/><Measurement Unit='W' Type='OwnConsumedPower'/><Measurement Value='100.0' Unit='%' Type='Derating'/></Measurements></Device></root> to <?xml version='1.0' encoding='UTF-8'?><root><Device Name='StecaGrid 3600' Type='Inverter' Platform='Net11' HmiPlatform='HMI13' NominalPower='3680' UserPowerLimit='nan' CountryPowerLimit='nan' Serial='742119XC004700500044' OEMSerial='' BusAddress='1' NetBiosName='INV004700500044' WebPortal='Steca sunCloud' ManufacturerURL='www.steca.com' IpAddress='192.168.178.205' DateTime='2020-01-29T22:01:35' ><Measurements><Measurement Value='233.1' Unit='V' Type='AC_Voltage'/><Measurement Unit='A' Type='AC_Current'/><Measurement Unit='W' Type='AC_Power'/><Measurement Value='49.746' Unit='Hz' Type='AC_Frequency'/><Measurement Value='0.0' Unit='V' Type='DC_Voltage'/><Measurement Unit='A' Type='DC_Current'/><Measurement Unit='°C' Type='Temp'/><Measurement Unit='V' Type='LINK_Voltage'/><Measurement Unit='W' Type='GridPower'/><Measurement Unit='W' Type='GridConsumedPower'/><Measurement Unit='W' Type='GridInjectedPower'/><Measurement Unit='W' Type='OwnConsumedPower'/><Measurement Value='100.0' Unit='%' Type='Derating'/></Measurements></Device></root>
This looks like XPATH alwasys reverts the complete XML.
Any idea, what I’m doing wrong?
rossko57
(Rossko57)
January 29, 2020, 9:58pm
#7
Transformation services do that when the transform fails.
Yes -
It’s an installable service
knaxman
(Ralph Burgstahler)
January 30, 2020, 8:20pm
#8
Thousand thanks; now it works perfectly:
For all others searching a StecaGrid solution:
// Steca PV - Inverter integration
String PV_AC_Voltage "AC_Voltage [%s] " { http="<[http://192.168.178.205/measurements.xml:6000:XPATH(number(//Measurements/Measurement[@Type='AC_Voltage']/@Value))]" }
String PV_AC_Power "AC_Power [%s] " { http="<[http://192.168.178.205/measurements.xml:6000:XPATH(number(//Measurements/Measurement[@Type='AC_Power']/@Value))]" }
and it works!