Page 1 of 1

is it possible to stop a scenario?

Posted: Monday 28 November 2016 9:43
by emme
I have a scenario that dims up a light and takes 5 minutes to do it...
(it is composed by several lines LIGH LEVEL 5 after 5, LIGHT LEVEL 10 after 10 etc etc...)

but if I want to stop it... how could I do that?
thanks
ciao
M

Re: is it possible to stop a scenario?

Posted: Monday 28 November 2016 10:20
by Egregius
I don't think you can interrupt the ON AFTER etc.
I do it like this for my dimmers:

When I choose to slowly dim up, or down with my floorplan I set a variable to 1 or 2 (default=0=do nothing).
Then in my script that run's every minute I check that variable for each dimmer and act upon it's state.
As soon as I choose a custom level, switch off or on on my floorplan the variable is set back to 0 so the slow dimming thing is stopped.
I use similar thing to override a setpoint ;)

Code: Select all

<?php
$items=array('eettafel','zithoek','tobi','kamer','alex');
foreach($items as $item){
    if($s[$item]!='Off'){
        if(strtotime($t[$item])<dertigsec){
            $action=cget('dimmer'.$item);
            if($action==1){
                $level=filter_var($s[$item],FILTER_SANITIZE_NUMBER_INT);
                $level=floor($level*0.95);
                if($level<2)$level=0;
                sl($i[$item],$level,$item);
                if($level==0)cset('dimmer'.$item,0);
            }
            elseif($action==2){
                $level=filter_var($s[$item],FILTER_SANITIZE_NUMBER_INT);
                $level=$level+2;
                if($level>30)$level=30;
                sl($i[$item],$level,$item);
                if($level==30)cset('dimmer'.$item,0);
            }
        }
    }
}