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"
when
Item gLights received update
then
gLights.members.filter[l|l instanceof Dimmer && l.state == 0].forEach[ l | l.sendCommand(OFF) ]
end
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
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.
rule "Light updated"
when
Item grBaseLIGHT received update
then
grBaseLIGHT.members.filter[l|l instanceof DimmerItem && l.state == 0].forEach[ l | l.sendCommand(OFF) ]
end
And
rule "Light updated"
when
Item dimmlight_erdgeschosseg_flurdeckenstrahler received update
then
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) ]
end
The bulb never changes … the lights are working, I can dimm the light alright, but the bulb never changes … always in ON state
rule "Light updated"
when
Item dimmlight_erdgeschosseg_flurdeckenstrahler received update
then
logInfo("testing", "rule triggered with " + dimmlight_erdgeschosseg_flurdeckenstrahler.state.toString)
if (dimmlight_erdgeschosseg_flurdeckenstrahler.state == 0) {
logInfo("testing", "passed IF")
dimmlight_erdgeschosseg_flurdeckenstrahler.sendCommand(OFF)
}
end
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?
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)
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
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 …