HTTP Binding - Server side Javascript

Tags: #<Tag:0x00007faed56e9458> #<Tag:0x00007faed56e9318> #<Tag:0x00007faed56e91d8>

Hi All,

I have a challenge regarding the http binding, and am unable to find any concrete answers on the forums. I’m afraid what i am trying to accomplish is not possible using the http binding. So im looking for either the solution within the http binding or any other smart suggestion.

I own a SolarEdge PV installation and i use the Solar Edge binding to get its data into Openhab. I combine this data with power data from my smart Meter using DSMR-Reader and its API.

I do not own a SE Modbus and am at this moment unable to devide my energiy production and consumption. From the PV installation i know the current incoming SOlar Power, and from the Smart Meter i know how much Power i am returning to the grid. If i could subtract these two i would have the current PV power consumed within my household.

Problem with the SE API is its limit of 1 call each 10 minutes. THe inverter itself however is reachable on my LAN and has the same info with an update rate of 10 seconds. THe Same as my smart meter. This Page runs a Javascript to gather its data and present it. If i point the HTTP binding to the inverter it displays the “You need to have JAVA enabled in your browser” message.

Hope the above sheds enough background on what i am trying to accomplish. In short: Is there Anyway to have the http binding run the javascript on the server side or whats the best next thing?
What i want to accomplish, is

Nope, because it isn’t JavaScript that is the problem, is Java. I’m amazed that in this day and age there is any commercial product that is relying upon Java Applets but it appears this is the case. There really is nothing you can do. You are not loading a web page. What you are loading and seeing when you go to that URL is a Java program. There is no accessible text or data.

Your only hope is to reverse engineer the way that the Java applet communicates with ??? to access the data and then bypass the web page with the embedded applet and go get the data directly.

Hi Rich,

Thank you for the fast reply. Your answer makes a lot of sense. I double checked the source of the webpage and it runs a .js , javascript. I checked the error message that comes back and its;

  You need to enable JavaScript to run the SolarEdge Inverter SetApp.

</noscript>

Since this is not JAVA but Javascript… (Sorry for being incomplete before), would this make any difference in possibility’s when using the http binding?

If you open the developer tools in your browser (in chrome at least, don’t know about others) you can see all the requests your browser is sending. Then it’s just a matter of trying to replicate them, since it’s javascript it should be possible, it’s just regular http requests. You might even get responses in a better format (like json) instead of parsing an entire html document.

OK, that is different.

Anders has the right approach then. You need to see what requests the JavaScript is making to the server and set up the HTTP binding to use those requests instead. You might even be able to look at the JavaScript itself to see what calls are being made.

But to answer your original question, curl doesn’t have a JavaScript engine so no, you can’t make this work using curl and the original URL. You need to figure out the additional calls made by the JavaScript and use those.

Found a solution in the form of a python library specific for the new generation SolarEdge inverters to query the local server. Just as a reference in the off chance anyone else ever finds this thread searching for querying against the local SolarEdge inverter API:

1 Like