RGB MQTT dimmer



  • There seems to be an example already in the 1.5 for the RGB 3D dimmer.
    So if i use it - how do i connect to openhab via MQTT?

    Found a solution like below but that seems only for a sinble item... Maybe there is a solution on this forum i missed?

    // WiFi RGB 2
    Group WIFI_RGB_2 "WiFi RGB 2" (All)
    Color fWIFI_RGB_2 "RGB" <slider> (WIFI_RGB_2)
    String WIFI_RGB_2_RGB (WIFI_RGB_2) {mqtt=">[broker:/openHAB/RGB_2/Color:command:*:default]"}
    Switch WIFI_RGB_2_Switch1 "W1" (WIFI_RGB_2) {mqtt=">[broker:/openHAB/RGB_2/SW1:command:ON:100],>[broker:/openHAB/RGB_2/SW1:command:OFF:0]"}
    

    And than a rule like

    import org.openhab.core.library.types.*
    
    var HSBType hsbValue
    var int redValue
    var int greenValue
    var int blueValue
    var String RGBvalues
    
    rule "Set RGB 2 value"
     when
     Item fWIFI_RGB_2 changed
     then
     hsbValue = fWIFI_RGB_2.state as HSBType
    
     redValue = hsbValue.red.intValue
     greenValue = hsbValue.green.intValue
     blueValue = hsbValue.blue.intValue
    
    
     RGBvalues= redValue.toString + ";" + greenValue.toString + ";" + blueValue.toString
     sendCommand( WIFI_RGB_2_RGB, RGBvalues )
    
     logInfo( "fWIFI_RGB_2", RGBvalues )
    end```


  • Ok got it working. But now i see the main problem. When you change the colour - there is a lag so othe colours are seen. Same goes to switching off. For example we were at white light fullbrightness than switched off.
    You can first see the light becoming yelow, than blue than off.

    How can this be fixed? If i understand correctly - you have to pass all these HSB value processing to arduino and have the controller send 3 values at once. Are there any examples?


 

257
Online

7.8k
Users

8.7k
Topics

93.0k
Posts