Effectcolours channel in Deconz Binding

Continuing the discussion from deCONZ which Thing Type is needed for Lidl Melinera LED wire?:

Would it be possible for this Christmas to integrate the Effectcolours channel into the Deconz Binding? A string channel as suggested by @J-N-K would be quite sufficient.

1 Like

it’s possible via rule and zigbee2mqtt.
First my setup for zigbee2mtt. I’ve made a script to create the thing config for it.

          Thing topic lichterkette "lichterkette" {
              Channels:
                    Type switch : state           "state" [ stateTopic = "zigbee2mqtt/lichterkette/state", commandTopic = "zigbee2mqtt/lichterkette/set/state", on = "ON", off = "OFF" ]
                    Type dimmer : brightness      "brightness" [ stateTopic = "zigbee2mqtt/lichterkette/brightness", commandTopic = "zigbee2mqtt/lichterkette/set/brightness", min = 0, max = 254 ]
                    Type colorHSB : color           "color"  [ 
                          stateTopic = "zigbee2mqtt/lichterkette/color", 
                        commandTopic = "zigbee2mqtt/lichterkette/set/color",
                        transformationPatternOut="JS:HSBJSON.js" 
                    ]
                    Type string : effectName         "effectName" [ 
                              stateTopic = "zigbee2mqtt/lichterkette/effect-effect"
                         ]
                    Type string : effectCmd          "effecCmd2" [ 
                              commandTopic = "zigbee2mqtt/lichterkette/set/effect"
                    ]
                    Type number : effectSpeed          "effectSpeed" [ 
                              stateTopic = "zigbee2mqtt/lichterkette/effect-speed", 
                              min = 0, max = 100
                         ]
                    Type number : linkquality     "linkquality" [ stateTopic = "zigbee2mqtt/lichterkette/linkquality", min = 0, max = 255, unit = "lqi" ]
          }

Note the effectCmd channel (writeonly) and effectSpeed, effectName which are readyonly

The items

Group         Lichterkette        "Lichterkette"  <light> (Beleuchtung, gAussen,Zigbee) ["Lightbulb"] { 
    homekit="Lighting",
    ga="Light" [ roomHint="Garten "]
}
Switch        Lichterkette_Switch      "Schalter" (Lichterkette) ["Light","Switch"] {    
    channel="mqtt:topic:zigbee:lichterkette:state",
    homekit="Lighting.OnState",
    ga="lightPower"

}
Dimmer        Lichterkette_Brightness   "Helligkeit [%.1f %%]" (Lichterkette) ["Control"]  {
    channel="mqtt:topic:zigbee:lichterkette:brightness",
    homekit="Lighting.Brightness",
    ga="lightBrightness"
}
Color         Lichterkette_Color          "Farbe"               (Lichterkette)   ["Control"] { 
    channel="mqtt:topic:zigbee:lichterkette:color",
    homekit="Lighting.Hue, Lighting.Saturation"
}
String        Lichterkette_Alert          "Alert"               (Lichterkette)  
String        Lichterkette_Effect_Cmd     (Lichterkette) { autoupdate="false", channel="mqtt:topic:zigbee:lichterkette:effectCmd" }
String        Lichterkette_Effect_Name         "Effekt"              (Lichterkette)    ["Control"] {
        channel="mqtt:topic:zigbee:lichterkette:effectName",
        stateDescription=""[
            readOnly=false,
		    options="none=none, steady=steady, snow=snow, rainbow=rainbow, snake=snake,tinkle=tinkle, fireworks=fireworks, flag=flag, waves=waves, updown=updown,vintage=vintage, fading=fading, collide=collide, strobe=strobe,sparkles=sparkles, carnival=carnival,glow=glow"
	    ]
}
Number        Lichterkette_Effect_Speed   "Effect speed"       (Lichterkette)  { channel="mqtt:topic:zigbee:lichterkette:effectSpeed" }

Lichterkette_Effect_Cmd is a dropdown in the UI thanks to stateDescription.

Now I create a rule to post the right JSON to the effect-mqtt channel.
The timers are for debouncing the settings and changes from the device.

var Timer effectTimer
var Timer effectSetTimer

rule "Lichterkette_Effect_Change"
when Item Lichterkette_Effect_Name changed
     or 
     Item Lichterkette_Effect_Speed changed
then
      if ( Lichterkette_Effect_Name.state == UNDEF )  {
            return
      }
      if ( Lichterkette_Effect_Speed.state == UNDEF ) {
            return
      }
      if ( effectTimer !== null ) {
            return
      }
      if(effectSetTimer!== null) {
            effectSetTimer.cancel()
      }
      effectSetTimer = createTimer(now.plusSeconds(1)) [|
            val effectSpeed = Lichterkette_Effect_Speed.state.toString
            val effectName = Lichterkette_Effect_Name.state.toString
            val jsonString = String.format('{"effect" : "%s", "speed" : %s}', effectName, effectSpeed)
            Lichterkette_Effect_Cmd.sendCommand(jsonString)
            
            effectTimer = createTimer(now.plusSeconds(5)) [|
                  effectTimer = null
            ]
      ]     
end

You could extend the rule for more settings in the json.

greetings

With Zigbee2Mqtt I need a ZigBee dongle or something similar. But I want to use my Deconz/Phoscon gateway.

I would be also very happy if this will be implemented.

Is it possible to create a openhab3 UI page where it is possible to send a post command? So I can send the post request to my phoscon

@eric1905 If you need the effects only you can use the effect channel with the following effects: none,steady,snow,rainbow,snake,twinkle,fireworks,horizontal_flag,waves,updown,vintage,fading,collide,strobe,sparkles,carnaval,glow. You can add it with a Metadata: widget.

I already have the effects. I want to configure the colors for the effects

1 Like