Page 13 of 13

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Saturday 30 March 2019 11:17
by Derik
multinet wrote: Saturday 30 March 2019 11:07 I found the last version of the script on GitHub running well using dark sky
And that is working?

Why is no one using open weather map??
https://openweathermap.org/

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Saturday 30 November 2019 13:03
by Toulon7559
Since 2016 running the script on 2 Raspberries (under application of air pressure from local BMP180 in Domoticz, and with read-out of Ogimet with fixed input for location).
On October 15th, 2019 both processors stuck due to LAN-breakdown & later rebooted with latest beta-upgrade of Domoticz, and to my surprise the script is not running anymore on both processors.

If 'normally' running the script, then the error report in the Log refers to component 'pow' in this line
M0 = math.sqrt(1229 + math.pow(614 * sinusSunAltitude,2)) - 614 * sinusSunAltitude
This error report only appears once after een reboot.

If running the lua-script from the CLI, then either
no error (= just blank cli after command-input), or
the error report refers to the scriptline
if (uservariables['octa'] == nil) then print("Error : Did you create the Uservariable octa ?") end

Puzzled, because nothing changed in the script, and the uservariable 'octa' is not nil

Anybody seeing similar effects? Any explanation for this effect? Possible remedy?

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Saturday 30 November 2019 17:03
by waaren
Toulon7559 wrote: Saturday 30 November 2019 13:03 If 'normally' running the script, then the error report in the Log refers to component 'pow' in this line
M0 = math.sqrt(1229 + math.pow(614 * sinusSunAltitude,2)) - 614 * sinusSunAltitude
Puzzled, because nothing changed in the script, and the uservariable 'octa' is not nil
Could it be related to the switch from Lua 5.2 to Lua 5.3 in domoticz ?
If so have a look at this

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Saturday 30 November 2019 18:15
by Toulon7559
@waaren

Probably right that the upgrade to Lua5.3 is the culprit.
Have adapted the script at 4 places for math.pow(x,y) => x^y and at one machine the output immediately flipped to realistic value (= 0 during this nighttime) without errors: next morning in daytime the values seem practical as well.
Application at second machine first stubbornly refused, but followed next morning at start of daytime.

Had missed the thread related to that Lua_upgrade:
;-) consequence of going on holiday ...........

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Sunday 12 April 2020 12:39
by reneklomp
I am confused... I copied the script (that is now using darksky but I believe that is irrelevant for my observation) to my Domoticz instance.
The values for Solar Altitude and Azimuth seem to be very realistic. However, from the graphs I observed Azimuth was going through 0 degrees sometime between 7:00 and 7:05 this morning whereas both Domoticz and Google tell me Sunrise was at 6:45 today. So it seems there is something wrong in the calculation of at least the Solar Azimuth...? Or am I missing something? (I am using consistent longitude, latitude for both).

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Posted: Tuesday 12 May 2020 12:24
by dheuts
Seems the wiki is offline. Where to find it?
jmleglise wrote: Tuesday 19 January 2016 22:23 This script is documented in the wiki : http://www.domoticz.com/wiki/Real-time_ ... _sensor...

Edit 19 March 2016 - V1.4 - Take the last version of this script in the wiki. http://www.domoticz.com/wiki/Real-time_ ... structions

Edit 3 sept 2017 - V2 - The script is now translated in dzevent framework http://www.domoticz.com/forum/viewtopic ... 59&t=19220

------
Hi everyone,

This LUA script calculates in real-time a lot of usefull solar data without any hardware sensor. The result is very satisfactory. I hope you will enjoy it.

Data :
Azimuth : Angle between the Sun and the north, in degree. (north vector and the perpendicular projection of the sun down onto the horizon)
Altitude : Angle of the Sun with the horizon, in degree.
Lux : radiation of the sun with real time cloud layer
and many more

The calculation is based on the theoretical radiations of the sun according to its location in the sky, calculated according to the time and the number of day in the year, plus the real-time cloud layer and the real-time weather (pressure) :
- Geographical address
- Altitude of the geographical point
- Atmospheric pressure of the place / from api.wunderground.com
- The cloudiness in Octa (1/8) / from ogimet.com

-- What is it For ? ------------------------------------------------------
Manage exactly roller blinds and venetian blind. both to optimise the heating and to prevent dazzle.
Manage your light according to the Luminosity
Use civil twilight dawn and dusk (-6 deg altitude) instead of sunrise and sunset.
Some calculation about photovoltaic production ?
Automate the heating of swimming pool
Personally I use a roller blind to wake up instead of an alarm clock, with a progressive opening of the roller blind to prevent dazzle.

-- History ------------------------------------------------------
I have improved the huge work of Sébastien Joly (on an another automation system) that Neutrino has migrated to Domoticz.

I deeply encourage you to visit the very interesting, original post in French : http://www.domotique-info.fr/2015/09/ou ... ecenter-2/
And the others documentations and source of the formulae :
http://www.plevenon-meteo.info/techniqu ... ement.html
http://herve.silve.pagesperso-orange.fr/solaire.htm
https://en.wikipedia.org/wiki/Azimuth
https://en.wikipedia.org/wiki/Dawn
There was even already a first implementation of these formulae here http://www.domoticz.com/forum/viewtopic.php?f=23&t=6793, but I choose to complete the other implementation.