Sun declination

I am planning to install automation on my existing blinds. The main function is to drop the blinds when the sun will come into the lounge and raise them again when the sun is not shining on the floor and sofa. An optical sensor is not viable for a few reasons, so I was hoping that sun.sun and a weather station that measures solar radiation would suffice…. Or my PV solar system readout could help.

I know you can get elevation and azimuth from sun.sun, but after looking at the readings for a few weeks, I think declination will play a role of calculating when the sun will enter the house.

Is there a way of calculating that in an automation, linked to the other readings?

1 Like

Hi,

Don’t declination, elevation and latitude depend on each other? I live at a latitude of N 51° - suns elevation is 16° in Januar and its declination -23°.
In July the elevation here will be 62° and the declination is 23° ← both are the highest values we will have here.
In other words: the sun is always shinning through our windows. How deep the sun beams will get into a room, depends IMHO also on the height of the window. Usually this is refered to as lenght of the shadow at a certain time.

It might be different, if you live close to the equator or close to or between the latitudes 23° to - 23°.
At a latitude of 23° suns elevation is 90° and its declination is 23° in July.
At a latitude of -23° it’s the other way round: sun elevation is 90° and declination -23° somewhen in January at noon.

ps
I forgot to add, that you should be fine with using the azimuth. When a certain azimuth degree is reached changes by date. For example here the sun is not up yet when it reaches an azimuth of 110° while in July it is reached at 11:00h.

Does this help?

sun.sun gives you:

  • azimuth: degrees from North where the sun is
  • elevation: degrees above the horizon

Both are based on the location you specified in HA, and current date/time, so that’s all you need at that level.

Now, you will have to find out, empirically or with trigonometry, the range of azimuth and elevation where the sun touches you floor and sofa.

2 Likes

Here is a pretty involved discussion trying to do the same thing you want to do that was solved.

I’m not sure if the links in the thread pointing to the OP’s charts for when the blinds needed to be in which positions are still active or not but you can get the gist of a solution that might work for you.

Or if you need the charts as an example you can reply to that thread and the OP might provide them to you.

yep, the table I created for my dear friend @finity is still active, check it out. I was using suncalc.org to properly get the desired matrix.

I also had the intention to take seasons (plus clouds) into consideration, but that was the point when our friendship with Finity cooled down a bit :smiley: haha, just kidding, but it was just becoming seeeriously complex then.

How I solved this problem in the meantime: I installed a 12 kWp solar system, and based on the AC Power Out level I can decide how sunny the situation is out there (based on my experience it starts to get really sunny when my solar production is over 4000W at any moment). Plus the automation is only running in summer months, since during the winter I want the exact opposite to happen, I want as much sunlight (thus heat) to get into the house as much possible, to reduce electricity costs on my Daikin Altherma heatpump.

Go for it, @finity 's solution is quite clever yet simple, and 100% working, will be eternally grateful to him! (Cheers buddy!)

1 Like

Hi there,
I had the same problem few months earlier. I noticed empirically that in my area a particular day and time when my covers should roll down (the time that the sun started to come in the house) the azimuth value was for example 132.30. I also noticed that the azimuth value for the particular cover was changing by 0.25 points each day (roughly). So with the help of a friend from the forum (123 Taras ) we made the below sensor which is working quite good (not 100% accurate but very very close)

my_azimuth_sensor:
      friendly_name: 'My Azimuth Sensor'
      value_template: >-
        {% set x = states('sensor.date') %}
        {% set today = now() %}
        {% set dec21 = now().replace(day=21).replace(month=12).replace(hour=0).replace(minute=0).replace(second=0).replace(microsecond=0) %}
        {% set jun21 = now().replace(day=21).replace(month=6).replace(hour=0).replace(minute=0).replace(second=0).replace(microsecond=0) %}
        {% set previous_dec21 = now().replace(year=now().year-1).replace(month=12).replace(day=21).replace(hour=0).replace(minute=0).replace(second=0).replace(microsecond=0) %}
        {% set jun20_value = 127 + ((jun21 - timedelta(days=1)) - previous_dec21).days * 0.31 %}
        {% if today >= dec21 %}
          {% set y = 127 + (today - dec21).days * 0.31 %}
        {% elif today < jun21 %}
          {% set y = 127 + (today - previous_dec21).days * 0.31 %}
        {% else %}
          {% set y = jun20_value - ((today - jun21).days * 0.31) %}
        {% endif %}    
        {{ y | round(2) }}

here is the link of the discussion.

The azimuth value is getting bigger from 21 Dec to 20th of June and then goes smaller from 21 of June until 20th of December. (each day ~0.25 points)

1 Like

Thanks all. I have a bit of reading there.

I know there are web sites, tables and calculations that will tell me the current declination for my location. The issue is getting that into an automation, when like sunset and sunrise, it changes every day.

As an example, on our “west” facing windows (about 277-degrees) a month ago, the sun would start coming onto the floor when the elevation dropped to 50-degrees. Now it is coming in when elevation is in the late 40s because it is sneaking under the eaves with the change in declination. That means I need an “IF AND” argument. It’s further complicated by the shadows from a neighbour’s house which protects one window earlier than the other.

Thanks again for the info.

That PV output is exactly what I had in mind. On cloudy days, the blinds can stay open. I am also looking at my solar PV output to work with the booster on my solar hot water.

I have an Enphase system so I can measure the output of a panel near the hot water collectors. If it does not get above a certain level during the day, I will have my booster come on. I am also thinking about a variation that would say if production is below x, the booster will come on for an hour. If below y, it is on for 2 hours.

Hi,
can you please enlighten me?
The azimuth value (when the sun starts to come in the house/window) is the whole year the same, only the time changes.
So what is this about? I read in the other thread what you do with this sensor

but I have no idea what it’s good for. The sensor gives me 172.88 and if my azimuth would be bigger than that, the sun almost would be in the south. But my cover has to close at 130° - every sunny day.

This obviously depends on where you live. Unless you are living together with @Makis :wink:

The position of the sun in the sky is two dimensional, yes there is a third dimension, distance (but it is irrelevant, it is effectively infinity).

Therefore the azimuth and elevation are sufficient to identify where in the sky the sun is from your place on earth. In a 2 dimensional space two orthoganal co-ordinates define any point.

The difficulty is translating that into “when the sun is coming through that window at an annoying angle”. With a compass and a protractor you can work out what angles and elevations are relevant. You’ll end up with a range of values for azimuth and elevation.

Reminder that azimuth is the angle of the sun as it progresses across the sky. In the northern hemisphere that will be due south or 180 deg at midday. In the southern it is due north at midday or 0 deg. (It won’t really be because timezones aren’t like that, but you get the idea.)

Elevation is the angle above the horizon. At midday on the shortest day the elevation will be lower than at midday on the longest day. But the azimuth will still be 180/0.

TL;DR - azimuth and elevation is all you need to know, and automate accordingly.

1 Like

Yeah, I know that. But the azimuth he was talking about is 132° which is similar to mine.

as @sjee says that is depend on where you are living. I sawed (empirically) that the right position of azimuth in my country (Greece) changed every day for approx. 0.25 points so I noticed that I needed calculation to change the azimuth number each day by approx by 0.25 points. In the above example of my sensor you probably have to change

 {% set y = 127 + (today - dec21).days * 0.31 %}
        {% elif today < jun21 %}
          {% set y = 127 + (today - previous_dec21).days * 0.31 %}
        {% else %}
          {% set y = jun20_value - ((today - jun21).days * 0.31) %}

the *0.31 with your value.
Lets assume that the azimuth position in your country (Sweden or Norway?) changes every day by 0.05 you have to use this value in your calculation.
To be honest I never test it with another region so I am not sure how it will work.

I remember that I have made a formula in a excel sheet to calculate the azimuth value in order to test the values of the sensor with the above logic. Maybe you could try it this way first in a excel sheet.

Mark down todays azimuth value and the next day see how much it changed.

In order to have a better understanding, in October for example the sensor gives a value of 124 and in July the value goes to 170 which in my case is the correct values. All depends in the *0.31 in the above calculation and the 127 value. You have to place yours azimuth number.

So if today your azimuth value is 130 and the azimuth changes every day by 0.05 you have to change
everywhere the
{% set y = 127 + (today - previous_dec21).days * 0.31 %}
{% set y = 130 + (today - previous_dec21).days * 0.05 %}

I also don’t know if @123 Taras can test in his country the sensor values.

No sorry, the azimuth does not change every day. The time the sun is at a given azimuth changes.
The sun hits my terrace window every day at the same azimuth of 130° - in winter it would hit at around 09:00h, today at 11:00h and in July at around 11:30h.
Since this apartment is on top of a bulding (a penthouse if you will) and there are no higher surrounding building, suns elevation doesn’t mater.

1 Like

I really can’t work out what you are on about.

Consider the simplest case, you live on a flat plain. You sit outside and look due south (in the northern hemisphere). From the moment the sun rises until it sets, you have glare.

Now move inside and look in the same direction through a window. Now the sun is only in your eyes when it shines through the window. The boundaries are fixed for any point in the room. They are uniquely defined by a series of azimuth/elevation co-ordinates.

Well then your azimuth is your trigger.

1 Like

Well, I use cloud coverage as trigger and the azimuth range as a condition. If the cover was triggered once it stays in this position until suns azimuth is >260°

I understand what you are getting at and distance is really irrelevant here as you observe. However declination influences elevation. The sun tracks a much higher (southern) arc in summer than it does in winter (northern arc). The declination today is about 19.5°. In January it was -22.9°. An elevation that lets sun come in during March doesn’t even register during May in Australia.

By that I mean in March sun would start entering my windows when it dropped to an elevation of about 50°, but today the sun here did not get above an elevation of 43°. However because it tracks lower in the northern sky, with the orientation of the house and size of the eaves, the sun started entering the windows when the elevation was about 41°. (From suncalc.org).

My issue is how to frame an automation that says “On 1 Jan close the blinds at 50°, but on 18 May, close them at 41°”… and all the increments in between.

1 Like

You should able to define suitable parameters for elevation and azimuth of the sun. The values for which these need to trigger an action won’t normally change , The time they occur will change during the year of course.

1 Like