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

OH3 callScript - scripts are not executed #1990

Closed
holgerfriedrich opened this issue Dec 22, 2020 · 14 comments · Fixed by #2020
Closed

OH3 callScript - scripts are not executed #1990

holgerfriedrich opened this issue Dec 22, 2020 · 14 comments · Fixed by #2020

Comments

@holgerfriedrich
Copy link
Member

holgerfriedrich commented Dec 22, 2020

Executing scripts via callScript seems to be broken:

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'szenen-1' failed: Script 'sonnenschutz' cannot be found. in szenen

Script is located in the scripts folder, it worked before with OH25 before upgrade.

There seem to be other users affected, see
See also https://community.openhab.org/t/scripts-in-oh3/110843/5

Any hint appreciated. Can I tune the log level to obtain more information (I tried, but I have not been able to guess the right logger name).

@holgerfriedrich holgerfriedrich changed the title OH3 scripts are not executed OH3 callScript - scripts are not executed Dec 22, 2020
@smaktacular
Copy link

smaktacular commented Dec 25, 2020

same here:

grafik

edit: was working in 2.5.2 docker image, does not work in 3.0.0

@voruti
Copy link

voruti commented Dec 25, 2020

@olialb
Copy link

olialb commented Dec 26, 2020

I am using openhabian. Just upgraded using the standard upgrade menu and have exactly the same issue. All my .script files are not found. Let us know if we can support to idetify the root cause,

@stefan-oh
Copy link

I only had one script, calculating holiday dates. I took the chance to eliminate that with calculations using Ephemeris, so I'm no longer affected, but obviously others depend much more on this functionality. And as it is a documented feature ist should work again.

My thoughts:
My rules are all file based. In OH3 these files are read at startup and are being executed from an internal data store. I have files with multiple rules. In the GUI I see every rule being singled out.
When the script is called the log output can be read as if the interpreter is looking for the script within the realm of the rule itself instead of an external location.
Maybe the lookup mechanism in the scripts folder got lost when file based rules are being read into memory at startup?

@kaikreuzer
Copy link
Member

This looks like an unfortunate regression caused by #1433.
I have created #2020 as a fix.

According to my tests, there should be a simple workaround:
Simply rename your script files from myfile.script to myfile.script.script and they should be found.
Could you please try if that works for you?

@holgerfriedrich
Copy link
Member Author

Thank you @kaikreuzer for fixing this.

Though, the workaround does not do the trick. Same error message in the log, also after a restart.

@stefan-oh
Copy link

Same result in my setup, I confirm holgerfriedrich's test result

@bern77
Copy link

bern77 commented Dec 28, 2020

It does work for me, however you need to use callScript('myfile.script').

@holgerfriedrich
Copy link
Member Author

Thanks, @bern77! This works fine for now.

@kaikreuzer
Copy link
Member

Glad to hear that we have found a workaround!

cweitkamp pushed a commit that referenced this issue Dec 29, 2020
Fixes #1990

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@Birchcroft
Copy link

All the above is interestig, but being new to Openhabian 3 I am trying to do as much within the UI as I can as I see this to be the future. So rather than using .script files I've tried developing scripts within the UI and then using them. Unfortunately, callScript still does not work with scripts developed in this manner and the workaround above does not work because, as far a I can determine, there is no .script file to rename.

So does anyone have any suggestions for a workaround when scripts are developed in the UI?

cweitkamp pushed a commit that referenced this issue Jan 10, 2021
Fixes #1990

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/help-needed-with-rule-in-openhab3/121780/1

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this issue Jul 11, 2023
Fixes openhab#1990

Signed-off-by: Kai Kreuzer <kai@openhab.org>
GitOrigin-RevId: 1c3e431
@radzik2024
Copy link

radzik2024 commented Jan 19, 2024

Unfortunatelly - OH version 4.1.1 - the problem is come back :-( Regresion problem :-(

My script is in "scripts" folder but I can not call him :-( callScript("scriptName.script") - "cannot be found"

Windows 11 platform, OH 4.1.1

UPDATE:
scary! Something changed my script in the directory. The file is called the same, but inside instead of a script there is some HTML, like a page with a message from YouTube - update your browser! What's the matter, why the content of the script was changed to some html!

@rkoshak
Copy link

rkoshak commented Jan 19, 2024

The file is called the same, but inside instead of a script there is some HTML, like a page with a message from YouTube - update your browser! What's the matter, why the content of the script was changed to some html!

OH does not have any way to write to those files. So I would guess that you have something else going on. If you were running on an SD card I'd say weird stuff like this can happen from not shutting down nicely or the SD card wearing out. Since this is Windows presumably running off of an SDD or HDD it's a mystery. But if correcting that file to make it a proper script works I don't think this is a regression of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.