Mycodo icon indicating copy to clipboard operation
Mycodo copied to clipboard

Add duration in sunrise trigger and/or enable Conditional Controller self deactivation

Open lalebarde opened this issue 2 years ago • 0 comments

I am using a sunrise trigger to enable a Conditional Controller. At present time, I need to use a second sunrise trigger to deactivate it 2 hours later.

Either:

  1. Add a duration in the controller activation command
  2. Enable Conditional Controller self deactivation (I have tested to add a command to deactivate itself but it is not taken into account)

lalebarde avatar Jul 06 '22 20:07 lalebarde

I don't see the issue with using two Sunrise Trigger Functions to accomplish what you're doing. What is the issue?

kizniche avatar Aug 21 '22 22:08 kizniche

I also don't understand what you mean by the second part. Deactivating a conditional controller can be accomplished with the Deactivate Controller Action.

kizniche avatar Aug 21 '22 22:08 kizniche

At present time, I use two sunrise trigger functions to activate a conditional controller with the first one, and deactivate the same controller with the second one. It would be easier to maintain and avoid mistakes with one sunrise trigger function doing both. Either with a duration in the sunrise trigger function, either with the capability of a conditional controller to deactivate itself, what I have not managed to perform.

lalebarde avatar Aug 25 '22 07:08 lalebarde

I'm not sure what change you're proposing to the sunrise/sunset Function. It would help if you explicitly state what you are proposing.

Second, like I mentioned, it is possible for a Conditional Function to deactivate itself with the Deactivate Controller Action.

kizniche avatar Aug 25 '22 12:08 kizniche

I will retry self deactivation. Actually, I don't need more.

But here is my idea, which may still be useful:

image

lalebarde avatar Aug 26 '22 06:08 lalebarde

There are a lot of issues with timing actions like this. Without a dedicated controller that is always running, any duration event can be interrupted by a reboot or power failure. This is why explicitly setting times for actions is safer, since a reboot or power failure doesn't prevent the second action from occurring.

kizniche avatar Aug 26 '22 21:08 kizniche

Understood, so it was a bad idea. Thank you Kyle.

lalebarde avatar Aug 27 '22 08:08 lalebarde

It's not necessarily a bad idea, but it would take a significant code change to make it reliable, whereas you can get the same effect from the current framework by adding an additional controller to be responsible for the action at the end of your duration.

kizniche avatar Aug 29 '22 16:08 kizniche