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…