Hi there, I have some on/off interval codes for fans. I would like to split this code as two time zone.
But I’m a bit struggling to solve. Here is the code:
I don’t want disable anything. The code that I sent run as loop whole day. I would like to run that code as two different intervals in two different time zone (code 1- 7.00 AM to 7.00 PM and code 2- 7.00 PM to 7.00 AM). I just want to add time condition.
Ok, that’s not how I understood what you were asking for. You said “weekdays”, which usually means Monday through Friday.
If you want to just change the interval based on time of day (and run the automation on all days), then simply remove the first condition from the suggestion I made above.
If you want to run the actions all week, and you want them to run every 30 min between 7:00 AM and 7:00 PM, and every 10 min between 7:00 PM and 7:00 AM, that’s what my suggestion does, once the weekday condition is removed, as I said:
This triggers every 10 minutes, but the condition only lets the actions actually run (every 10 minutes) if the current time is between 7 PM and 7 AM. Otherwise it only lets them run if the minutes past the hour is 00 or 30 (i.e., every 30 minutes from 7 AM to 7 PM.) Isn’t that what you said you wanted? Have you given this a try?
Invalid config for [automation]: [condition] is an invalid option for [automation]. Check: automation->trigger->0->condition. (See /config/configuration.yaml, line 233). Please check the docs at https://home-assistant.io/components/automation/
I use these codes in automations.yaml file. Is that “condition” tag usable in this file ?
hello there, I have changed the code of “% 30 == 0” to “% 20 == 0” but there is no change in the minutes except the fans run at once per hour !!!. What I’m doing wrong ? I would like to change the minutes as 20 for 7.00 AM to 7.00 PM.
Yes, you changed something else. You changed the trigger to only fire every 15 minutes, but you changed the condition to test for every 20 minutes. They’ll only “agree” every 60 minutes. Change the trigger back to every 10 minutes. If that’s not what you want, then you may need to go back to the drawing board.
Ok, I’m confused. If you want it to run every 30 minutes during the day, and every 15 minutes during the night, then I understand why you changed the trigger to every 15 minutes, but I don’t understand why you changed the condition to % 20 == 0 (i.e., every 20 minutes.)
If I understand what you want now, then leave the trigger as every 15 minutes, and put the condition back to % 30 == 0 (i.e., every 30 minutes.)