Repeat cycle timer
 
Notifications
Clear all

Repeat cycle timer  

  RSS

eap904
(@eap904)
Active Member
Joined: 10 months ago
Posts: 15
March 3, 2020 10:10 pm  

Hi, trying to make a simple repeat cycle timer. 

wondering if anyone has an elegant way of doing this, basically set an on for x minutes, off for y minutes, and schedule it so there’s a separate schedule for day and night. 

would like to eventually incorporate reactions to humidity readings, like interrupting the cycle if humidity has been too high for too long.

for now, just need to get the cycle working, and specifying every time during the day seems labor intensive and hard to easily adjust. 

I’ll be using a power switch tail, and would like to be able to use the 433 MHz sockets after testing them for reliability. 

thanks!


Quote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 5 years ago
Posts: 193
March 3, 2020 10:32 pm  

There are multiple ways that this can be done, but here's how I would do this:

Create two duration timers: Day Timer and Night Timer. Day Timer will have the on/off schedule you want for the day, and Night Timer will have the on/off schedule you want for the night.

Create a Conditional Controller, with 2 Conditions and 4 Actions. The Conditions are Day Timer Controller Running and Night Timer Controller Running. The Actions are Activate Day Timer, Deactivate Day Timer, Activate Night Timer, and Deactivate Night Timer. Now, you can have this conditional controller run periodically and check the time. It will, based on the current time, check which controller is running. If the appropriate controller is running, do nothing. If the controller that should be running is not running, deactivate the currently-active timer and activate the currently-inactive timer.

The other nice thing about using a conditional is you can go back in later and modify the code to add extra things you mentioned you wanted to accomplish.

Shall I let you chew on this a while and have a crack at writing the Python code in the Conditional Statement, before I jump in with some example code? ;)

Mycodo Developer


ReplyQuote
eap904
(@eap904)
Active Member
Joined: 10 months ago
Posts: 15
March 4, 2020 8:51 am  

Taking a crack at it is the least I can do :)

Thank you, will post what I come up with a bit later 


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 5 years ago
Posts: 193
May 1, 2020 6:38 pm  

Have you had any success with this?

Mycodo Developer


ReplyQuote
eap904
(@eap904)
Active Member
Joined: 10 months ago
Posts: 15
May 6, 2020 8:51 am  

@kylegabriel

Somehow this dropped on the priority list over the past months.... just now sitting down and taking a look again!

Until I can get some Python code written and tested, it looks like a Trigger: Timer (Duration) will serve the purpose of a cycle timer well, every x seconds turn the output on for y seconds.

Every time I tried to decide between languages to start with I got stuck, but now I have a reason to pick Python. :) 


ReplyQuote