Light behaves weirdly when turned on via rule/ Tradfri & Homematic

Hey guys,

I’m running into a little issue with my current setup - I’m switching Ikea Tradfri-LED’s on and off via a Homematic switch. My rule looks like this:

rule "Badezimmer Taster"
when
    Channel "homematic:HG-HM-PBI-4-FM:c29c40e4:OEQ0613601:1#PRESS" triggered SHORT
then
    if (Dimmer_Ikea_Badezimmer.state > 0) {
        Dimmer_Ikea_Badezimmer.sendCommand(0)
    }

    else {
        Dimmer_Ikea_Badezimmer.sendCommand(100)
    }
end

The item looks like this:

Dimmer        Dimmer_Ikea_Badezimmer     "LED Badezimmer (Dimmer)"            <lightbulb>   (Zuhause,Badezimmer)        { channel="tradfri:0210:gwb8d7af2be2b1:65543:color" }

It does work as expected but there is some delay once I press the physical button. I checked the log and stumbled over this:

2018-11-08 18:06:44.568 [vent.ChannelTriggeredEvent] - homematic:HG-HM-PBI-4-FM:c29c40e4:OEQ0613601:1#PRESS triggered SHORT
2018-11-08 18:06:44.677 [ome.event.ItemCommandEvent] - Item 'Dimmer_Ikea_Badezimmer' received command 100
2018-11-08 18:06:44.684 [nt.ItemStatePredictedEvent] - Dimmer_Ikea_Badezimmer predicted to become 100
2018-11-08 18:06:44.690 [vent.ItemStateChangedEvent] - Dimmer_Ikea_Badezimmer changed from 0 to 100
2018-11-08 18:06:44.704 [vent.ItemStateChangedEvent] - Dimmer_Ikea_Badezimmer changed from 100 to 0
2018-11-08 18:06:44.739 [vent.ItemStateChangedEvent] - Dimmer_Ikea_Badezimmer changed from 0 to 100

It seems like it turns on, then off and then eventually on again. Any idea why it’s doing that? The rule is pretty straightforward I thought.

Weirdly enough, turning it off seems to work without that hiccup:

2018-11-08 18:09:09.258 [vent.ChannelTriggeredEvent] - homematic:HG-HM-PBI-4-FM:c29c40e4:OEQ0613601:1#PRESS triggered SHORT
2018-11-08 18:09:09.285 [ome.event.ItemCommandEvent] - Item 'Dimmer_Ikea_Badezimmer' received command 0
2018-11-08 18:09:09.303 [nt.ItemStatePredictedEvent] - Dimmer_Ikea_Badezimmer predicted to become 0
2018-11-08 18:09:09.326 [vent.ItemStateChangedEvent] - Dimmer_Ikea_Badezimmer changed from 100 to 0

Look in events.log. Are you receiving two triggers on the homematic Channel?

What I posted is straight from the events log. It’s just one single trigger.

Does nobody have an idea on what’s going on here?

Are you asking why the delay? What is your question?

When I turn on the light via this rule the light goes on, off and then on again. I am unsure why it’s doing that - I think it’s causing a delay.

It looks like multiple rules exist. Where is the “Dimmer_Ikea_Badezimmer predicted to become 100” come from, I never saw that in my logfiles (as I recall).

By the way, Ikea dimmers also accept (OFF and ON) commands which might be better as in such case they remember their original dimming state so you can toggle between X% dimming and off.

Hi @bartsnijder,

there is only the one rule. It looks like this in my rules-file:

var dimmer = 100

rule "Badezimmer Taster"
when
    Channel "homematic:HG-HM-PBI-4-FM:c29c40e4:OEQ0613601:1#PRESS" triggered SHORT
then
    if (Dimmer_Ikea_Badezimmer.state > 0) {
        Dimmer_Ikea_Badezimmer.sendCommand(0)
    }

    else {
        Dimmer_Ikea_Badezimmer.sendCommand(dimmer)
    }
end

I do have a variable there as I change the value over the course of the day (it’s at 10 from 23:30-06:00 for example). This is also the only rule with that specific trigger-channel.

The only thing I could think of is how the rule is structured - it does check if the bulb is dimmed at al (> 0) to turn the light off and only turns it on when it’s at 0 (else). Not sure if it’s stumbling over itself there somehow. Don’t know how to check it either to be frank.

Yup, I had it with ON and OFF before, but I don’t want them to remember their former dimming state when I press the button.

Actually the first two lines in the logfile are ok. It states the short press and the item receives 100 as argument.
The other lines are not originated from the rule I guess. How did you define the Dimmer_Ikea_Badezimmer item?

please look at https://github.com/eclipse/smarthome/pull/5011

That’s the root cause, as I’m still on v2.3 I don;t know how to solve it

I guess you should change the 0 statement so:

if (Dimmer_Ikea_Badezimmer.state != OFF {
Dimmer_Ikea_Badezimmer.sendCommand(OFF)

(the 100 statement you can leave, or possibly set it to 99)