Switch Rule not executed

Final question for today:
I followed some tutorials to implement a virtual switch as a “Main-Switch” to switch off the light in the whole floor.

Therefor I implemented in my sitemap:

sitemap mw19 label="Haussteuerung"
{
        Frame {

                Group item=gLicht_zentral label="Licht" icon="light" {
                        Switch item=LichtEGaus label="Licht EG" icon="light" mappings=["OFF"="aus"] }
                }

}

And in my items:

Switch  LichtEGaus                              "Licht EG aus"          <light>                         {autoupdate="false"}

This gives me a working push-button that results in a log-enty in the event-log, every time i push it.

But my rule to switch off the lights is not executed:

rule "Licht EG aus"
when
        item LichtEGaus received command OFF
then
        EG_Esszimmer_Stern.sendCommand (OFF)
        EG_Esszimmer_Schlauch.sendCommand (OFF)
        EG_Wohnzimmer_Wuerfel.sendCommand (OFF)
        EG_Kaminzimmer_Deckenfluter.sendCommand (OFF)
        EG_Kaminzimmer_Licht_Regal_Kamin.sendCommand (OFF)
        EG_Kaminzummer_Licht_Regal_Bar.sendCommand (OFF)
        logInfo("ESSZIMMER","Licht EG aus")
        postupdate (LichtEGaus, ON)
end

As to be seen in the rule, there should be a second logging to “ESSZIMMER” to test if the rule was executed, but I never get any entries in that log (as I do not see that any light is switched off)

Any ideas?

First try:

Item instead of item

1 Like

In your rule, remove the space after the command and before the brackets.
In your sitemap I would try to have just the switch, without the group added.

Hello Jörg

I recommend to start at the very first basics.
As @opus and @Maurits28 mentioned, update your rule and sitemap.
Start your OH Instance in debug-mode to get a more detailed log and take a look into it.

Get it work first. After that, you can build up groups.
What is the idea behind postUpdate(LIchtEGaus,ON)?
If you want to have a “single-press-button”, you could follow the samples, which you can find here: https://github.com/openhab/openhab/wiki/Samples-Item-Definitions

Regards
Michael

Wow, so simple, thank you! But do you know why the spelling recommendations are different between the files? Does not seem to be a good idea (more a trap).

Thanks für your reply, but following the advice of Opus already helped.

Now it works, following Opus advice.

Concerning the “postUpdate(LichtEGaus,ON)”: This was mentioned in a tutorial I found here https://knx-user-forum.de/forum/supportforen/openhab/27810-√-einfacher-taster-in-openhab, and as far as I understood (I am still a real beginner with openHAB) this was added to bring the button back to the “not pressed” status. Like the spring in a real pushbutton.

BTW: Debug mode would be another question. I always get file-lock errors when trying to start it.

From my experience I can recommend the way which is descriped in the sample items link (posted above).

Regarding your debug mode:
It sounds like your OH instance is running, which is causing the file-lock.
Otherwise stop your OH instance, disable the autostart, reboot your system and then try to start the debug mode.