Forecast of the yield of solar panels
Posted: Sunday 14 April 2019 15:26
As a continuation of solved topic https://www.domoticz.com/forum/viewtopi ... 59&t=27565 I start a new one to achieve another goal: I want to represent the estimation of my solar panels for today and tomorrow in the dashboard of Domoticz.
I thought:
fill a virtual sensor with estimated Watts for this hour and total Watt-hours_today
and a second sensor with estimated Watt-hours expected tomorrow.
It should be possible with the result of a call to http://doc.forecast.solar/. The request https://api.forecast.solar/estimate/51/5/45/10/3.5 sends a lot of information.
Problem is that the layout from http://forcast.solar is quite different than the for me known layout of JSON.. As an example: When I ask the results of my dustsensor http://192.168.1.41/data.json it gives:

I would use the command: updateCustomSensor(item.json.sensordatavalues[x].value)
So that I can rebuild a working script that I now use for reading my dustsensor and which does a great job!
But the first problem is: the layout of those files from my dustsensor (shown above) and that from forecast.solar (a kind of textfile) are different in my browser... Why?
When I give curl -H "Accept: application/json" https://api.forecast.solar/estimate/51/5/45/10/3.5 in putty on my Synology I get long output and no numbers for sensordata. Can you explain this to me? And give a hint for a solution for a script?
Use Domoticz V4.9700 on a Synology DS718+
Any help appreciated..
I thought:
fill a virtual sensor with estimated Watts for this hour and total Watt-hours_today
and a second sensor with estimated Watt-hours expected tomorrow.
It should be possible with the result of a call to http://doc.forecast.solar/. The request https://api.forecast.solar/estimate/51/5/45/10/3.5 sends a lot of information.
Problem is that the layout from http://forcast.solar is quite different than the for me known layout of JSON.. As an example: When I ask the results of my dustsensor http://192.168.1.41/data.json it gives:

I would use the command: updateCustomSensor(item.json.sensordatavalues[x].value)
So that I can rebuild a working script that I now use for reading my dustsensor and which does a great job!
Code: Select all
local FQDN = 'luftdaten.xxxx.xx'
return {
active = true,
on = {
timer = { 'every minute' },
httpResponses = { 'luftdatenRetrieved' } -- matches callback string below
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://192.168.1.41/data.json',
method = 'GET',
callback = 'luftdatenRetrieved'
})
elseif (item.isHTTPResponse) then
if (item.ok and item.isJSON) then -- statusCode == 2xx
if tonumber(item.json.age) < 60 then
-- 1: SDS_P1 PM10, 2: SDS_P2 PM2.5, 3: DHT22 temp, 4: DHT22 hum
domoticz.devices('Luftdaten PM10').updateCustomSensor(item.json.sensordatavalues[1].value)
domoticz.devices('Luftdaten PM2.5').updateCustomSensor(item.json.sensordatavalues[2].value)
domoticz.devices('Buitentemperatuur').updateTempHum(item.json.sensordatavalues[3].value,item.json.sensordatavalues[4].value,0)
end
else
-- oops
domoticz.log('Error fetching Luftdaten data', domoticz.LOG_ERROR)
domoticz.log(item.data, domoticz.LOG_ERROR)
end
end
end
}When I give curl -H "Accept: application/json" https://api.forecast.solar/estimate/51/5/45/10/3.5 in putty on my Synology I get long output and no numbers for sensordata. Can you explain this to me? And give a hint for a solution for a script?
Use Domoticz V4.9700 on a Synology DS718+
Any help appreciated..
