Read networkbinding xml file from SAJ suntrino inverter

Hi
Im new to openhab, and installed it just to monitor my saj inverter… but i got stuck after installing influxdb and network bindings, so it “finds” my inverter but i don’t know how to get it to read the inverters xml file.

The xml file looks like this
(found at http:///real_time_data.xml) for the inverter
the openhab is installed on proxmox, as an ct.

Blockquote

<real_time_data>

Normal

<Vac_l1>224.9</Vac_l1>

<Vac_l2>226.5</Vac_l2>

<Vac_l3>227.4</Vac_l3>

<Iac_l1>0.52</Iac_l1>

<Iac_l2>0.55</Iac_l2>

<Iac_l3>0.50</Iac_l3>

50.00

49.99

50.00

73

61

86

223

25.8

7.25

9.4

9315.60

9287.65

5000.0

584.7

552.6

-

619.8

7481

0.36

-

-

-

0.31

-

-

-

-

-

-

-

</real_time_data>

Blockquote

Found some one that tried on homeassistant

and

can anyone help me get the final push to get this in openhab, so i can see my graphs?

Hu,
I suggest to install the XML Transformation.
That should do the trick.
Joerg

Hi Jorerg

my programing is more or less then basic, i can copy paste :slight_smile: so if you have any more pointers to push me in the right direction ill be happy… :slight_smile:
First id like to do a small script to test it in the console of the openhab, just dry run so it works, and then add database and so on… :slight_smile:

Henrik,
just have a look at:
https://www.openhab.org/addons/transformations/xpath/
That should explain it.

Joerg

Hi @hwvvse,

did you get this work?

OK, I have the connection running and I get data to my items. I didn’t have time to properly organize the data, but here is my item config for my 3-phase inverter (replace the xxx.xxx.xxx.xxx with the IP address of inverter).

Note: I know that there is difference between WiFi and Ethernet connection, username and password needed to be added on the ones with WiFi (I have wired connection so can’t help much there).

//SAJ Solar inverter
Group               groupSolarInverter      "Solar Inverter"            <energy>   (groupLaundryRoom)                                                   
String              SAJ_xml_state           "Solar Inverter state"                 (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/state/text())]"}
Number              SAJ_xml_Vac_l1          "Solar Inverter Voltage L1"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/Vac_l1/text())]"}
Number              SAJ_xml_Vac_l2          "Solar Inverter Voltage L2"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/Vac_l2/text())]"}
Number              SAJ_xml_Vac_l3          "Solar Inverter Voltage L3"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/Vac_l3/text())]"}
Number              SAJ_xml_Iac_l1          "Solar Inverter Current L1"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/Iac_l1/text())]"}
Number              SAJ_xml_Iac_l2          "Solar Inverter Current L2"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/iac_l2/text())]"}
Number              SAJ_xml_Iac_l3          "Solar Inverter Current L3"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/iac_l3/text())]"}
Number              SAJ_xml_Freq_1          "Solar Inverter frequency"             (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/Freq1/text())]"}
Number              SAJ_xml_P_l1            "Solar Inverter Power L1"              (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/pac1/text())]"}
Number              SAJ_xml_P_l2            "Solar Inverter Power L2"              (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/pac2/text())]"}
Number              SAJ_xml_P_l3            "Solar Inverter Power L3"              (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/pac3/text())]"}
Number              SAJ_xml_Power           "Solar Inverter Power"                 (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:5000:XPATH(/real_time_data/p-ac/text())]"}
Number:Temperature  SAJ_xml_Temperature     "Solar Inverter Temperature"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/temp/text())]"}
Number              SAJ_xml_Power_Today     "Solar Inverter Power Today"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/e-today/text())]"}
Number              SAJ_xml_Time_Today      "Solar Inverter Working Time Today"    (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/t-today/text())]"}
Number              SAJ_xml_Power_Total     "Solar Inverter Total Power"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/e-total/text())]"}
Number              SAJ_xml_Time_Total      "Solar Inverter Total Time"            (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/t-total/text())]"}
Number              SAJ_xml_CO2_Total       "Solar Inverter Total CO2"             (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/CO2/text())]"}
Number              SAJ_xml_Vdc_1           "Solar Inverter Voltage DC1"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/v-pv1/text())]"}
Number              SAJ_xml_Vdc_2           "Solar Inverter Voltage DC2"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/v-pv2/text())]"}
Number              SAJ_xml_Vdc_Bus         "Solar Inverter Voltage DC Bus"        (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/v-bus/text())]"}
Number              SAJ_xml_Power_Today_Max "Solar Inverter Max Power Today"       (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/maxPower/text())]"}
Number              SAJ_xml_Idc_1           "Solar Inverter Current DC1"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/i-pv11/text())]"}
Number              SAJ_xml_Idc_2           "Solar Inverter Current DC2"           (groupSolarInverter)     {http="<[http://xxx.xxx.xxx.xxx/real_time_data.xml:60000:XPATH(/real_time_data/i-pv21/text())]"}

I am getting more into the OpenHab and actually the right way to configure the SAJ inverter would be:

  1. Define thing:

     Thing http:url:SAJInverter "SAJ Inverter" [ baseURL="http://xxx.xxx.xxx.xxx./real_time_data.xml", refresh=10, commandMethod="GET"] {        
        Channels:            
             Type string :   chSAJ_state          [ stateTransformation="XPath:/real_time_data/state/text()"]
             Type number :   chSAJ_Vac_l1          [ stateTransformation="XPath:/real_time_data/Vac_l1/text()"]
             Type number :   chSAJ_Vac_l2          [ stateTransformation="XPath:/real_time_data/Vac_l2/text()"]
             Type number :   chSAJ_Vac_l3          [ stateTransformation="XPath:/real_time_data/Vac_l3/text()"]
             Type number :   chSAJ_Iac_l1          [ stateTransformation="XPath:/real_time_data/Iac_l1/text()"]
             Type number :   chSAJ_Iac_l2          [ stateTransformation="XPath:/real_time_data/Iac_l2/text()"]
             Type number :   chSAJ_Iac_l3          [ stateTransformation="XPath:/real_time_data/Iac_l3/text()"]
             Type number :   chSAJ_Freq_1          [ stateTransformation="XPath:/real_time_data/Freq1/text()"]
             Type number :   chSAJ_P_l1            [ stateTransformation="XPath:/real_time_data/pac1/text()"]
             Type number :   chSAJ_P_l2            [ stateTransformation="XPath:/real_time_data/pac2/text()"]
             Type number :   chSAJ_P_l3            [ stateTransformation="XPath:/real_time_data/pac3/text()"]
             Type number :   chSAJ_Power           [ stateTransformation="XPath:/real_time_data/p-ac/text()"]
             Type number :   chSAJ_Temperature     [ stateTransformation="XPath:/real_time_data/temp/text()"]
             Type number :   chSAJ_Power_Today     [ stateTransformation="XPath:/real_time_data/e-today/text()"]
             Type number :   chSAJ_Time_Today      [ stateTransformation="XPath:/real_time_data/t-today/text()"]
             Type number :   chSAJ_Power_Total     [ stateTransformation="XPath:/real_time_data/e-total/text()"]
             Type number :   chSAJ_Time_Total      [ stateTransformation="XPath:/real_time_data/t-total/text()"]
             Type number :   chSAJ_CO2_Total       [ stateTransformation="XPath:/real_time_data/CO2/text()"]
             Type number :   chSAJ_Vdc_1           [ stateTransformation="XPath:/real_time_data/v-pv1/text()"]
             Type number :   chSAJ_Vdc_2           [ stateTransformation="XPath:/real_time_data/v-pv2/text()"]
             Type number :   chSAJ_Vdc_Bus         [ stateTransformation="XPath:/real_time_data/v-bus/text()"]
             Type number :   chSAJ_Power_Today_Max [ stateTransformation="XPath:/real_time_data/maxPower/text()"]
             Type number :   chSAJ_Idc_1           [ stateTransformation="XPath:/real_time_data/i-pv11/text()"]
             Type number :   chSAJ_Idc_2           [ stateTransformation="XPath:/real_time_data/i-pv21/text()"]
     }
    
  2. Define the items

     //SAJ Solar inverter
     Group               grpSolarInverter      "Solar Inverter"            <solarplant>                                                    
     String              SAJ_state           "Solar Inverter state"                          (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_state"}
     Number              SAJ_Vac_l1          "Solar Inverter Voltage L1 [%.0f V]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vac_l1"}
     Number              SAJ_Vac_l2          "Solar Inverter Voltage L2 [%.0f V]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vac_l2"}
     Number              SAJ_Vac_l3          "Solar Inverter Voltage L3 [%.0f V]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vac_l3"}
     Number              SAJ_Iac_l1          "Solar Inverter Current L1 [%.1f A]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Iac_l1"}
     Number              SAJ_Iac_l2          "Solar Inverter Current L2 [%.1f A]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Iac_l2"}
     Number              SAJ_Iac_l3          "Solar Inverter Current L3 [%.1f A]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Iac_l3"}
     Number              SAJ_Freq_1          "Solar Inverter frequency [%.1f Hz]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Freq_1"}
     Number              SAJ_P_l1            "Solar Inverter Power L1 [%.0f W]"              (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_P_l1"}
     Number              SAJ_P_l2            "Solar Inverter Power L2 [%.0f W]"              (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_P_l2"}
     Number              SAJ_P_l3            "Solar Inverter Power L3 [%.0f W]"              (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_P_l3"}
     Number              SAJ_Power           "Solar Inverter Power [%.0f W]"                 (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Power"}
     Number:Temperature  SAJ_Temperature     "Solar Inverter Temperature [%.1f °C]"          (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Temperature"}
     Number              SAJ_Power_Today     "Solar Inverter Power Today [%.1f kWh]"         (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Power_Today"}
     Number              SAJ_Time_Today      "Solar Inverter Working Time Today [%.1f h]"    (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Time_Today"}
     Number              SAJ_Power_Total     "Solar Inverter Total Power [%.1f kWh]"         (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Power_Total"}
     Number              SAJ_Time_Total      "Solar Inverter Total Time [%.1f h]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Time_Total"}
     Number              SAJ_CO2_Total       "Solar Inverter Total CO2 [%.1f kg]"            (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_CO2_Total"}
     Number              SAJ_Vdc_1           "Solar Inverter Voltage DC1 [%.0f V]"           (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vdc_1"}
     Number              SAJ_Vdc_2           "Solar Inverter Voltage DC2 [%.0f V]"           (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vdc_2"}
     Number              SAJ_Vdc_Bus         "Solar Inverter Voltage DC Bus [%.0f V]"        (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Vdc_Bus"}
     Number              SAJ_Power_Today_Max "Solar Inverter Max Power Today [%.0f kW]"      (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Power_Today_Max"}
     Number              SAJ_Idc_1           "Solar Inverter Current DC1 [%.1f A]"           (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Idc_1"}
     Number              SAJ_Idc_2           "Solar Inverter Current DC2 [%.1f A]"           (grpSolarInverter)     {channel="http:url:SAJInverter:chSAJ_Idc_2"}
    

I note some also some other fields in the xml, however they are empty in my case so I ignored them.
Also I am connected on ethernet and I know that WiFi connection requires also authentication, which should be configured in the thing (see HTTP - Bindings | openHAB)
XPATH transformation is needed for this to work properly.

1 Like

hi
No, ive sold my saj, and got a solax x3 hybrid with batteries :slight_smile:
Just starting it, so now i want it in openhab… but solax has an open api… should be better…

What type of SAJ inverter do you have? Here with me it doesn’t seem to work. Would it be needed to upgrade the SAJ firmware if that’s even possible?
I have a Sununo Plus 4K

This is what I get from the inverter web page. I didn’t do any firmware updates, and that thing is blocked by my firewall from all Internet traffic, so no automatic updates also

  Model:	Suntrio Plus 10K
  Grid Compliance:	C10_11
  Maste Control Firmware Ver:	V2.011
  Slave Control Firmware Ver:	V2.011
  Display Board Firmware Ver:	V3.006
  Ethernet Module Firmware Ver:	V1.018

try to see if you can reach the following:

http://"IP address of your inverter"/real_time_data.xml

I get

real_time_data class=" FB_FW_ext eidReader">
<state>Normal</state>
<Vac_l1>228.6</Vac_l1>
<Vac_l2>233.4</Vac_l2>
<Vac_l3>232.4</Vac_l3>
<Iac_l1>0.33</Iac_l1>
<Iac_l2>0.30</Iac_l2>
<Iac_l3>0.30</Iac_l3>
<Freq1>49.94</Freq1>
<Freq2>49.97</Freq2>
<Freq3>49.96</Freq3>
<pac1>16</pac1>
<pac2>18</pac2>
<pac3>20</pac3>
<p-ac>58</p-ac>
<temp>23.1</temp>
<e-today>0.02</e-today>
<t-today>0.6</t-today>
<e-total>50249.80</e-total>
<CO2>50099.05</CO2>
<t-total>28244.6</t-total>
<v-pv1>265.9</v-pv1>
<v-pv2>519.0</v-pv2>
<v-pv3>-</v-pv3>
<v-bus>620.6</v-bus>
<maxPower>58</maxPower>
<i-pv11>0.28</i-pv11>
<i-pv12>-</i-pv12>
<i-pv13>-</i-pv13>
<i-pv14>-</i-pv14>
<i-pv21>0.19</i-pv21>
<i-pv22>-</i-pv22>
<i-pv23>-</i-pv23>
<i-pv24>-</i-pv24>
<i-pv31>-</i-pv31>
<i-pv32>-</i-pv32>
<i-pv33>-</i-pv33>
<i-pv34>-</i-pv34>
</real_time_data>

Thanks for your quick respons @DarkoG
The Inverter is reachable I get this xml data:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<real_time_data>

<state>Normal</state>

<Vac_l1>230.5</Vac_l1>

<Vac_l2>231.3</Vac_l2>

<Vac_l3>238.3</Vac_l3>

<Iac_l1>0.59</Iac_l1>

<Iac_l2>0.15</Iac_l2>

<Iac_l3>0.15</Iac_l3>

<Freq1>49.98</Freq1>

<Freq2>49.98</Freq2>

<Freq3>49.98</Freq3>

<pac1>0</pac1>

<pac2>0</pac2>

<pac3>0</pac3>

<p-ac>35</p-ac>

<temp>12.4</temp>

<e-today>0.00</e-today>

<t-today>0.0</t-today>

<e-total>46388.40</e-total>

<CO2>46249.23</CO2>

<t-total>19455.1</t-total>

<v-pv1>390.8</v-pv1>

<v-pv2>282.6</v-pv2>

<v-pv3>-</v-pv3>

<v-bus>607.1</v-bus>

<maxPower>53</maxPower>

<i-pv11>0.13</i-pv11>

<i-pv12>0.00</i-pv12>

<i-pv13>-</i-pv13>

<i-pv14>-</i-pv14>

<i-pv21>0.10</i-pv21>

<i-pv22>0.00</i-pv22>

<i-pv23>-</i-pv23>

<i-pv24>-</i-pv24>

<i-pv31>-</i-pv31>

<i-pv32>-</i-pv32>

<i-pv33>-</i-pv33>

<i-pv34>-</i-pv34>

</real_time_data>

The log gives me this error

2024-01-18 10:24:47.941 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/t-total/text() not found!

2024-01-18 10:24:47.941 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/Vac_l2/text() not found!

2024-01-18 10:24:47.942 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/pac1/text() not found!

2024-01-18 10:24:47.943 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/pac3/text() not found!

2024-01-18 10:24:47.944 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/p-ac/text() not found!

2024-01-18 10:24:47.945 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/e-total/text() not found!

2024-01-18 10:24:47.945 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/v-pv1/text() not found!

2024-01-18 10:24:47.946 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/v-bus/text() not found!

2024-01-18 10:24:47.947 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/Freq1/text() not found!

2024-01-18 10:24:47.948 [WARN ] [.transform.SingleValueTransformation] - Transformation service XPATH for pattern /real_time_data/v-pv2/text() not found!

You need to install the XPATH transformation from the addons in Openhab

1 Like

Yes now it works.
Thank you so much

By any chance, does someone knows if this also works for SAJ inverters from the R-series.
These are newer but seem not to have a webinterface where one can read out this data.