Announcement

Collapse
No announcement yet.

Change brightness of a group of dimmers base on virtual device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change brightness of a group of dimmers base on virtual device

    Use case:

    change brightness of a group of dimmers based on a virtual device (ref 3858 here) that ranges from -100 to 100
    (all dimmers have a 0-100 range)
    The individual changes for each dimmer must be relative to the existing values and can't go below 0 or above 100.

    The intent is to change multiple dimmers brightness up/down relative to existing values.


    Pretty sure I'm on the right track but I need to assess the 0-100 resulting value and only apply if within range.

    where below it checks the current value and applies the change if within range.


    if ($DEVICEVALUE <= 100 and $DEVICEVALUE >= 0, $DEVICEVALUE + $$DVR:3858:, $DEVICEVALUE )


    Click image for larger version

Name:	asdewf32.PNG
Views:	202
Size:	146.2 KB
ID:	1425098


    Example of expected behavior for 3 dimmers

    Dimmer 1= 25
    Dimmer 2 = 90
    Dimmer 3= 100

    If virtual device is set to 25:

    Dimmer 1= 50
    Dimmer 2 = 100
    Dimmer 3= 100

    then If virtual device is set to -25:

    Dimmer 1= 25
    Dimmer 2 = 75
    Dimmer 3= 75


    then If virtual device is set to -80:

    Dimmer 1= 0
    Dimmer 2 = 0
    Dimmer 3= 0




    #2
    If you want to check the result, then the operation needs to be in the first argument of the IF. How about this?

    if ($DEVICEVALUE + $$DVR:3858: >= 100, 100, if ($DEVICEVALUE + $$DVR:3858: <=0, 0, $DEVICEVALUE + $$DVR:3858: ))

    Double-check my syntax.

    -Wade

    Comment


      #3
      Works perfectly
      Didn't think you could use another IF-ELSE within the operation
      Thanks Wade

      Yann

      Comment


        #4
        Glad I could help.
        -Wade

        Comment

        Working...
        X