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

Open
dandjo opened this issue May 29, 2024 · 7 comments
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

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

No branches or pull requests

5 participants