Items and paper ui

I have a fundamental question about openhab2. If I add items in the paper ui, I can use these in the rules editor. It seems that if I add items in an item config file, they can also be used in the paper ui. But it seems that the items I add in the gui can not be used in a rules config? At least I can’t get any rules to do anything using items added in the paper ui…

No, they work the same way as manually configured items

If you mean Eclipse Smarthome Designer: PaperUI configured items show up with an error (known issue), manually configured text items are showing up with no errors.

Post an example please …

Ah, no the rules editor I mean is the experimental addon in the paper ui. Maybe I should try the eclipse editor, haven’t done that. Will post an example later when I am in front of the computer…

My rule:

rule "Test"
when
        Item Screen changed
then
        if (Screen.state == "ON") {
                logInfo("Test", "My rule triggered! ON")
        }
        else if (Screen.state == "OFF") {
                logInfo("Test", "My rule triggered! OFF")
        }
        else {
                logInfo("Test", "My rule triggered! ???: " + Screen.state)
        }
end

In the log:
2017-03-09 20:20:01.356 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'default.rules’
2017-03-09 20:20:09.753 [INFO ] [.eclipse.smarthome.model.script.Test] - My rule triggered! ???: ON
2017-03-09 20:20:18.274 [INFO ] [.eclipse.smarthome.model.script.Test] - My rule triggered! ???: OFF

For some reason my condition never triggers. Do I need to use some string compare function or something?

Ah, found the error, there shouldn’t be quotes on the ON/OFF, I guess they are contants defined somewhere… Works now :slight_smile:

1 Like