openhab / openhab-distro

The binary distribution of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.3k stars 394 forks source link

OH4.1 M5 Failed to process script #1617

Closed miloit closed 8 months ago

miloit commented 8 months ago

getting this error now

Failed to process script 'JS:rollershutter.js': Could not get script for UID 'JS:rollershutter.js'. [WARN ] [.thing.internal.CommunicationManager] - No ProfileFactory found which supports profile 'transform:JS' for link 'Window_covering_device_2__TZ3000_wptayaqr_Position -> deconz:windowcovering:000000000000:a4c1385ebde6490601:position'

But in OH4.1M4 no issue

/transform/rollershutter.js

(function(position) { var newposition = 100 - position; return newposition; }) (input)

item

Rollershutter myLivingShutter "Wohnzimmerd " { channel="deconz:windowcovering:000000000000:a4c1385ebde6490601:position"[profile="transform:JS", toItemScript="JS:rollershutter.js", toHandlerScript="JS:rollershuttertothing.js"] }

openhab-bot commented 8 months ago

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

https://community.openhab.org/t/openhab-4-1-milestone-discussion/149502/156

kaikreuzer commented 8 months ago

Just to be sure:

  1. You can confirm that the JS scripting add-on is successfully installed?
  2. This happens on every start of openHAB?
miloit commented 8 months ago

@kaikreuzer

1.

openhab> list -s | grep openhab
155 │ Active │  80 │ 1.0.0                  │ org.openhab.base-fixes
156 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core
157 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.addon
158 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.addon.marketplace
159 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.addon.marketplace.karaf
160 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.audio
161 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.auth.jaas
162 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.automation
163 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.automation.module.media
164 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.automation.module.script
165 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.automation.module.script.rulesupport
166 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.automation.rest
167 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.core
168 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery
169 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.addon
170 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.addon.process
171 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.mdns
172 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.dispatch
173 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.ephemeris
174 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.id
175 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.console
176 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.console.karaf
177 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.http
178 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.http.auth
180 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.monitor
181 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.net
182 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest
183 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.audio
184 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.auth
185 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.core
186 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.mdns
187 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.sitemap
188 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.sse
189 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.swagger
190 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.transform
191 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.ui
192 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.rest.voice
193 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.mdns
194 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.websocket
195 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.karaf
196 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.core
197 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.item
198 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.item.ide
199 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.item.runtime
200 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.lsp
201 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.persistence
202 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.persistence.ide
203 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.persistence.runtime
204 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.rule
205 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.rule.ide
206 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.rule.runtime
207 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.script
208 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.script.ide
209 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.script.runtime
210 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.sitemap
211 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.sitemap.ide
212 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.sitemap.runtime
213 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.thing
214 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.thing.ide
215 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.thing.runtime
216 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.model.yaml
217 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.persistence
218 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.semantics
219 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.storage.json
220 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.thing
221 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.transform
222 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.ui
223 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.ui.icon
224 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.voice
225 │ Active │  80 │ 4.1.0.M5               │ org.openhab.ui
226 │ Active │  80 │ 4.1.0.M5               │ org.openhab.ui.iconset.classic
278 │ Active │  80 │ 4.1.0.M5               │ org.openhab.automation.jsscripting
279 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.astro
280 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.deconz
281 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.dwdpollenflug
282 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.exec
283 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.http
284 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.hue
285 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.icalendar
286 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.logreader
287 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.mail
288 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.mqtt
289 │ Active │  81 │ 4.1.0.M5               │ org.openhab.binding.mqtt.espmilighthub
290 │ Active │  81 │ 4.1.0.M5               │ org.openhab.binding.mqtt.generic
291 │ Active │  82 │ 4.1.0.M5               │ org.openhab.binding.mqtt.homeassistant
292 │ Active │  82 │ 4.1.0.M5               │ org.openhab.binding.mqtt.homie
293 │ Active │  82 │ 4.1.0.M5               │ org.openhab.binding.mqtt.ruuvigateway
294 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.network
295 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.ntp
296 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.openuv
297 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.openweathermap
298 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.samsungtv
299 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.sensorcommunity
300 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.shelly
301 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.systeminfo
302 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.tr064
303 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.volumio
304 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.yamahareceiver
305 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.yioremote
306 │ Active │  80 │ 4.1.0.M5               │ org.openhab.binding.zwave
307 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.upnp
308 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.usbserial
309 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.usbserial.linuxsysfs
310 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.usbserial.ser2net
311 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.serial
312 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.mqtt
313 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.serial
314 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.serial.rxtx
315 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.serial.rxtx.rfc2217
316 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.io.transport.upnp
317 │ Active │  80 │ 4.1.0.M5               │ org.openhab.io.metrics
318 │ Active │  80 │ 4.1.0.M5               │ org.openhab.io.openhabcloud
319 │ Active │  80 │ 4.1.0.M5               │ org.openhab.persistence.jdbc
320 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.exec
321 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.jsonpath
322 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.map
323 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.regex
324 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.scale
325 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.xpath
326 │ Active │  75 │ 4.1.0.M5               │ org.openhab.transform.xslt
327 │ Active │  80 │ 4.1.0.M5               │ org.openhab.ui.basic
329 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.addon.ip
330 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.addon.upnp
331 │ Active │  80 │ 4.1.0.M5               │ org.openhab.core.config.discovery.addon.mdns

2.yes on every start and when I use the device

kaikreuzer commented 8 months ago

@J-N-K & @florian-h05 Would any of you have an idea why the ProfileFactory isn't found here anymore?

florian-h05 commented 8 months ago

I have seen that yesterday as well when upgrading to the latest snapshot.

I have just checked my log from snapshot 3777, I guess it was build on 14.12.2023 (since I usually only have openHAB restarts after an upgrade and always upgrade to the latest snapshot), I cannot find that log message in the log from back then, so the problem must have been introduced afterwards.

The JS Scripting add-on hasn’t changed since weeks, except for the upgrade of the openHAB JavaScript library, but that does not affect availability of the add-on.

I think this is probably related to the slow start-up from #1616.

J-N-K commented 8 months ago

@florian-h05 Unlikely, because according to the forum post it also happens on subsequent restarts which don't suffer from the slow startup issue.

florian-h05 commented 8 months ago

IIRC my log message was related to Item state transformations, but it only occured once and never again, I have now tested several recent milestones until the latest one 3792, and at least the Item state transformation works.

miloit commented 8 months ago

When I used it this is written in the log

2023-12-20 17:17:21.038 [ERROR] [.module.script.profile.ScriptProfile] - Failed to process script 'JS:rollershuttertothing.js': Could not get script for UID 'JS:rollershuttertothing.js'.

I will rename it later and maybe it will be found than

I have another idea....

@kaikreuzer @florian-h05

There is/was maybe an error in the docu....and someone updated sth. in another code

https://community.openhab.org/t/inverted-settings-window-covering-device/150990/13?u=milo

I will try and keep you posted later

florian-h05 commented 8 months ago

@miloit So you want to tell that it is solved?

At least I cannot reproduce your issue, for me everything works fine.

miloit commented 8 months ago

yes, it's solved depending what is correct now? the documentation or the code? @florian-h05

florian-h05 commented 8 months ago

For me channel="" [profile="transform:JS", toItemScript="test.js", toHandlerScript="test.js"] worked, which is what's documented: https://next.openhab.org/docs/configuration/transformations.html#script-transformation-profile.

miloit commented 8 months ago

For me channel="" [profile="transform:JS", toItemScript="test.js", toHandlerScript="test.js"] worked, which is what's documented: https://next.openhab.org/docs/configuration/transformations.html#script-transformation-profile.

but in the past I needed the JS: before just keep it in zour mind if someone has the same issue

florian-h05 commented 8 months ago

I needed the JS: before just keep it in zour mind if someone has the same issue

I guess back then it was profile="SCRIPT" ... The change was announced under the Core Changes heading of the openHAB 4.0.0 Release Notes:

SCRIPT transformation has been removed and replaced with language-specific transformations: JS, RB, PY, DSL, GROOVY, NASHORNJS, etc. See https://www.openhab.org/docs/configuration/transformations.html#script-transformation

(https://github.com/openhab/openhab-distro/releases/tag/4.0.0)