Jump to content

Use variable as condition of a status in and IF


kkunzler

Recommended Posts

It would be wonderfully useful is one could use a variable value as a conditon of a status in an IF. 


 


Example:  If status 'dimmer1' >= $dim 


 


I know I can use a state variable as a trigger (If $x>=1) or set a variable, but I want to use the value of the variable as a condition against a status directly.  And example use is in sunsetting.  I have a program that updates $sunset_state every so many minutes (also useful if I could call a variable here so $x minutes) and decrements it by a set value.  I want to be able to have a program run that will check the status of  dimmer1 and apply the $sunset_state to dimmer1 only if status of dimmer 1 is greater than $sunset_state.  (If status 'dimmer1' > $sunset_state, set 'dimmer1' $sunset_state)


 


I realize I could write 99 programs to do this (program 1: if $sunset_state=99 and status 'dimmer1>99, set 'dimmer1' 99%; program 2: if $sunset_state=98 and status 'dimmer1>98, set 'dimmer1' 98%") etcetera, but that really doesn't scale very well especially when there is a finite number of programs and it takes 99 of them just to match a dimmer state to a variable. ?


Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...