I don’t seem to be able to use PeriodFormatter or PeriodFormatterBuilder. My rule looks like this…
import org.joda.time.Duration
import org.joda.time.format.DateTimeFormat
import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.PeriodFormatter
import org.joda.time.format.PeriodFormatterBuilder
rule "Test rule"
when
Item Test_Switch1 received command
then
logInfo("[DEBUG]: ", Duration.name());
logInfo("[DEBUG]: ", PeriodFormatter.name());
logInfo("[DEBUG]: ", PeriodFormatterBuilder.name());
end
When I trigger the rile, I get the following in the log:
2020-02-29 15:05:33.098 [INFO ] [pse.smarthome.model.script.[DEBUG]: ] - org.joda.time.Duration
2020-02-29 15:05:33.100 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Test rule': The name 'PeriodFormatter' cannot be resolved to an item or type; line 12, column 26, length 15
I’m not all that experienced with java, so any help is appreciated.
Yes, I did see both of those. Like i said, though I’ve been a coder for decades, I’m in the .net stack and not very familiar with things like "“maven” and “Jython”.
If I interpret all that correctly, I’ll need to use a version that’s newer than the stable build. I’m not entirely afraid of that, particularly since it seems i’ll get access to a more advanced rules engine. Even if it means I have to learn a new syntax, I’d like to have more “coder-friendly” scripting.
I’m not up to speed on the nuances of this language. My rule was more complex that that; I just tried to shorten using down to something that looked simple and would throw the same error.
Nope… 2.5.2 will work fine. Scripted automation is perfect for a developer and Python is easy to learn. It’s night and day compared to the DSL. There’s no maven involved , just scripting. Let me know if you need any help!