Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

  • 0

Solar azimuth and elevation

Guest cberbecaru


Guest cberbecaru



Here is a stripped down LUA port of the SunCalc JavaScript library by Vladimir Agafonkin (@mourner)

Please login or register to see this link.


I've done some minor modifications to the code, mainly due to the fact that the original functions returned the result in radians. Also, the result was negative or positive relative to the South direction, so I converted it to heading in degrees: 0 - North, 90 - East, 180 - South, 270 - West. I've ported just the azimuth and elevation computation (for now).


The scene updates 2 simple global variables (must be created first, names can be changed), and based on these variables, scenes can be triggered, or a VD can display the data. Tested by entering Vladimir's data (see test.js) and by knowing that today at 13:26 was solar noon at my location (180° azimuth at that time - see attached picture).


I use this scene to drive my sunshades through the day when is hot outside :)



Please login or register to see this code.


Please login or register to see this attachment.

Edited by cberbecaru
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...