Implementing a UP/DOWN function in Basic UI and HABpanel for a RFXcom dimmer

I have a RFXcom dimmer connected with a lightbulb. The dimmer operates with one simple ON and OFF command to switch the light on and off. To activate the dimming it requires a burst of 6 ON or OFF commands.

A brief description of what I’m trying to accomplish here. On both the HABpanel and Basic UI I would like to have one switch for ON/OFF and 2 buttons to increase/decrease the light intensity.

I managed to create a working solution for the HABpanel:

On the Basic UI there is an little issue with the setpoint function. In the sitemap the item is configured with label=“Lamp 3 Intensiteit []”, but it still displays the value.

When the webpage is refreshed (F5) the value disappears…

… until an up/down button is pressed. Than the value 0 appears again.

To be positive, the dimming does work. If anyone knows how to hide the value I would like to know.
Any comment on this implementation is greatly appreciated, also tips to simplify the rules are very welcome.

Here are my used items, sitemap and rules.

Items:

  • Item Plus_FF_LR_L3 and Minus_FF_LR_L3 are used only for the up/down buttons in the HABpanel.
  • Item Power_FF_LR_L3 is used in the HABpanel and Basic UI.
  • Item Dimm_FF_LR_L3 is used only for the up/down buttons in the Basic UI.
Switch Wallplug_FF_LR_L3 "Lamp 3" <light> { channel="rfxcom:lighting4:76261ede:382280:command" }
Switch Power_FF_LR_L3 "Lamp 3" <light>
Switch Plus_FF_LR_L3 "Lamp 3" <lightbulb>
Switch Minus_FF_LR_L3 "Lamp 3" <lightbulb>
Number Dimm_FF_LR_L3 "Lamp 3" <lightbulb>

Sitemap:

    Switch item=Power_FF_LR_L3 label="Lamp 3"
    Setpoint item=Dimm_FF_LR_L3 label="Lamp 3 Intensiteit []" minValue=-1 maxValue=1 step=1 visibility=[Power_FF_LR_L3==ON]

Rules:

// Dimmer light
rule "Lamp 3 Power ON"
when
      Item Power_FF_LR_L3 changed from OFF to ON
then  {
      Wallplug_FF_LR_L3.sendCommand(ON)
      Dimm_FF_LR_L3.sendCommand("0")
      }
end

rule "Lamp 3 Power OFF"
when
      Item Power_FF_LR_L3 changed from ON to OFF
then
      Wallplug_FF_LR_L3.sendCommand(OFF)
end


rule "Lamp 3 Dimmer Plus"
when
      Item Plus_FF_LR_L3 changed from OFF to ON
then
      if  (Power_FF_LR_L3.state == ON) {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Plus_FF_LR_L3.sendCommand(OFF)
          }
      else {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Power_FF_LR_L3.sendCommand(ON)
          Plus_FF_LR_L3.sendCommand(OFF)
          }
end

rule "Lamp 3 Dimmer +"
when
      Item Dimm_FF_LR_L3 changed to "1"
then
      if  (Power_FF_LR_L3.state == ON) {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Wallplug_FF_LR_L3.sendCommand(ON)
          Dimm_FF_LR_L3.sendCommand("0")
          }
      else {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Power_FF_LR_L3.sendCommand(ON)
          Dimm_FF_LR_L3.sendCommand("0")
          }
end

rule "Lamp 3 Dimmer Min"
when
      Item Minus_FF_LR_L3 changed from OFF to ON
then
      if  (Power_FF_LR_L3.state == ON) {
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Minus_FF_LR_L3.sendCommand(OFF)
          }
      else {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Power_FF_LR_L3.sendCommand(ON)
          Minus_FF_LR_L3.sendCommand(OFF)
          }
end

rule "Lamp 3 Dimmer -"
when
      Item Dimm_FF_LR_L3 changed to "-1"
then
      if  (Power_FF_LR_L3.state == ON) {
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Wallplug_FF_LR_L3.sendCommand(OFF)
          Dimm_FF_LR_L3.sendCommand("0")
          }
      else {
          Wallplug_FF_LR_L3.sendCommand(ON)
          Power_FF_LR_L3.sendCommand(ON)
          Dimm_FF_LR_L3.sendCommand("0")
          }
end

I believe there has been work on the Setpoint widget since OH2.4 (in connection with units), so you’d need to try a later version before making a new github issue about this.

Maybe try it in 2.5M1 or M2 when it comes.

Thanks, I will try 2.5 when is released.