Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[actions] get() not working #164

Closed
BasvanH opened this issue Oct 15, 2022 · 5 comments · Fixed by #165
Closed

[actions] get() not working #164

BasvanH opened this issue Oct 15, 2022 · 5 comments · Fixed by #165
Assignees
Labels
bug Something isn't working

Comments

@BasvanH
Copy link

BasvanH commented Oct 15, 2022

I've updated from 3.4.0M2 to latest snapshot openHAB 3.4.0 Build #3133

In UI rules I used to send a telegram message like so:

var telegramAction = actions.get("telegram", "telegram:telegramBot:5a3e984615");

This worked on 3.4.0M2, in latest snapshot I get this error:

2022-10-15 16:50:06.147 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:
org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).get is not a function
        at <js>.:program(<eval>:3) ~[?:?]
        at org.graalvm.polyglot.Context.eval(Context.java:379) ~[?:?]
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) ~[?:?]
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ~[java.scripting:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) ~[?:?]
        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.lambda$0(ScriptActionHandler.java:58) ~[?:?]
        at java.util.Optional.ifPresent(Optional.java:183) [?:?]
        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.execute(ScriptActionHandler.java:55) [bundleFile:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1181) [bundleFile:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:989) [bundleFile:?]
        at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:89) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

actions.get() no longer seems to be there, how can I send a telegram message?

Regards,
Bastiaan

@BasvanH BasvanH added the bug Something isn't working label Oct 15, 2022
@florian-h05
Copy link
Contributor

florian-h05 commented Oct 15, 2022

That‘s quite interesting, seems like the problem is some openhab-js change from version 2.0.0 to 2.0.3.

It is definitely not deprecated, this is a bug.

I will take a look into this.

@florian-h05 florian-h05 self-assigned this Oct 15, 2022
florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Oct 15, 2022
@florian-h05 florian-h05 changed the title [rules] actions.get() deprecated? [actions] `get() not working Oct 15, 2022
@florian-h05 florian-h05 changed the title [actions] `get() not working [actions] get() not working Oct 15, 2022
florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Oct 15, 2022
Should fix openhab#164.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Oct 15, 2022
Should fix openhab#164.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Oct 15, 2022
Should fix openhab#164.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Oct 15, 2022
Should fix openhab#164.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@BasvanH
Copy link
Author

BasvanH commented Oct 16, 2022

@florian-h05, please let me know if I can test something for you.

@florian-h05
Copy link
Contributor

@BasvanH
I‘ve tagged you in the PR with the fix and explained how to test, so please give it a try!

@BasvanH
Copy link
Author

BasvanH commented Oct 16, 2022

Yes, after installing the update it works again. Thanks!

If this PR is merged, when will it reach the next snapshot?

@florian-h05
Copy link
Contributor

Great 👍

If this PR is merged, when will it reach the next snapshot?

I can merge on my own, but I'll wait a little bit if someone reviews.

After it has been merged, I can release a new version and open a PR on openhab-addons to use the new version in the JS Scripting addon.
I think this would take one or two days until it's in the milestone.

florian-h05 added a commit that referenced this issue Oct 18, 2022
…ns (#165)

* [actions] Fix `get` and `thingActions` not working

Should fix #164.

* [actions] Update JSDoc

* [actions] Fix dynamic exports of all actions not working

* [actions] Add duplicate note & Update type defs

* [actions] Update docs

* [actions] Update docs to remove wrong example

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants