Upgraded to OH 2.1 and have issues with my rules and I cannot find the problem (they worked fine with 2.0)
Created a basic rule
rule "Test rule"
when
Item Plug1Switch received command
then
logInfo("test", "Test logging")
end
The log says:
17:16:32.570 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.rules'
17:16:32.599 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'test.rules' is either empty or cannot be parsed correctly!
17:16:32.795 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'
I have tried to manipulate with spaces, tabs, CR/LF, encoding (ANSI/UTF-8)…etc
Running OH2 on Raspberry Pi
Editing the files on Windows with Notepad++ from Samba share
When editing on RPi with nano it seems to work fine.
Could be so…but have been working perfectly before upgrading to OH 2.1.
I have seen others having problem with parsing of config files after upgrading.
Any proposals on additions/changes of Samba conf?
Currently it looks like:
[openHAB Home]
comment= openHAB Home
path=/usr/share/openhab2
browseable=Yes
valid users = openhab
#admin users = openhab
read list = openhab
write list = openhab
force user = openhab
force group = openhab
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
[openHAB Config]
comment= openHAB Site Config
path=/etc/openhab2
browseable=Yes
valid users = openhab
#admin users = openhab
read list = openhab
write list = openhab
force user = openhab
force group = openhab
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
I’ve had these issues since I started with OpenHAB. I edit my conf-files in Notepad++ (Samba share).
However, despite these error messages, all my rules operate normally. So as long as you get “Loading model ‘test.rules’” eventually, you can ignore the previous error.
Sure, but if it cannot parse the file when editing via Samba/Notepad++ with OH 2.1 something have been changed since 2.0 since it worked flawless before.
Anyone having working editing over Samba? Any other Samba configuration or a glitch in OH?
I’m using Samba to connect to openHABian (using default Samba settings) and editing with Visual Studio (with openHAB plugin) on OS X.
Every time I save a .rules file, I get the same error:
2017-07-20 00:09:28.648 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'alarm.rules' is either empty or cannot be parsed correctly!
And, in case anyone’s wondering if I just suck at writing rules (which would be a fair guess ), here’s a sample rule that was saved alone, in its own file, without any whitespaces after any lines of text or the end of the file:
rule "rules dont work"
when
Item DeskSwitch changed to ON
then
sendCommand(DeskSwitch, OFF)
end
The rule does execute despite the warning in the log.
I didn’t notice this behavior before upgrading to 2.1.
Try copying a file to your pc, editing it, copying if back somewhere different on the openhab server and then copying it (not with samba) back into the correct location
If that works it hints it’s not samba. I suspect it’s that oh2.1 is attempting to grab the edited file while samba still has it locked to commit the updated version
The problem is that the samba file system creates 2 events for a new or changed file while saving a file. The first event is caught by the filewatcher but at that time the file is still empty, then there is that second event and the file gets parsed normally. From a java perspective there is no chance of distinguishing those two events, so we have to live with that warning while working on a remote filesystem like samba which creates such 2 events.