-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
ReferenceError: "me" is not defined in triggers.js #265
Comments
Not directly related to the issue, but two corrections to my workaround 1:
Actually, I consider to give it a go myself to implement my solution suggestion 2, but I am a little unsure on how JSRuleNew fits into the picture. Is this just a work in progress of a new implementation of JSRule? Then I would need to implement my fix in both. |
Thank you for reporting the problem and the analysis. The JS libraries will be completely reworked to match the Jython libraries once ES6 is available (OH JDK9 compatibility). If you want to clean them up, go ahead, otherwise I'll get in there at some point, but my time is very limited ATM. |
Time is also an issue for me, but I feel motivated to find some currently and give it a try. |
I am no JS expert, but if I understand it right, it would force us to fix this issue, as there would be no way to access |
FYI this did indeed force it to be fixed. (Well, you could probably explicitly assign the name to |
Full error message:
Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/javascript/personal/Papierschredder.js': ReferenceError: "me" is not defined in /etc/openhab2/automation/lib/javascript/core/triggers.js at line number 158
I did not define
me
in Papierschredder.js, as I don't use it anywhere. So fargetTrName
in triggers.js seems to be the only place demanding it.Currently I found 2 workarounds:
Globally define me, for e.g.:
var me = __FILE__.split(__DIR__).pop();
Provide a triggerName with each trigger.
My solution suggestions:
Either just use the uuid if no triggerName was provided. If someone wants to be able to identify the source of their triggers, they have to do the works and provide triggerNames.
Use the rule name instead of
me
. Probably needs to be done inJSRule
then instead ofgetTrName
: Go through all triggers in the JSRule function and if a trigger has no triggerName, generatge it there with uuid and name.The text was updated successfully, but these errors were encountered: