openhab-addons: [modbus] Do not process values from channel if configured transformation service is unavailable (during startup)

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 33 (17 by maintainers)

Most upvoted comments

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