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

[smartmeter] Thinghandler spams logs if serial port is unreachable #9780

Closed
t2000 opened this issue Jan 11, 2021 · 0 comments · Fixed by #9781
Closed

[smartmeter] Thinghandler spams logs if serial port is unreachable #9780

t2000 opened this issue Jan 11, 2021 · 0 comments · Fixed by #9781
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@t2000
Copy link
Contributor

t2000 commented Jan 11, 2021

Currently the ThingHandler of the smartmeter binding floods the logs with warnings every 2 seconds if it cannot open the serial port:

2021-01-11 18:55:01.005 [WARN ] [ding.smartmeter.internal.MeterDevice] - Failed to read: Serial port /dev/ttyUSB0 not found or port is busy.. Closing connection and trying again in 2 seconds...; smartmeter:meter:heatingEnergy
org.openmuc.jrxtx.PortNotFoundException: Serial port /dev/ttyUSB0 not found or port is busy.
        at org.openmuc.jrxtx.JRxTxPort.openSerialPort(JRxTxPort.java:64) ~[bundleFile:?]
        at org.openmuc.jrxtx.SerialPortBuilder.build(SerialPortBuilder.java:140) ~[bundleFile:?]
        at org.openmuc.j62056.Iec21Port.<init>(Iec21Port.java:270) ~[bundleFile:?]
        at org.openmuc.j62056.Iec21Port.<init>(Iec21Port.java:47) ~[bundleFile:?]
        at org.openmuc.j62056.Iec21Port$Builder.buildAndOpen(Iec21Port.java:243) ~[bundleFile:?]
        at org.openhab.binding.smartmeter.internal.iec62056.Iec62056_21SerialConnector.openConnection(Iec62056_21SerialConnector.java:126) ~[bundleFile:?]
        at org.openhab.binding.smartmeter.internal.MeterDevice.lambda$1(MeterDevice.java:168) ~[bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.onSubscribe(FlowableDoOnLifecycle.java:63) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableTimeoutTimed.subscribeActual(FlowableTimeoutTimed.java:47) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle.subscribeActual(FlowableDoOnLifecycle.java:38) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:50) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle.subscribeActual(FlowableDoOnLifecycle.java:38) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:50) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowablePublish.connect(FlowablePublish.java:130) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableRefCount.subscribeActual(FlowableRefCount.java:91) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14479) [bundleFile:?]
        at io.reactivex.Flowable.subscribe(Flowable.java:14426) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableRepeatWhen$WhenReceiver.onNext(FlowableRepeatWhen.java:100) [bundleFile:?]
        at io.reactivex.subscribers.SerializedSubscriber.onNext(SerializedSubscriber.java:100) [bundleFile:?]
        at io.reactivex.internal.operators.flowable.FlowableDelay$DelaySubscriber$OnNext.run(FlowableDelay.java:114) [bundleFile:?]
        at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:260) [bundleFile:?]
        at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:225) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

However, it correctly sets the ThingStatus to OFFLINE (COMMUNICATION_ERROR): Serial port /dev/energyheat not found or port is busy. and retries again, so the warnings and the information about the retry should be set to DEBUG level. The user sees the issue in the ThingStatus can can fix it without needing these warnings in the logs.

I will provide a PR for this.

@t2000 t2000 added the bug An unexpected problem or unintended behavior of an add-on label Jan 11, 2021
t2000 added a commit to t2000/openhab2-addons that referenced this issue Jan 11, 2021
kaikreuzer pushed a commit that referenced this issue Jan 11, 2021
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this issue May 10, 2021
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this issue Nov 7, 2021
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this issue May 5, 2022
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
1 participant