Dimmer Switch State false

Hi Folks,

i have some dimmers which doesn´t get their right switch state in my system
In the following example there should be a “off” lamp …

OH Config example
Dimmer dimmlight_erdgeschosskuechedeckenstrahler "Deckenstrahler [%.0f %%]" <light> (grErdgeschossKuecheLIGHT) { knx="1/1/1+<5/1/7, 2/1/4, 2/1/8+<5.001:5/1/6" }
Slider item=dimmlight_erdgeschosskuechedeckenstrahler label="Erdgeschoss - Kueche - Deckenstrahler" icon="light" switchSupport

After I started to write that thread I saw a similar thread about rules …

It´s probable about that fact, that i don´t get an “switchstate” but an percentage value

Now, how can i write a rule, that evaluates the switchstate of my dimmer item in my light group (unfortunately i don´t have a dimmer group, but just an “light” group) to OFF if the percentage value = 0

the rule must be able to be triggered by an command, find the item, see if it is a dimmer, check if it is 0 (percentage value) , and turn the bulb off (or respectively on)

A command from what? A command to one of the Lights? In that case you will have to write a rule that triggers by each Item individually. You cannot trigger a rule based on commands using only the Group.

If it makes things easier, why not create one? Items can belong to more than one Group.

Why not just evaluate everything any time anything updates. Then your logic and rule triggers becomes very easy:

rule "Light updated"
    Item gLights received update
    gLights.members.filter[l|l instanceof Dimmer && l.state == 0].forEach[ l | l.sendCommand(OFF) ]

Hi Rich,

first of all many thanks for your reply.
I´ll try your suggestions when I´m back from work, tonight, but slowly but surely my wife builds up the fire under my chair when I´m working on that openhab topic. But I´ll find the time :slight_smile:
Man, I love it … and damn I hate it …
Sometimes I´m close to giving up and buy some product, but my explorer mind yearns to get punished.

Hi again,

sorry, haven´t been able to look into this for awhile …
Now, it doesn´t work :frowning:

Items Definition

Group grBaseLIGHT 
Group grErdgeschossLIGHT ( grBaseLIGHT )
Group grErdgeschossEG_FlurLIGHT  ( grErdgeschossLIGHT )
Dimmer dimmlight_erdgeschosseg_flurdeckenstrahler "Deckenstrahler [%.0f %%]" <light> (grErdgeschossEG_FlurLIGHT) { knx="1/1/8+<5/1/0, 2/1/5, 2/1/24+<5.001:5/1/1" }


Slider item=dimmlight_erdgeschosseg_flurdeckenstrahler label="Erdgeschoss - EG_Flur - Deckenstrahler" icon="light" switchSupport


I tried

rule "Light updated"
    Item grBaseLIGHT received update
    grBaseLIGHT.members.filter[l|l instanceof DimmerItem && l.state == 0].forEach[ l | l.sendCommand(OFF) ]


rule "Light updated"
    Item dimmlight_erdgeschosseg_flurdeckenstrahler received update
	if (dimmlight_erdgeschosseg_flurdeckenstrahler.state == 0) dimmlight_erdgeschosseg_flurdeckenstrahler.sendCommand(OFF)
    //grBaseLIGHT.members.filter[l|l instanceof DimmerItem && l.state == 0].forEach[ l | l.sendCommand(OFF) ]

The bulb never changes … the lights are working, I can dimm the light alright, but the bulb never changes … always in ON state

Go one step at a time

rule "Light updated"
    Item dimmlight_erdgeschosseg_flurdeckenstrahler received update
   logInfo("testing", "rule triggered with " + dimmlight_erdgeschosseg_flurdeckenstrahler.state.toString)
   if (dimmlight_erdgeschosseg_flurdeckenstrahler.state == 0) {
      logInfo("testing", "passed IF")


that obviously triggers a loop:

10:46:28.659 [INFO ] [lipse.smarthome.model.script.testing] - rule triggered with 0
10:46:28.661 [INFO ] [lipse.smarthome.model.script.testing] - passed IF
10:46:28.663 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'dimmlight_erdgeschosseg_flurdeckenstrahler' received command OFF
10:46:28.852 [INFO ] [lipse.smarthome.model.script.testing] - rule triggered with 0
10:46:28.853 [INFO ] [lipse.smarthome.model.script.testing] - passed IF
10:46:28.856 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'dimmlight_erdgeschosseg_flurdeckenstrahler' received command OFF
10:46:29.029 [INFO ] [lipse.smarthome.model.script.testing] - rule triggered with 0
10:46:29.031 [INFO ] [lipse.smarthome.model.script.testing] - passed IF
10:46:29.034 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'dimmlight_erdgeschosseg_flurdeckenstrahler' received command OFF
10:46:29.209 [INFO ] [lipse.smarthome.model.script.testing] - rule triggered with 0
10:46:29.211 [INFO ] [lipse.smarthome.model.script.testing] - passed IF
10:46:29.213 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'dimmlight_erdgeschosseg_flurdeckenstrahler' received command OFF
10:46:29.390 [INFO ] [lipse.smarthome.model.script.testing] - rule triggered with 0
10:46:29.392 [INFO ] [lipse.smarthome.model.script.testing] - passed IF
10:46:29.396 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'dimmlight_erdgeschosseg_flurdeckenstrahler' received command OFF

Okay, so the basic rule works. The info to carry away is that sending an OFF to a dimmer results in an update to 0

The group icon isn’t to going to work this way.
I think you’re back to plan A, have a dummy item on the sitemap and scan the group for switch-off states and dimmer-0 states to set the icon.

Actually I’m a bit confused now - is the problem that a group including dimmers doesn’t display grey icon? Or a single dimmer item doesn’t display grey icon?

Single Dimmer:

Ah! What you need is an icon image called light-0

Hi there,

i use the openhab/openhab docker image and don´t find the images in conf/icons

You know where theý are ?

The picture url just shows:

Extensive discussion of location here, with some traps as well (no uppercase etc.)

Hi there,

hmmm…dynamic icons are working …partly ,…

With switch (state on/off) they are working properly, but with sliders (state=0-100) not …

I created a default file where the bulb is on … and two other files (0 & off) where it is off, but oh always shows the one which is off, even when the url of the image has the right state (>0)

<img data-icon="dimmer" src="/icon/dimmer?state=55&amp;format=png">

Did you try adding a dimmer-100.png?

Hi there… My understanding was, that when I don’t have that oh uses the default icon… That’s what I want… Everything else than off (which is working… Dimmer-0) should have the default (which is the glowing bulb)

“numbered” icons are bit of exception for defaulting. You don’t have to make all possible icons, say you have icon-50 and icon-70. If the displayed value is 55 then Openhab is smart enough to use one of those (I forget which!).
If you only have one numbered icon-00, I think that will always be the “nearest” one that OH can find. So default does not get used, unless value is NULL

Edit - logic of icon selection here

In the case of numbers, the next lowest number icon will be used. So for a dimmable light, you might have something like
icon-0 for an off symbol
icon-1 for a dimmed sybmol
icon-75 for an on symbol

Wow, I´ll have to check this tonight, but if that´s true you´l be part of my prayers in the future :slight_smile:

@rossko57 now that you’ve already looked into that and made a few tests and discoveries, would you please add your findings here: https://github.com/openhab/openhab-docs/pull/250#discussion_r98957759


Well, I dun tried to do that :slight_smile:

1 Like

I just wanted to look at this algorithm, hoping to see more hidden possibilities. Found a few strange lines of code instead :sweat_smile:

Hi guys, sorry … did some other stuff lately :slight_smile:

Ok now, @rossko57 ´s Suggestion worked actually …

when you give him a dimmer-0 (bulb is off) and a dimmer-1 (bulb is on) it´s working with all states

obviously OH really checks first for exact state and shows a Icon with exactly that state, but when it doesn´t find one it takes the nearest “value”-Icon

0% = (dimmer-0.png)
1-100%= (dimmer-1.png)

It´s sufficient for me to show only on and off bulb … I didn´t play with different bulbs …