Dimmer slider not working properly. Did I miss something?

Hi,

I’m trying to setup my dimmer POPP dimmer and having problem. I can ON/OFF but it doesn’t increase or decrease the level of light.

My rule:
rule "Dimmed Light"
when
Item Test received command
then
var Number percent = 0
if(Test.state instanceof DecimalType) percent = Test.state as DecimalType

	if(receivedCommand==INCREASE) percent = percent + 5
	if(receivedCommand==DECREASE) percent = percent - 5

	if(percent<0)   percent = 0
	if(percent>100) percent = 100
	postUpdate(Test, percent)
	//sendCommand(Test, percent)
	logInfo("Test updated to:" percent)

end

and my item definition:
Dimmer Test “Test dmmer POPP [%d %%]” (FF_Bed) { zwave=“3:command=SWITCH_MULTILEVEL” }

Did I miss something?

Thanks!

Please try

Test.sendCommand(percent)

Hi

Thank you but it still not working. I just checked the log and found following error message:
“Error during the execution of rule ‘Dimmed light’: Index: 1, Size: 1.”

But the same error message occurs even before changing from postUpdate to Test.SendCommand.

What is wrong with that file?

I don’t see a reason for what appears to be an ArrayIndexOutOfBoundsException (based on the message text), but I think if you trigger a rule on Item Test received command, then you don’t want the body of the rule to Test.sendCommand(...) because that seems like a never-ending loop would occur.

Hi,

I noticed that if I use sendCommand then never-ending loop occurs. So changed to postUpdate. But even with postUpdate still have the same error message “…index …”.

What kind of dimmer hardware you are using? Fibaro Dimmer 2 after auto-calibration can recognize the load as non-dimmable, then you have such strange effect.

Damn, never write early in the morning… :wink:

I thought, the rule should send the absolute Value to the Dimmer, so:

rule "Dimmed Light"
when
    Item Test received command
then
    var Number percent = 0
    if(Test.state instanceof DecimalType) percent = Test.state as DecimalType 
    if(receivedCommand==INCREASE) percent = percent + 5
    if(receivedCommand==DECREASE) percent = percent - 5
    if(percent < 0)   percent = 0
    if(percent > 100) percent = 100
    if(Test.state instanceof DecimalType) 
        if(Test.state as DecimalType != percent) {
            Test.sendCommand(percent)
            logInfo("Dimmed Light","Test updated to: {}", percent)
        }
end

This should avoid an endless loop, but snd the new value to your dimmer, postUpdate will only update the value in UI.

1 Like

It works much better!! but now the light (standard bulb) blinks every time when the lamp is dimmed. It doesn’t matter if I set the step 1 or 10. Obviously the step 1 is more gradient but unfortunately blinks. It looks like every time when the dimmer is decreased or increased the lamp is switched off (for miliseconds) and the set up for the new value.
In my previous automation system Vera the same dimmer worked smoothly. So I don’t thing it’s a dimmer issue.

Sorry for bother you. Thank you

Is there any explanation how the command sendCommand works? It’s strange behavior that the every time the dimmer is increased or decreased the bulb blinks (each step). The blinking is not related to any power source frequency. As I described before it looks like during changing the value with sendCommand the light is set to 0 and then set to ‘percent’ variable.

Do you see any logs in events.log that the Item changed to 0? This behavior is very strange…

The log doesn’t show any ‘0’. It logs increased or decreased values as expected. It only looks like it set to ‘0’ as the bulb is switched off for milisecs and then set to the proper value. The effect is blinking light which is very unpleasant. I wanted to move from Vera system to OpenHAB as I think is much more powerful but this issue is very important.

Previously I used the POPP dimmmer with Vera and attached led bulb. It worked ok. Now I use standard bulb. Maybe there is an issue but I didn’t change any settings (parameters) in the dimmer.

hi all

i’m trying to get a dimmer to work too and i need your help, please.

I need my dimmer to return simple commands like: +1 or -1 (Increase or Decrease).
Now i get the exact numeric values and that does not help me, because the thing that I control over MQTT with this dimmer can’t receive/return the exact numeric STATE.

I tried with a rule like this one below, but “receivedCommand” in never INCREASE/DECREASE, because it’s a numeric value.
if(receivedCommand==INCREASE) …
if(receivedCommand==DECREASE) …

Here are my settings:

on Items:
Dimmer JVCVolume “JVC Volume [%s/33]” {mqtt=">[broker:cmnd/JVCVolume/VOLUME:command:*:default]"}

on Sitemap:
Setpoint item=JVCVolume minValue=0 maxValue=33 step=1

on Rules:
rule “My http dimmer"
when
Item JVCVolume received command
then
// sendBroadcastNotification(receivedCommand.toString)
if (receivedCommand == DECREASE) {
sendBroadcastNotification(”-")
}
else if (receivedCommand == INCREASE) {
sendBroadcastNotification("+")
}
end

thx all!

How do you cotrol the dimmer? If dimming through Basic UI/Paper UI/Apps you will get only absolute dimming. There are several ways to enforce an INCREASE/DECREASE Command, e.g. you could define a widget like this:

Switch item=JVCVolume mappings=[INCREASE="UP",DECREASE="DOWN"]

This should generate an INCREASE/DECREASE Command. However, this would not send +1/-1 to mqtt for sure.

I guess, you can’t get information about the absolute dimm level either, so the best way would be to use a proxy item. The bound item would be of type String or Number (I can only guess, you will have to test this) and this item will not show up in the UI, but will only receive commands from a rule. This rule will be driven by the proxy item, which will appear in the UI. It doesn’t matter which item Type you chose, because you can only send UP/DOWN commands, the simplest one would be a switch item:
.items:

Switch pJVCVolume "JVC Volume" {autoupdate="false"}
Number JVCVolume "" {mqtt=">[broker:cmnd/JVCVolume/VOLUME:command:*:default]"}

.sitemap:

Switch item=pJVCVolume mappings=[ON="UP",OFF="DOWN"]

.rules:

rule "JVC Volume UP/DOWN"
when
    Item pJVCVolume received command
then
    if (receivedCommand==ON) {
        JVCVolume.sendCommand(1)
        sendBroadcastNotification("+")
    }
    else if (receivedCommand==OFF) {
        JVCVolume.sendCommand(-1)
        sendBroadcastNotification("-")
    }
end

Thx Udo!

Yes! The mapping was the solution that I was looking for. Now I know. :slight_smile:
Your code it’s working great.

Many thanks!