adamg
(Adam Gayne)
September 27, 2020, 1:33pm
1
I’ve recently been directed to use Visual Studio Code for editing my files, and it has been a game changer!
However, when it loads I get 2 errors listed at the bottom in relation to my mysql.persist file:
mismatched input 'default' expecting RULE_ID
no viable alternative at input 'restoreOnStartup'
and the content of my persist file:
Strategies {
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
default = everyChange
}
Items {
gAllLights* : strategy = everyChange, restoreOnStartup
gChart* : strategy = everyMinute, restoreOnStartup
gHistory* : strategy = everyChange, restoreOnStartup
}
My data is, and has always been, persisting correctly and all my charts are as expected so the file seems to be working OK.
Can anyone advise?
H102
(CM6.5 H102)
September 27, 2020, 2:06pm
2
Do you have a rule file named default?
adamg
(Adam Gayne)
September 27, 2020, 2:07pm
3
Nope, not that I can see anyway!
H102
(CM6.5 H102)
September 27, 2020, 2:09pm
4
Try: default = everyUpdate
Edit: use everyUpdate if using mapdb as persist.
adamg
(Adam Gayne)
September 27, 2020, 2:16pm
5
Still the same with everyUpdate.
As I say everything is working as expected, so maybe this is just a case of not broken don’t touch it, but if there is a way to just clear the error would be good.
H102
(CM6.5 H102)
September 27, 2020, 2:19pm
6
I do not use mysql but most will recommend to use mapdb for restore on start up. Maybe try removing restoreOnStartup from mysql and add mapdb. You can keep mysql for all other persist needs.
Strategies {
default = everyUpdate
}
Items {
item1, item2 : strategy = everyChange, restoreOnStartup
}
opus
(Jürgen Baginski)
September 27, 2020, 2:46pm
7
Could you post the complete errors? That way we would also know where the errr occurs (line, column).
adamg
(Adam Gayne)
September 27, 2020, 2:54pm
8
Sure
{
"resource": "/etc/openhab2/services/mysql.persist",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax",
"severity": 8,
"message": "mismatched input 'default' expecting RULE_ID",
"startLineNumber": 6,
"startColumn": 20,
"endLineNumber": 6,
"endColumn": 27
}
and
{
"resource": "/etc/openhab2/services/mysql.persist",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax",
"severity": 8,
"message": "no viable alternative at input 'restoreOnStartup'",
"startLineNumber": 6,
"startColumn": 29,
"endLineNumber": 6,
"endColumn": 45
}
Which is even more confusing, as line 6 is just the closing bracket after the strategies, there are no empty spaces after the bracket.
JustinG
(JustinG)
September 27, 2020, 4:09pm
9
Since your persistence rules work as far as OH is concerned, and your persistence file matches quite closely with my mysql persistence file which does not produce any errors it sounds like the issue must be in VSC somewhere.
Are you using the OH plugin for VSC? If so, which version?
rossko57
(Rossko57)
September 27, 2020, 4:15pm
10
Reckon you’ve got some hidden control characters in there.
adamg
(Adam Gayne)
September 27, 2020, 9:20pm
11
Well, I don’t know what happened, but the error is no longer flagging!
Thanks all for your inputs
denominator
(James Bowler)
September 28, 2020, 12:56am
12
glad you got it fixed.
I would recomend like @H102 to use the mapdb persistance for restore on startup.
My mapdb.persist
file
Strategies {
default = everyChange
}
Items {
* : strategy = everyChange, restoreOnStartup
}