This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SolarEdge monitoring website
#1
Hi,

I have a script that gets data from my solar panels from the SolarEdge monitoring site.
This script has worked without problems for the past year, but lately two out of three attempts fail.
For testing I can run the same script on another server in the same network without any problems.

This is the relevant part of the script:

Code:
require('socket')
local https = require("ssl.https")

socket.http.TIMEOUT = 20

local SolarEdge = https.request('https://monitoringapi.solaredge.com/site/1234567/overview?api_key=mykey')

if not SolarEdge then
  alert('SolarEdge data cannot be retrieved..  ' .. tostring(SolarEdge))
  return
else
  log(SolarEdge)
end
At first I thought that I exceeded the maximum number of reads per day but that is not the case. The script runs every 15 minutes (=96 times a day) and Solaredge allows 300 reads.

This is the Alert message:
Code:
SolarEdge data cannot be retrieved  nil
So this is not a SolarEdge server error message.
This is on a LM4 firmware 20160714.

What could be the cause of this?
Reply
#2
I have modified the script to return the error:

Code:
local SolarEdge,err = ...

if not SolarEdge then
  alert('SolarEdge cannot be retrieved.  ' .. tostring(SolarEdge) .."  error:  " ..err)
  return
end
The error that I get is:

Code:
error: recvd alert fatal error
What does this mean?
Reply
#3
You have an outdated firmware that causes this error.
Try requesting like this:
Code:
https = require('ssl.https')
url = 'https://monitoringapi.solaredge.com/site/1234567/overview?api_key=mykey'

resp = {}
res, code, headers = https.request({
  url = url,
  method = 'GET',
  sink = ltn12.sink.table(resp),
  protocol = 'tlsv12'
})

resp = table.concat(resp)
log(res, code, resp)
Reply
#4
(06.05.2021, 09:44)admin Wrote: You have an outdated firmware that causes this error.
Try requesting like this:
Code:
https = require('ssl.https')
url = 'https://monitoringapi.solaredge.com/site/1234567/overview?api_key=mykey'

resp = {}
res, code, headers = https.request({
  url = url,
  method = 'GET',
  sink = ltn12.sink.table(resp),
  protocol = 'tlsv12'
})

resp = table.concat(resp)
log(res, code, resp)

Success!
The strange thing is that my original script not always fails, sometimes I can get the data...
Thanks.

(06.05.2021, 10:15)baggins Wrote:
(06.05.2021, 09:44)admin Wrote: You have an outdated firmware that causes this error.
Try requesting like this:
Code:
https = require('ssl.https')
url = 'https://monitoringapi.solaredge.com/site/1234567/overview?api_key=mykey'

resp = {}
res, code, headers = https.request({
  url = url,
  method = 'GET',
  sink = ltn12.sink.table(resp),
  protocol = 'tlsv12'
})

resp = table.concat(resp)
log(res, code, resp)

Success!
The strange thing is that my original script not always fails, sometimes I can get the data...
Thanks.

Well, unfortunately now I get the same error as with the original script. Two times out of three it fails and then for some reason it works...
Reply
#5
Then the only solution is to upgrade the firmware.
Reply
#6
(08.05.2021, 10:25)admin Wrote: Then the only solution is to upgrade the firmware.

As you probably remember I cannot upgrade at the moment because of an issue with a third party library Angry 

It is strange though that the script works from time to time.

Anyway, I moved the script to another server from where i set the group address values on the LM. Not convenient but it works...
Reply


Forum Jump: