I don’t see anything here that would “loop.” Also I don’t understand the point of your condition, which isn’t testing anything. (As written, the condition would be true whenever the value is non-zero. EDIT: Actually, now that I think about it some more I think it would never let the automation run. It would always evaluate to some string other than'true'.)
Maybe you could provide some more insight into what problem you’re having.
Can you explain what you want it to do? I can’t figure out what that condition is meant to mean, for example. The condition should bee a boolean (true/false) expression, but yours is a float, so when does the condition hold?
you are right
if I have understand and implement correct (first month user) the code supposed to
check the wind speed and if is >20 km/h would close the awning
however what I forgot to mention is that I prefer to alter the code as below.
My best case scenario is the awning not to be fully closed but partial.
Since I can not set the position easily I thought the following workaround.
But in this case, I think that I have to avoid looping
We’re not sure if it will trigger at all with that condition block, which you should remove. Does your cover not support the cover.cover_set_position service? And what do you mean by “avoid looping”?
No, the thing that checks tha value to determine whether it shoul trigger is the trigger. The condition should be true or false, based on things like whether the sun is up or you set an input_boolean or something. See the documentation link I provided, it has an example of a trigger with a value_template.
Disclaimer: I’m kind of new to home assistant myself.
Let me explain what I need.
My awning is almost always opened. I need to ensure that if it is windy to stay opened but at 20% for example.
So lets say is opened at 50% position. Ideally (if the wind is ?20km/h) the code should say go to 20% .
Since the position is not available I need it to close the awning, then open it and stop after 10 seconds which equals to 20%
But since it will open again and the condtion will met again (wind >20km/h) it will loop (i think)
No, the trigger will only “fire” when the value goes from 20 or below to above 20. In order for the actions to run a second time, the speed would have to go to 20 or below, and then rise above 20 again.
It sounds like you haven’t even tried the code yet. It’s best to experiment and only ask for help when things don’t work the way you expect. We all had to read the docs and experiment a bit to learn how to use HA. Welcome to the club!
Oh I see what you’re saying. Unless you have another automation to open the awning to 100%, it won’t open back up all the way by itself. However, if the wind speed drops below 20 and then goes above 20 again, the automation will fire again, even if the awning is already in the desired position. It would be difficult to prevent this from happening without knowing its position.
One possible solution would be to add a portion to the action: block that turns off the awning automation and create another automation to turn the awning automation back on after the awning automation is off for a certain period of time. Make sense?
You only need a condition if you want an automation to only fire if something else is true. For example, I have an automation to turn on a certain group of lights when I disarm my alarm, but I only want it to turn those lights on at night. So, my trigger is “when the alarm is disarmed,” and my condition is “if it is nighttime.” If I didn’t have the condition, it would fire the automation every time I disarm my alarm.
So, is there a way to make this code to run once a day only?
I mean that in a worst case the wind will go >20 and the awning should go at 20%.
If it will run only once it is fine with me because the awning will be in the desired position.
In general the problem is the following. My wife or my kid probably will forget the awning in whatever position. Some days the wind will rise to 40-50 for 2-3 hours and then drops
I need to be sure that the awning will be at 20% position (when there is wind they don’t play with the awning) . Of course I am not 100% sure that this is the best solution
FWIW, I think your second automation was close. Removing the condition, fixing an indentation error in the action part, and fixing comments, I think this is what you want (at least to start with):
Then create another automation that turns the awning automation back on at whatever time you want (midnight, 08:00, etc.). This will basically tell Home Assistant “after you run this automation, I want you to ignore it until [whatever time you specify in the second automation]”
@ pnbruckner
thanks. this is what I keep to test and see how it goes
it is a coincidence but earlier I installed the life360 integration
I can see me and my wife at home, but I am a little confused regarding an automation I am thinking to make that triggers when we both leave home (to close all the covers)
If it is not much trouble could you provide some sample code to start with?
The logic if noone is at home then close all the covers and light (perhaps and the awning )
@Tediore
super. That’s very fine with me.I will add it
(I am out of home a lot of hours, meaning that I don’t have much time to test and my biggest fear is the awning to jump on and off all day long