Hi, I need help. I have automation set up and I need the blinds to be tilted according to the height of the sun. So, if it sun is low, it will tilt to 45 degrees if sun is high, tilting to 90 degrees. So I do not have the sun in the house, but always 100% light. I use sun.sun for azimuth and elevation.
Please format your YAML code according to the instructions at the top of the page. If you’re going to use the “Preformatted text” button, then make sure there is blank line before the code (otherwise that won’t work.)
I have automation set up and I need the blinds to be tilted according to the height of the sun. So, if it sun is low, it will tilt to 45 degrees if sun is high, tilting to 90 degrees. So I do not have the sun in the house, but always 100% light. I use sun.sun for azimuth and elevation.
So are you just sharing what you’ve done with the community? Or do you need help with something? If the latter, can you please explain what’s wrong? Or is it simply the automation you wrote doesn’t do what you want it to do?
I’m guessing it’s not working the way you want, but you haven’t explained in detail what you want it to do, in sufficient detail for someone to help you.
E.g., what events do you want to cause the tilt angle to be recalculated? When the elevation and/or azimuth change by a particular amount? Periodically? Between certain times of the day? Etc.? This will help determine what trigger or triggers your automation needs, since triggers control when an automation will (potentially) run its actions.
Once you know when the automation’s actions should (potentially) run, then you need to determine if the actions should run at those times. This helps determine what conditions your automation needs, if any.
Sorry if I’m being “too basic”, but it’s not clear how to help (or if you are even asking for help.)
I will try differently. I need to adjust the tilt action with the numerical position of the sun’s elevation. It’s probably going to be some kind of template?
sun angle 5 ° - tilt angle 45 °
sun angle 10 ° - tilt angle 50 °
sun angle 15 ° - tilt angle 55 °
etc …
I need the angle of the sun to get into
Ok, my guess is that you want to move what you have as the automation trigger (which appears to be some sort of temperature range) into the condition section, and add a trigger for the sun changing. Then you want a template to calculate the tilt angle from the sun’s elevation.
This will cause the actions to run whenever sun.sun’s state (including any of its attributes like elevation and azimuth) changes, but only if the temperature is in the specified range, the weather conditions are as specified, the sun’s elevation is more than 5, and its azimuth is less than 235.
As to calculating the tilt, you don’t really specify completely how that should work, but as a first stab based on what you did say, you want the tilt to be the sun’s elevation plus 40. So, (for the first cover), that might look like this:
I’m sorry, I’m not a native speaker and I’m using G Translator …
The point is that the state of the sun changes every minute. If I use this automation, the blinds will tilt every second with the sun.
Ideal would be if they dove at a major event. Perhaps five degrees each time.
Ok, we can do that by adding another condition to the automation. Oh, and I just noticed there was a typo in what I suggested before. So here is the new trigger and condition parts:
trigger:
platform: state
entity_id: sun.sun
condition:
- above: 25
below: 30
condition: numeric_state
entity_id: sensor.teplota_obyvak
- above: 0
below: 4
condition: numeric_state
entity_id: sensor.yr_symbol
- condition: template
value_template: >
{% if trigger.from_state is not none %}
{% set old_el = trigger.from_state.attributes.elevation %}
{% else %}
{% set old_el = 0 %}
{% endif %}
{% set el = state_attr('sun.sun', 'elevation')|float(0) %}
{% set az = state_attr('sun.sun', 'azimuth')|float(360) %}
{{ el > 5 and az < 235 and (el//5 - old_el//5)|abs > 0 }}
That’s amazing! Thank you very much! It went without a fault. See you on Saturday, under real sun conditions.
Can you please explain what it really means? I would like to learn and possibly adjust it. Once I’ve verified everything, I’ll send the entire code so they can inspire others.
First, in the condition and action parts of an automation there is a variable automatically created named trigger. For a state trigger it has both trigger.from_state and trigger.to_state, which represent what the state it was before it changed and the new state after it changed. It’s possible either might be None, so I have to check for that. So basically, when sun.sun changes, and triggers the automation, I’m getting what the elevation was before the change and what it now is. Then I use the // operator, which is an integer divide, on the before and after elevation values. The result if the //5 will change whenever a multiple of 5 is crossed. Then I subtract them, and the (absolute value) of the difference is zero if the before and after values are in the same multiple of 5, or something other than zero if they are in different multiples of 5.
I hope you can follow that explanation, especially with the language difference. It is harder to put into words than writing it in the first place.
I tried to edit some parameters and works almost perfectly!
As the sun shifts to 5 degrees in elevation, the blinds are pulled and the tilt starts.
I have only one complication with that inclination. When the sun was at an angle of 15 degrees, the tilt turned to 55 (40 + 15), but when the sun was at an angle of 20 degrees, the tilt should change to 60 (40 + 20), but it changed to 58.
You may consider a hysteresis. Operating the blinds on every 5 degree change of sun elevation is probably not good for the durability of the motorized blinds, at least in summer.
I have limited azimuth and elevation. so in winter it only works until it stops on a particular side of the light and in the summer the windows cover me the overhang of the roof, so it does not fall out of time at all. In addition, the maximum is 90 degrees and it covers more than 5 degrees.
In addition, now in the winter is the movement of five degrees about an hour and only when there are no clouds. Then it would make eight moves all day. In the summer, it will be only five tilts than it covers the overhang of the roof, and as soon as the sun goes down it will no longer shine on the side with the blinds.