Sun tracking outside shutters

In our house on the south side, I have a large glass wall around the front door with blinds on the outside that I can control via somfy io.

I have been looking for some time now for a way to make the blinds automatically move with the sun angle, but without success.
I started logging manually by setting the angle each time so that no direct sunlight comes in, but this is impossible and the flows become too long…

I would like to control my blinds so that points A and B are in line with the sun as above and continue to follow the sun’s altitude.

Is there anyone who can help me calculate what position the blinds should be in based on the azimuth and altitude.

My blinds are 200mm wide, center distance is 180mm and my house faces 187°

You can try this app. Maybe it will work.
https://homey.app/nl-nl/app/com.cyclone-software.sunevents/Zonnestanden/

I use the app (Zonnestanden App voor Homey | Homey) already for the azimuth and altitude, but I am looking for a calculation that takes into account the dimensions of my blinds.

When the sun shines on the blinds at an angle, the length of the slats changes, which becomes longer and so the angle of the slats must also change.

As your slats most likely have a just a few positions, you might as wel experiment with these few positions, depending upon the actual altitude of the sun. Like a lookup table.

By the way, I don’t think that azimuth is important for the position of the slats. See Azimuth - Wikipedia. The azimuth does define during which hours of the day the slats shall be lowered. This is defined by 2 values, one for in the morning as the slats shall be put down and one value for when the slats shall be raised. You can calculate this 2 values from the orientation of your house in relation to the sun (azimuth) or by measuring this value in the real world.

Shouldn’t the slats always be perpendicular to the sun rays? As in that case they block the sun rays optimal? So depending upon the way you measure the position of the slats, the slats position is (90 decrees minus altitude) or equals the altitude.

I can set my slats in any position I want, it is fully adjustable from 0-100%.

I found this interesting article where everything is described, but how can I apply this in homey?
https://www.mdpi.com/683254

Well, that is a complicated way of controlling the slates. To me the ideal positioning of the slats is when as much as possible lights come in, but no direct sunlight comes in.

The biggest challenge for me was determining when to turn on the shading on individual windows and when to turn it off. The position of the sun doesn’t even play that big of a role here. An important thing is the internal temperature and solar contributions to understand whether to prioritize or block solar contributions. Every day is different and every day has different solar contributions, so it’s not that easy. I have abandoned the implementation of shading according to the position of the sun.

Regarding the positioning of my venetian blinds, I didn’t go into too much detail, I chose one position and always set to that position.

That is also difficult, but I have already completed the part when I want to keep the sun out in a flow.

The only thing I’m looking for is a calculation that the slats just keep the sun out based on the position of the sun.

I initially thought this would be quite simple by calculating the height of the sun. But unfortunately the angle is very different if the sun is not directly in front of the shutters.

So the calculation must take into account the azimuth and altitude of the sun.

Just suppose the sun is at a certain position, and the slats are closed enough to keep the sun out. Then imagine you rotate your house. Then you don’t need to reposition your slats, as the rotation of the house is parallel to the slats. The same is true when not your house rotates but the sun. So the position of the slats is independent of the azimuth and equals the altitude, ie always perpendicular to the sun.
The azimuth does determine the time the slats shall be lowered or raised. As your hous faces 187, the slats shall be lowered between (187-90) and (187+90).

It is true what you say that the sun does not change in height. What does change is the width of the slat when the sun shines on the window at an angle. When the slat becomes wider, the angle must be adjusted again.


L changes and therefore the angle relative to the slat must also change.

I am looking for a calculation that takes the azimuth and altitude of the sun into account and adjusts the shutters accordingly.

I just don’t understand your reasoning. Might be due translations problems.
If you make the angle of the slats equal to the altitude, you almost have the ideal solution. As d is almost L. Even when d equals L the sun would still be blocked.
So when L is a litle bit more then D, the angle of the slats could be a little bit less then the altitude, but I don’t think that is a great difference.

Did you find your solution? can you share sample homey script code/advance flow implementation?

I’m interested to understand:

  1. how did you determined from when to when your shutters should go down e.g., depending on the azimuth or other conditions
  2. how did you end up tilting the slats e.g., dependent on what?

I didn’t manage to make them move with the sun.

I understand the calculation but not how to make it in Homey.

I think you could Chatgpt a homey script for this..
If I have difficult scenarios then I use Chatgpt with instructions:

Context Description:**

This script is designed to fetch data from a specified API endpoint, extract a particular value from the API response, and use that value to create a tag in your system.

The script sends a request to the API endpoint and expects the API to respond with a text response. The script then processes this response to extract the required data. This extracted data is then used to create a tag in your system.

If the tag creation is successful, the script returns a success message indicating the name of the tag and the value used. If an error occurs during the tag creation or during the fetch request to the API, the script returns an error message detailing the error.

This script is designed to be run in a Homeyscript environment and assumes that a tag function is available in your environment for tag creation.

Generic Script:

// Define your API endpoint
var apiEndpoint = 'https://your-api-endpoint';

// Fetch data from the API
return fetch(apiEndpoint, {
  method: 'POST',  // or 'GET', depending on the API
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  body: 'your-request-body'  // if needed
})
.then(response => response.text())
.then(async text => {
  // Extract the value you're interested in
  var lines = text.trim().split('\n');
  var lastLine = lines[lines.length - 1];
  var value = lastLine.split(',')[yourValueIndex];  // replace 'yourValueIndex' with the actual index of your value

  // Create the tag with the extracted value
  try {
    await tag('Your Tag Name', value);
    return 'Created tag: Your Tag Name, value: ' + value;
  } catch (error) {
    return 'Error creating tag: Your Tag Name, error: ' + error;
  }
})
.catch(error => 'Error fetching data from API: ' + error);

In this template, replace https://your-api-endpoint with the actual API endpoint you’re using, 'your-request-body' with the actual request body if you’re making a POST request, yourValueIndex with the actual index of your value in the last line of the API response, and 'Your Tag Name' with the actual name of the tag you’re creating.

##situation description##
Your story

Thanks for your response!
I’ve already been experimenting with HomeyScript and using ChatGPT to develop calculations and scripts.

The most important (and sometimes difficult) part is explaining to ChatGPT in the right way how the script should perform the calculation. :grin: