SML Reading OH 2.4

Hi. I’m trying to read USB SML data. UART Chip is CP210x from volkszähler.

Using the new 2.4 Add-on “smartmeter” it wont read from my USB port.

Any ideas what is needed, too? I’ve already installed librxtx-java, but without success.

2018-12-23 15:39:46.759 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:baca373d
2018-12-23 15:39:46.764 [WARN ] [ding.smartmeter.internal.MeterDevice] - Failed to read: No provider for port /dev/ttyUSB0 found. Closing connection and trying again in 2 seconds...; smartmeter:meter:baca373d
java.lang.IllegalStateException: No provider for port /dev/ttyUSB0 found
	at org.openhab.binding.smartmeter.internal.sml.SmlSerialConnector.openConnection(SmlSerialConnector.java:124) ~[247:org.openhab.binding.smartmeter:2.4.0]
	at org.openhab.binding.smartmeter.internal.MeterDevice.lambda$0(MeterDevice.java:159) ~[247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.onSubscribe(FlowableDoOnLifecycle.java:63) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableTimeoutTimed.subscribeActual(FlowableTimeoutTimed.java:47) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle.subscribeActual(FlowableDoOnLifecycle.java:38) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:50) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle.subscribeActual(FlowableDoOnLifecycle.java:38) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:50) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowablePublish.connect(FlowablePublish.java:130) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableRefCount.subscribeActual(FlowableRefCount.java:91) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14479) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.Flowable.subscribe(Flowable.java:14426) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableRepeatWhen$WhenReceiver.onNext(FlowableRepeatWhen.java:100) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.subscribers.SerializedSubscriber.onNext(SerializedSubscriber.java:100) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.operators.flowable.FlowableDelay$DelaySubscriber$OnNext.run(FlowableDelay.java:114) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:260) [247:org.openhab.binding.smartmeter:2.4.0]
	at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:225) [247:org.openhab.binding.smartmeter:2.4.0]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
1 Like

Same here.

Fount my fault in the meantime: I had two things defined, both using /dev/ttyUSB0, which failed. After stopping the old daemon working on /dev/ttyUSB0 and correcting some other mistakes in the things file, the binding seems to work now with the following things:

smartmeter:meter:MT691 [port="/dev/ttyUSB0", mode="SML"] {
    Channels:
        Type 1-0_1-8-0 : 1-0_1-8-0
        Type 1-0_16-7-0 : 1-0_16-7-0
}

This seems to work with my MT691 (first checks)…

have restarted the whole pi and - of course - OH. Then it was working.

Hi, i’ve got the same problem with the smartmeter 2.5.2 binding.
Is the librxtx-java library needed or what configuration on raspberry has to be done to get it working. The folder /dev/ttyUSB0 is abailable but the binding cannot access this:

`Failed to read: No provider for port /dev/ttyUSB0 found. Closing connection and trying again in 2 seconds...; smartmeter:meter:mt691 java.lang.IllegalStateException: No provider for port /dev/ttyUSB0 found at org.openhab.binding.smartmeter.internal.sml.SmlSerialConnector.openConnection(SmlSerialConnector.java:137) ~[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:?]`

Can anybody help? There shouldn’t run any other stuff using the same USB port. My boot device is a SSD harddisk connected to USB. The IR-Reader is plugged into another USB port. Can this cause the problem and how can i solve this?

The names given to USB ports can change at each boot up.
There is talk of that here

But the port is available

But i still get the error

2020-03-16 15:47:58.123 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:mt691
2020-03-16 15:47:58.126 [WARN ] [ding.smartmeter.internal.MeterDevice] - Failed to read: No provider for port /dev/ttyUSB0 found. Closing connection and trying again in 2 seconds...; smartmeter:meter:mt691

java.lang.IllegalStateException: No provider for port /dev/ttyUSB0 found
	at org.openhab.binding.smartmeter.internal.sml.SmlSerialConnector.openConnection(SmlSerialConnector.java:137) ~[bundleFile:?]
	at org.openhab.binding.smartmeter.internal.MeterDevice.lambda$1(MeterDevice.java:168) ~[bundleFile:?]
...
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_232]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_232]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_232]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2020-03-16 15:48:00.132 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:mt691
2020-03-16 15:48:00.134 [WARN ] [ding.smartmeter.internal.MeterDevice] - Failed to read: No provider for port /dev/ttyUSB0 found. Closing connection and trying again in 2 seconds...; smartmeter:meter:mt691

When i run

su - openhab -c 'cat /dev/ttyUSB0'

inside the openhab container i get the error cat: /dev/ttyUSB0: No such file or directory.
But how can i fix this?

The docker config should be fine with this:

      EXTRA_JAVA_OPTS: "-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

Outside the container the device is available as /dev/ttyUSB0 when i plug in the IR reader.

Any ideas?

Found the problem - in the docker-compose file the following was missing:

devices:
  - '/dev/ttyUSB0'

Now I get a connection from openhab to the USB port.

But I still don’t get any values - instead i am getting the following errors:

2020-03-18 10:59:08.131 [WARN ] [ding.smartmeter.internal.MeterDevice] - Timeout occured for smartmeter:meter:mt691; The source did not signal an event for 40000 milliseconds and has been terminated.
2020-03-18 10:59:08.222 [hingStatusInfoChangedEvent] - 'smartmeter:meter:mt691' changed from UNKNOWN (HANDLER_CONFIGURATION_PENDING): Waiting for messages from device to OFFLINE (COMMUNICATION_ERROR): The source did not signal an event for 40000 milliseconds and has been terminated.
2020-03-18 10:59:10.220 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:mt691

The binding seems to not get values from the usb device.
Have to check what could be the reason.

Found the solution. The IR reader had no connection. Changing the hardware made it work.
To get detailed information like current power etc. I had to activate extended info on the electricity meter first.