@kubawolanin exactly, what I was looking for!
changed this via vpn as Iām not at home, because I was so curious if it works! now guess what, who is going to trigger my motion sensor?!
Free Hug to @kubawolanin
only thing I changed is the format of the return value as I expect it to be a string - but didnāt check either
DateTime LastTimeTriggered "Last time triggered [JS(relative.js):%s]"
Also I wanted to go with moment_with_locales.
Iāll check this with some workaround and feedback thenā¦
THANK YOU
EDIT:
already set up and getting some complicated output:
2017-04-14 22:02:08.971 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - transformation throws exception [transformation=org.eclipse.smarthome.transform.javascript.internal.JavaScriptTransformationService@84a8aa, value=java.util.GregorianCalendar[time=1492200124000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2017,MONTH=3,WEEK_OF_YEAR=15,WEEK_OF_MONTH=2,DAY_OF_MONTH=14,DAY_OF_YEAR=104,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=10,HOUR_OF_DAY=22,MINUTE=2,SECOND=4,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]]
org.eclipse.smarthome.core.transform.TransformationException: An error occured while executing script.
at org.eclipse.smarthome.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java:79)[189:org.eclipse.smarthome.transform.javascript:0.9.0.201703201701]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.transform(ItemUIRegistryImpl.java:415)[140:org.eclipse.smarthome.ui:0.9.0.201703201701]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getLabel(ItemUIRegistryImpl.java:342)[140:org.eclipse.smarthome.ui:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.AbstractWidgetRenderer.getValue(AbstractWidgetRenderer.java:151)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.AbstractWidgetRenderer.preprocessSnippet(AbstractWidgetRenderer.java:87)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.TextRenderer.renderWidget(TextRenderer.java:43)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:166)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:128)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:92)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:170)[192:org.eclipse.smarthome.ui.basic:0.9.0.201703201701]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[85:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[85:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[176:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[83:org.eclipse.jetty.security:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[176:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[85:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[176:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.Server.handle(Server.java:499)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[84:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[75:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[87:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[87:org.eclipse.jetty.util:9.2.19.v20160908]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: javax.script.ScriptException: <eval>:2:17 Unsupported RegExp flag: o
/etc/openhab2/transform/Moment_With_Locales.Min.js
^ in <eval> at line number 2 at column number 17
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)[nashorn.jar:]
at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:537)[nashorn.jar:]
at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:524)[nashorn.jar:]
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)[nashorn.jar:]
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150)[nashorn.jar:]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)[:1.8.0_121]
at org.eclipse.smarthome.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java:77)[189:org.eclipse.smarthome.transform.javascript:0.9.0.201703201701]
... 30 more
Caused by: jdk.nashorn.internal.runtime.ParserException: <eval>:2:17 Unsupported RegExp flag: o
/etc/openhab2/transform/Moment_With_Locales.Min.js
^
at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:294)[nashorn.jar:]
at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:279)[nashorn.jar:]
at jdk.nashorn.internal.parser.AbstractParser.getLiteral(AbstractParser.java:535)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.primaryExpression(Parser.java:2002)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2511)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1150)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.statement(Parser.java:967)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:773)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.functionBody(Parser.java:2901)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.functionExpression(Parser.java:2663)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2506)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.primaryExpression(Parser.java:1992)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2511)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1150)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.statement(Parser.java:967)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:773)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.program(Parser.java:709)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.parse(Parser.java:283)[nashorn.jar:]
at jdk.nashorn.internal.parser.Parser.parse(Parser.java:249)[nashorn.jar:]
at jdk.nashorn.internal.runtime.Context.compile(Context.java:1284)[nashorn.jar:]
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1251)[nashorn.jar:]
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:627)[nashorn.jar:]
at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:535)[nashorn.jar:]
... 35 more
EDIT2:
Yeah perhaps I should not just paste the path. Really uncertain with js ar the moment