Rule for dimmer and LED strip



  • Hello!

    I have two nodes:

    1. Dimmer (encoder with switch)
    2. RGB LED strip

    Please tell me how to make a rule for controlling two parameters (on / off, brightness) of an RGB LED strip using a dimmer unit.

    Perhaps someone already uses this rule in OpenHAB?

    Dimmer
    Dimmer
    RGB LED strip
    RGB LED strip



  • @vladimir
    Are you looking for something similar to the following:

    rule  "Rule Dimmer to Color Item Brightness"
    // TestDimmer121 is the item name of the dimmer value
    // Mock_RGB_Color_x is the Item name of the color strip
    // Openhab sends color data as Hue, Saturation, Brightness Data
    
    when
    	Item TestDimmer121 changed
    then
    
    	logInfo("rules","Dimmer to Color conversion Received " +TestDimmer121.state )
    	var PercentType BrightnessfromDimmer= TestDimmer121.state
    	var HSBType currentState = Mock_RGB_Color_x.state as HSBType
    	var DecimalType CurrentHue = currentState.hue 
    	var PercentType CurrentSaturation = currentState.saturation
    	var PercentType CurrentBrightness = currentState.brightness
    
    	logInfo("rules","HSBtype " + currentState) 
    	Mock_RGB_Color_x.sendCommand(new HSBType(CurrentHue,CurrentSaturation,BrightnessfromDimmer))
    	logInfo("rules","HSBtype NEW " +Mock_RGB_Color_x.state.toString) 
    end
    

    You did not post your item names, so you need to change to suit.
    I do not have a HSB lamp node to physicaly test on, so i have only been checking the openhab logs.


 

434
Online

7.9k
Users

8.8k
Topics

93.8k
Posts