Mycodo
Mycodo copied to clipboard
Add duration in sunrise trigger and/or enable Conditional Controller self deactivation
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:
- Add a duration in the controller activation command
- Enable Conditional Controller self deactivation (I have tested to add a command to deactivate itself but it is not taken into account)
I don't see the issue with using two Sunrise Trigger Functions to accomplish what you're doing. What is the issue?
I also don't understand what you mean by the second part. Deactivating a conditional controller can be accomplished with the Deactivate Controller Action.
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.
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.
I will retry self deactivation. Actually, I don't need more.
But here is my idea, which may still be useful:
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.
Understood, so it was a bad idea. Thank you Kyle.
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.