Make sure you don’t have Simple Mode turned on in PaperUI. I hate that mode as it hides all your Items. Assuming you have Simple Mode turned on, then the name of your Item will be zwave_device_fe6f2434_node12_sensor_door.
If you don’t have Simple Mode turned on, you need to create an Item and link it to that Channel.
Thank you for your detailed answer.
I learned a lot from it.
But still doesnt work
I created an item and link it to the channel as in here:
I created a new rule as in here
rule “My First Rule”
when
Item MyDoorSensorItem changed to OPEN
then
logInfo(“kitchen”, “Door is open”)
end
I saved the file and restart the OH.
Still cant see anything in the openHab.log.
I can only see in the events.log the basic line that the door is open.
What can be wrong?
How can I know if the rule is even loaded?
What is the trigger that the rule is reload? saving the file?
Something that might help new folk, I like to use logWarn; when you’re using log:tail in console it shows up as purple and does not get lost in the “noise” of events on a busy system.
When you’re happy, either comment it out or change it to Info
Please, don’t. There are four log Levels in question of DSL rules:
logDebug
logInfo
logWarn
logError
Each one is for messages associated with the name, Error -> there was a serious error which prevents the rule from being executed; might cause problems…
Warn -> There is something going on, which might be wrong, but maybe it’s ok - for example a device is offline, therefor a rule can’t succeed, but maybe the device is offline on purpose.
Info -> just to inform about what’s going on.
Debug -> like Info, but lot more Information.
The point is, you can set the log Level while running openHAB, it will take effect immediately.
If you’re interested in some special messages, just filter the output. You can do this in frontail, in bash (tail -f /var/log/openhab2/openhab.log | grep something) but not in karaf, but you can use the logger to cut it down to the interesting stuff (log:tail logger).
How did you create the rule1.rules file? Which Codepage used (should be UTF-8)? Which sort of line feed (should be only LF)? Are there some messages in openhab.log, such as
2019-10-15 23:25:22.692 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rule1.rules'
2019-10-17 11:33:04.165 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'rule1.rules' is either empty or cannot be parsed correctly!
I created the rule with notepad and saved it as UTF8.
Attached the rule as TXT file rule1.txt (124 Bytes)
You don’t need Visual Studio but Visual Studio Code (that’s another software) Get it from here:
It’s free. There’s a plugin for openHAB (can be installed directly from Visual Studio Code builtin market place).
afaik you can change the code page by save as dialogue (at least from Notepad)
I’m not sure if this is necessary in windows, maybe it only has to be consistent so try it out.
As I’m using VSCode, it’s one click to change the behavior
Another tool worth mentioning in Notepad++, which also provides a switch to toggle between CRLF and LF only.