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

[modbus] Do not process values from channel if configured transformation service is unavailable (during startup) #16847

Closed
dandjo opened this issue May 29, 2024 · 33 comments · Fixed by #17457
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@dandjo
Copy link

dandjo commented May 29, 2024

Expected Behavior

Consistent value range for items.

Current Behavior

When starting or restarting openHAB, services like ModBus poll data from server ignore transformation services (here: JS) when they are not ready. This results in values out of usual value range destroying average calculations and representations (e.g. in Grafana - see screenshot).

image

image

2024-05-29 14:01:44.121 [INFO ] [org.openhab.core.Activator          ] - Starting openHAB 4.2.0 (Build openhab/openhab-core#4103)
2024-05-29 14:01:49.660 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Vienna'.
2024-05-29 14:01:49.671 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'en_AT'.
2024-05-29 14:01:49.674 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Measurement system set to 'SI'.
2024-05-29 14:02:01.593 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'influxdb.persist'
2024-05-29 14:02:02.905 [WARN ] [penhab.core.library.items.NumberItem] - Unit 'rpm' could not be parsed to a known unit. Keeping old unit 'one' for item 'miele_washing_machine_wwg360_spinning_speed'.
2024-05-29 14:02:08.717 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2024-05-29 14:02:10.980 [INFO ] [internal.handler.OnectaBridgeHandler] - Discovered a onecta unit thing with ID '44da5053-e3a9-4519-ba71-43e8da9f3642' '44da5053-e3a9-4519-ba71-43e8da9f3642'
2024-05-29 14:02:11.021 [INFO ] [internal.handler.OnectaBridgeHandler] - Discovered a onecta gateway thing with ID '44da5053-e3a9-4519-ba71-43e8da9f3642' '44da5053-e3a9-4519-ba71-43e8da9f3642'
2024-05-29 14:02:11.030 [INFO ] [internal.handler.OnectaBridgeHandler] - Discovered a onecta watertank thing with ID '44da5053-e3a9-4519-ba71-43e8da9f3642' '44da5053-e3a9-4519-ba71-43e8da9f3642'
2024-05-29 14:02:11.046 [INFO ] [.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2024-05-29 14:02:27.372 [WARN ] [ty.util.ssl.SslContextFactory.config] - Trusting all certificates configured for Client@6d7da0b[provider=null,keyStore=null,trustStore=null]
2024-05-29 14:02:27.376 [WARN ] [ty.util.ssl.SslContextFactory.config] - No Client EndPointIdentificationAlgorithm configured for Client@6d7da0b[provider=null,keyStore=null,trustStore=null]
2024-05-29 14:02:28.885 [INFO ] [nding.http.internal.HttpThingHandler] - Using the secure client for thing 'http:url:epex_spot_awattar'.
2024-05-29 14:02:29.276 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2024-05-29 14:02:30.360 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_current_item'}, service not found
2024-05-29 14:02:30.364 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_extrema_item'}, service not found
2024-05-29 14:02:30.367 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_extrema_item'}, service not found
2024-05-29 14:02:30.372 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_current_item'}, service not found
2024-05-29 14:02:30.374 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_current_item'}, service not found
2024-05-29 14:02:30.378 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_extrema_item'}, service not found
2024-05-29 14:02:30.383 [WARN ] [nelTransformation$TransformationStep] - Failed to use TransformationStep{serviceName='JS', function='config:js:awattar_extrema_item'}, service not found
2024-05-29 14:02:32.321 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'localhost' with clientid ae9753ea-0d0b-4be9-8d2d-b838af1cee34
2024-05-29 14:02:36.449 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.493 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.498 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.507 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.516 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.528 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.537 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.543 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.550 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.559 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.565 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:37.575 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:38.397 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:38.403 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:38.407 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable
2024-05-29 14:02:38.411 [WARN ] [s.internal.SingleValueTransformation] - couldn't transform response because transformationService of type 'JS' is unavailable

Possible Solution

Ignore values from Thing channel when transformation is configured but not available or initialize transformation services earlier or before Things.

Steps to Reproduce (for Bugs)

  1. Add a Modbus data Thing and configure "Read Transform" (e.g. "JS:|input/10" like in screenshot above).
  2. Link item to channel.
  3. Restart openHAB.

Your Environment

  • Version used: openHAB 4.2.0-M3
@dandjo dandjo added the bug An unexpected problem or unintended behavior of an add-on label May 29, 2024
@dandjo dandjo changed the title Do not persist values if from channel if transformation service is unavailable (during startup) Do not process values from channel if configured transformation service is unavailable (during startup) May 29, 2024
@lolodomo
Copy link
Contributor

Looks very similar to openhab/openhab-core#3763

@dandjo
Copy link
Author

dandjo commented May 29, 2024

@lolodomo True, especially 3763#1745267997 comment nails the issue.

@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/oh4-transformationservice-of-type-js-is-unavailable/148786/21

@dandjo
Copy link
Author

dandjo commented May 31, 2024

@lolodomo @kaikreuzer Are there any ideas on how to solve this? Is it even possible to influence the order? Is there a dependency management for this?

@J-N-K
Copy link
Member

J-N-K commented Jun 5, 2024

This is not a core issue. The SingleValueTransformation is implemented in the modbus-addon. The core ChannelTransformation$TransformationStep is correctly returning an empty Optional for a missing transformation service. I'll move this to openhab-addons.

@J-N-K J-N-K transferred this issue from openhab/openhab-core Jun 5, 2024
@J-N-K J-N-K changed the title Do not process values from channel if configured transformation service is unavailable (during startup) [modbus] Do not process values from channel if configured transformation service is unavailable (during startup) Jun 5, 2024
@maisun
Copy link

maisun commented Jun 24, 2024

Has anybody found a solution to this? It's really bothering at least for modbus add-on (which ususally requires read/write transforms)

@dandjo
Copy link
Author

dandjo commented Jun 24, 2024

I found a workaround, which is not really satisfying, but solves the issue atm. I created a transformation script of the same type which I am using in the thing transformation (JS:|input in my case). This transformation is added as thing > item transformation in the channel. In my case it is a simple passthrough of the value, but rendered through the transformation. The result is an error when the transformation service is unavailable but without passing the raw value to the item.

image

image

@lsiepel
Copy link
Contributor

lsiepel commented Aug 10, 2024

@dandjo if the scale is wrong, we could try to fix this using bare UoM. No transformation service might be needed at all.

Since 4.2.0 the persistence services UoM support has been greatly enhanced. It should now be possible to store, show and calculate in your unit of choice. If you need help to adapt, please state your item labels, scripts and persistence configuration.

@maisun
Copy link

maisun commented Aug 10, 2024

I have moved away from JS, you can see some discussions in this post:
https://community.openhab.org/t/oh4-transformationservice-of-type-js-is-unavailable/148786/28

@lsiepel
Copy link
Contributor

lsiepel commented Aug 10, 2024

Have not read everything, can I assume this issue is fixed / no longer relevant? If so please close it otherwise add details so we can work on this together.

@dandjo
Copy link
Author

dandjo commented Aug 10, 2024

@lsiepel it is relevant and not fixed. Using UoM is the wrong approach, since some transformations are more complex for certain Modbus data. The behavior of SingleValueTransformation should be the same as ChannelTransformation$TransformationStep as @J-N-K mentioned above. If this is the solution, it should be straight forward, but I'm not familiar with the implementation. What kind of details do you need?

@lsiepel
Copy link
Contributor

lsiepel commented Sep 21, 2024

@jimtng in #17306 this transformation was adapted to support chaining, while related it does not fix this issue. So i was looking into this again.
I fail to get a good understanding on how this should be implemented. I looked at mqtt binding, but they are setup completely different. Could you be of any help or guide me somehow?

@jimtng
Copy link
Contributor

jimtng commented Sep 22, 2024

When I migrated it to use ChannelTransformation, I retained the original behaviour of the binding. It passes through the data unmodified when the transformation failed.

Since I don't use modbus binding myself, I'm not sure why it was designed this way originally.

#17457 will discard the data now, but I need testers to make sure that this doesn't break something.

@lsiepel
Copy link
Contributor

lsiepel commented Sep 22, 2024

@dandjo would you be able to test?

@ssalonen
Copy link
Contributor

@jimtng I cannot recall either why it was built this way originally.

@jimtng
Copy link
Contributor

jimtng commented Sep 22, 2024

For those who can test, I've posted a jar file here #17457
It needs openhab 4.3.0.M1 or snapshot.

@dandjo
Copy link
Author

dandjo commented Sep 23, 2024

@jimtng basically it works, but I'm getting this error:

2024-09-23 13:12:22.907 [ERROR] [very.internal.ModbusDiscoveryService] - bundle org.openhab.binding.modbus:4.3.0.202409220024 (315)[org.openhab.binding.modbus.discovery.internal.ModbusDiscoveryService(408)] : The addModbusEndpoint method has thrown an exception
java.lang.IllegalArgumentException: argument type mismatch
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:245) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:687) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:531) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) ~[?:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:2086) ~[?:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.bindDependency(DependencyManager.java:1903) ~[?:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:1890) ~[?:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:320) ~[?:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115) ~[?:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1002) ~[?:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:975) ~[?:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:920) ~[?:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:220) ~[org.eclipse.osgi-3.18.0.jar:?]
	at java.security.AccessController.doPrivileged(AccessController.java:318) [?:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:217) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:118) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:48) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:547) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:534) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:660) [org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:88) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.BindMethod.getServiceObject(BindMethod.java:675) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2612) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:2078) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:2061) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:443) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:336) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:304) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1232) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1152) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:959) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:895) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1184) [bundleFile:?]
	at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:116) [bundleFile:?]
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:123) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:961) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:937) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:874) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:141) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:262) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:500) [org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:929) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:915) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:984) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:752) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:674) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:437) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:671) [bundleFile:?]
	at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:310) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:593) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator.access$200(Activator.java:74) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:460) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) [bundleFile:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) [osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) [osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) [osgi.core-8.0.0.jar:?]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:949) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:229) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:138) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:130) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:217) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.Module.publishEvent(Module.java:499) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.Module.start(Module.java:486) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1783) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.18.0.jar:?]
2024-09-23 13:12:24.841 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.

@jimtng
Copy link
Contributor

jimtng commented Sep 23, 2024

@dandjo thanks for testing. Can you tell me if you're running a recent openhab 4.3 snapshot (M1 or later) with the test bundle? At first glance I can't tell how the change I made could affect discovery.

@dandjo
Copy link
Author

dandjo commented Sep 23, 2024

@jimtng Yes, 4.3.0-M1 running here. When using the original ModBus binding, the error is gone, so it definitively has to do with the manual placed jar.

@lsiepel
Copy link
Contributor

lsiepel commented Sep 23, 2024

Maybe double check by re-compiling, uploading and verifying the used version in karaf. It should have a date in the version if i remember correctly.

@dandjo
Copy link
Author

dandjo commented Sep 23, 2024

Not sure what you want me to check @lsiepel :-)

The pasted Exception above tells me, I'm using org.openhab.binding.modbus:4.3.0.202409220024 of the binding.

This is what openHAB tells me:

runtimeInfo:
  version: 4.3.0.M1
  buildString: Milestone Build
locale: en-AT
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.12
  javaVendor: Ubuntu
  osName: Linux
  osVersion: 6.8.0-1011-raspi
  osArchitecture: aarch64
  availableProcessors: 4
  freeMemory: 57253808
  totalMemory: 432013312
  uptime: 20113
  startLevel: 100
addons:
  - automation-jsscripting
  - binding-enigma2
  - binding-http
  - binding-mielecloud
  - binding-modbus
  - binding-mqtt
  - binding-netatmo
  - binding-tado
  - misc-openhabcloud
  - persistence-influxdb
  - transformation-jsonpath
  - transformation-regex
  - ui-basic
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    pixelRatio: 1
    prefersColorScheme: dark
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 12
    language: en-AT
    languages:
      - en-AT
      - en-GB
      - en-US
      - en
      - de
    onLine: true
    platform: Linux x86_64
  screen:
    width: 3440
    height: 1440
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
    blocklyRenderer: null
  userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
    Gecko) Chrome/129.0.0.0 Safari/537.36
timestamp: 2024-09-23T16:58:05.510Z

@lsiepel
Copy link
Contributor

lsiepel commented Sep 23, 2024

Was mainly for jimtng.

Only thing you could double check is if the bundled version of the binding is ininstalled. Two versions of the same binding can give weird results.

I also don’t see any relation between the PR and the exception .

@jimtng
Copy link
Contributor

jimtng commented Sep 24, 2024

@dandjo When testing the jar, was the bundle org.openhab.core.io.transport.modbus also active?

openhab> list -s | grep modbus
324 │ Active │  80 │ 4.3.0.202409240102    │ org.openhab.binding.modbus
332 │ Active │  80 │ 4.3.0.202409170255    │ org.openhab.core.io.transport.modbus

@dandjo
Copy link
Author

dandjo commented Sep 24, 2024

@jimtng When uninstalling the original ModBus binding and placing the jar in the addons folder, I get a non functional binding:

openhab> list -s | grep modbus
316 │ Installed │  80 │ 4.3.0.202409220024    │ org.openhab.binding.modbus

Wen placing the jar in the addon folder without modifications to my setup I get the following with the error pasted before:

openhab> list -s | grep modbus
317 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus
318 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.e3dc
319 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.helioseasycontrols
320 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sbc
321 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.stiebeleltron
322 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.studer
323 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sungrow
324 │ Active │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sunspec
325 │ Active │  80 │ 4.3.0.M1              │ org.openhab.core.io.transport.modbus
326 │ Active │  80 │ 4.3.0.202409220024    │ org.openhab.binding.modbus

@jimtng
Copy link
Contributor

jimtng commented Sep 24, 2024

Try stopping the stock binding, don't let both be active at the same time.

openhab> stop 317
or
openhab> bundle:stop 317

@dandjo
Copy link
Author

dandjo commented Sep 24, 2024

Okay, done. Now the error is gone and the binding is providing correct values. Seems to work in general.

openhab> list -s | grep modbus
317 │ Resolved │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus
318 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.e3dc
319 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.helioseasycontrols
320 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sbc
321 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.stiebeleltron
322 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.studer
323 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sungrow
324 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.binding.modbus.sunspec
325 │ Active   │  80 │ 4.3.0.M1              │ org.openhab.core.io.transport.modbus
326 │ Active   │  80 │ 4.3.0.202409220024    │ org.openhab.binding.modbus

@dandjo
Copy link
Author

dandjo commented Sep 24, 2024

Ok, I'm experiencing weird behavior now. After a restart, the "Read Transform" settings are wrapped with "[]" and the transformation got completely broken. Original values are passed and destroy my persistence. Maybe someone else could test this too.

image

@jimtng
Copy link
Contributor

jimtng commented Sep 25, 2024

After a restart, the "Read Transform" settings are wrapped with "[]"

This is because you've reverted to the default binding, not the new binding.
Updating to snapshot should fix this issue. It is not related to #17457.

It's because of this new enhancement: #17306 which was merged after 4.3.0.M1.

To be sure, once you've upgraded to snapshot, check the read transform settings again, make sure there are no [] around it.

@dandjo
Copy link
Author

dandjo commented Sep 25, 2024

@jimtng Thanks, I see. What is the correct inline syntax with the new version?

before:

JS:|input/100

new:

JS(|input/100)

Is this correct?

@jimtng
Copy link
Contributor

jimtng commented Sep 25, 2024

Both syntaxes are supported by the new version

@dandjo
Copy link
Author

dandjo commented Sep 25, 2024

Yes, but which syntax is preferred and should be used in the future?

@jimtng
Copy link
Contributor

jimtng commented Sep 25, 2024

At the moment, it is undecided, so perhaps both will continue to be supported.

The idea was to make the syntax uniform with the core syntax, i.e. the JS(....) one. It is unlikely that either will stop to be supported in the foreseeable future, because backwards compatiblity is highly valued.

@dandjo
Copy link
Author

dandjo commented Sep 26, 2024

Thanks, LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants