Displaying data from XML and using it for rules

Hi,
I’m pretty new to this but working things out as I go…

I need to find a way to read the “OutputVoltage” element from the following XML, which is accessed on my local network via the url http://192.168.1.10/meters.xml

<response>
<OutputPower>0.000</OutputPower>
<InputPower>0.000</InputPower>
<InputPower2>0.000</InputPower2>
<InputVoltage>0.0</InputVoltage>
<InputVoltage2>0.0</InputVoltage2>
<OutputVoltage>0.0</OutputVoltage>
<Irradiance>1339</Irradiance>
<Temperature>39.3</Temperature>
<Events>00000000000000000000000000000000</Events>
<HeaterPower>0.000</HeaterPower>
<GridPower>-2.544</GridPower>
</response>

I’d like to show this as a Number item and thereafter create a rule based on it value that sends conditional data to a specific MQTT topic (received by an arduino thats controlling a relay).

So far my attempts have failed though. My Item (home.items) is setup as follows;

Number OutPut "Output [%.2f kWh]" {http="<[http://192.168.1.10/:3000:XSLT(meters.xsl)]"}

with a transform (home.transform) of;

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output indent="yes" method="xml" encoding="UTF-8" omit-xml-declaration="yes" />

<xsl:template match="/">
	<xsl:value-of select="(//response/OutputVoltage)[last()]"/>
</xsl:template>
</xsl:stylesheet>

i’m clearly missing a step here though because no local copy of meters.xsl is being created in the transform folder - I assume thats how it works?

Would appreciate any help anyone can give me to get this data read from the XML and displayed on my openhab sitemap

Cheers

meters.xsl isn’t automatically created in the transform folder, that’s the file you should be using to do the transform.

All you need to do is rename your home.transform file to meters.xsl under the configurations\transform folder…That should be it…

That looks very much like the output of an Enasolar solar inverter? Are you based in NZ? I have one of these and do things slightly differently. I have a little python script which polls the /meters.xml endpoint every 5 seconds, parses the XML, and then publishes the values to a set of MQTT topics.

Then I have a simple MQTT binding in openHAB for displaying the values direct from those topics. This has been running great for 2 years.

Would be happy to share the script if you are interested?

You’ve hit the nail on the head; I am in NZ and it is the output from the Ensolar inverter. If you would be happy to share that, I’d really appreciate it as I started off trying it with python but didn’t get very far so tried this method instead.

I’m actually trying to create some extra logic on the Immersun product that works with the Ensolar inverter by gathering data from the HWC, immersun and weather forecast to determine if I should boost the HWC overnight or leave it and let it recharge the next day.

Thank you!

You legend! Thank you