New DSMR-binding for OpenHAB 2

Hi everyone,
I have some problems related to the DSMR binding. I just did a fresh openhabian install (openHAB 2.3.0-1) and I can’t find the DSMR2 binding in PaperUI. I only find the binding-dsmr1 - 1.12.0, which is the old version and I can’t get it to work. I googled a bit and found org.openhab.binding.dsmr-2.4.0-SNAPSHOT.jar which is the DSMR 2 binding. Copying it in the addons folder I get:

2018-12-14 18:31:51.066 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.dsmr-2.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.dsmr [196]
Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
Unresolved requirement: Import-Package: org.eclipse.smarthome.io.transport.serial
at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]

and I understand that somehow the “new” bindings don’t work easily with openhab2.3. So, 2 questions:

  1. Which is the binding I should use for DSMR? In the docs it clearly states that the old one is not supported any longer and one should use https://www.openhab.org/addons/bindings/dsmr/
  2. Why is the new DSMR binding not ‘out of the box’ shown in PaperUI and how can I get it to work?

Thanks!

BTW: The meter seems to deliver correct data. E.g.
cu -l /dev/ttyUSB0 -s 115200 --parity=none -E q
outputs a lot of data

@Sven_Richter The binding is not shown ‘out of the box’ in PaperUI in 2.3.0 because it’s not part of 2.3.0. There is a beta version available in the Eclipse market place, but you need to enable the market place in PaperUI in configuration system and set to beta maturity level. However that is not going to help because the market place binding is dependent on to be reelased version of openHAB 2.4.0

The documentation you did see was probably the lastest version (you can select the version) and that explains the deprecation.

openHAB 2.4.0 is to be scheduled for release next week. So you can wait till next week or upgrade to snapsot or milestone release.I would not recommend trying to get the old binding to work.

@hilbrand Thanks a lot. I will wait for next week then. Excellent response

Just to report that I have upgraded to openhab 2.4.0 and the DSMR binding now works like a charm. Thanks @hilbrand

1 Like

I installed the binding in OH2.4Snapshot and it worked as soon as I configured the right serial port.
But after a reboot I got the error: ‘Serial Port already in use’.
In the binding manual there is a reference to: serial port configuration and there it is stated:

Note: openHABian comes with a menu option to configure the serial ports automatically. So all the rest here is only relevant for non-openHABian users.

I am using HABIAN on a Debian 9 install on a laptop. It is therefor Habian, but not from the image-file but through github. And as it turns out, I have a problem with reboots and the formentioned error message.

Should I follow the configuration manual, or do you think I have a different problem?
The manual goes on with:

  • When using more than one USB-Serial converters, it may happen that the /dev/ttyUSB0 device is named /dev/ttyUSB1 after a reboot. To prevent this problem, alias names can be assigned to serial devices by adding them to /etc/udev/rules.d/99-com.rules . Example:
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AE01F0PD", SYMLINK+="ttyMySensors"
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="ttyCulStick"

You need to find relevant pieces of information using e.g. udevadm command line utility:

udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0)

I tryed this last command, but I have no clue what to do with the output?

udev.txt (4.0 KB)

I got things working now. It turned out not to be a case of configuring the serial ports, it had more to do with the binding. I will post about it separately and refer to here.
new post

I am living in Austria and since a half of a year I have a ISKRA AM550-TD0.11 smartmeter.
Does somebody know if this binding is working with this ISKRA model?

DSMR is a dutch standard, maybe you can figure out of Austria has it’s own or uses another standard?
Googleing I found that the ISKRA AM550-TD0’s are used in the Netherlands aswel, but the last two numbers of the serial are different.
Does the device has an RJ11 port? This is used in the DSMR binding where you can use an USB to serial 5V-TTL cable and add an RJ11 connector to the serial and then you will receive “telegrams” of data every 10 seconds, that are parsed by this binding.

Yes it has this port in the right upper corner.

Here is a pdf, it’s in german. It’s a simple end user manual. At least you see a picture of the device.

Regarding the standard I have to google.

I also started using the binding on my OH 2.4 installation after the installation of smart meters. Setting up is a breeze (after u know what to do :sunglasses:).
I am interested in reading out the “emeter_actual_delivery” variable very frequently because I want to trace where I can save on electricity, I tried to set the refresh rate to 10 seconds. Updates however keep coming in once every 60 seconds …

Things file:

     Things:
        device_v5 dsmrV5Device [channel=-1]
        m3_v5_0 mygasmeter [channel=1]
        electricity_v5_0 electricityV5 [refresh=10, channel=0]
}

kr Han

A verification question. If you set the refresh to more than 60 seconds, like 120. Does it still update every minute?
You can enable the logging in karaf console which will show the updates given by the meter. (log:set DEBUG org.openhab.binding.dsmr) that should give some insight in if the meter does give those values within your desired time frame or if something might not working in the binding.

@hilbrand

Bridge dsmr:dsmrBridge:myDSMRDevice [serialPort="/dev/ttyUSB0"] {
     Things:
        device_v5 dsmrV5Device [channel=-1]
        m3_v5_0 mygasmeter [channel=1]
        electricity_v5_0 electricityV5 [refresh=120, channel=0]
}
root@homeautomation:/openhab/userdata/logs# tail -f events.log | grep Meter
2019-01-19 10:01:38.972 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 128.680 to 128.687
2019-01-19 10:01:38.977 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.396 to 0.405
2019-01-19 10:01:38.979 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.4 to 237.8
2019-01-19 10:02:38.975 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 128.687 to 128.695
2019-01-19 10:02:38.982 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.405 to 0.400
2019-01-19 10:02:38.986 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.8 to 237.5
2019-01-19 10:03:38.989 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 128.695 to 128.702
2019-01-19 10:03:39.000 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.400 to 0.407
2019-01-19 10:03:39.003 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.5 to 237.3
2019-01-19 10:04:39.015 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 128.702 to 128.709
2019-01-19 10:04:39.018 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.407 to 0.405
2019-01-19 10:04:39.020 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.3 to 237.1

so I guess the refresh parameter does not change the refresh rate, it still comes in every 60 secs. If I look directly at the serial port there are numerous reports every 30 seconds…

kr

Han

Hmm. Some more checks. What if you remove the thing? And what if you set the refresh value to 0?

Thanks, with doing this I saw an error in my item declaration so it was not using the thing but I think the channel directly…
Changed the items and now its reporting every 10 secs.

2019-01-19 13:17:04.425 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 130.660 to 130.662
2019-01-19 13:17:04.428 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.731 to 0.493
2019-01-19 13:17:14.427 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 130.662 to 130.664
2019-01-19 13:17:14.432 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.493 to 0.741
2019-01-19 13:17:14.435 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.9 to 237.6
2019-01-19 13:17:24.432 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 130.664 to 130.666
2019-01-19 13:17:24.439 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.741 to 0.735
2019-01-19 13:17:34.441 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 130.666 to 130.668
2019-01-19 13:17:34.443 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.735 to 0.730
2019-01-19 13:17:34.444 [vent.ItemStateChangedEvent] - MeterVoltageNow changed from 237.6 to 237.4
2019-01-19 13:17:44.441 [vent.ItemStateChangedEvent] - MeterDeliveryTariff0 changed from 130.668 to 130.669
2019-01-19 13:17:44.451 [vent.ItemStateChangedEvent] - MeterDeliveryNow changed from 0.730 to 0.484
Bridge dsmr:dsmrBridge:myDSMRDevice [serialPort="/dev/ttyUSB0"] {
     Things:
        device_v5 dsmrV5Device [channel=-1]
        m3_v5_0 mygasmeter [channel=1]
        electricity_v5_0 electricityV5 [refresh=10, channel=0]
}
`

Number MeterDeliveryTariff0 "Laag tarief [%.3f kWh]" {channel="dsmr:electricity_v5_0:myDSMRDevice:electricityV5:emeter_delivery_tariff1"}
Number MeterDeliveryTariff1 "Hoog Tarief [%.3f kWh]" {channel="dsmr:electricity_v5_0:myDSMRDevice:electricityV5:emeter_delivery_tariff2"}
Number MeterDeliveryNow "Momentaan gebruik [%.3f kWh]" {channel="dsmr:electricity_v5_0:myDSMRDevice:electricityV5:emeter_actual_delivery"}
Number MeterVoltageNow "Huidige spanning [%.1f V]"	{channel="dsmr:electricity_v5_0:myDSMRDevice:electricityV5:emeter_instant_voltage_l1"}``

Hello Guys,

wondering if somebody can help me configure the serial port to the DSMR binding. I tried everything (I think) but still I get the “connector don’t exist” message. Can some maybe guide me through this?

My meter is a SMR5.0

Things file:

Bridge dsmr:dsmrBridge:mysmartmeter [serialPort="/dev/ttyUSB0"] {
    Things:
        device_v5 dsmrV5Device [channel=-1]
        electricity_v5_0 electricityV5 [channel=0]
}

Many thanks,

Piet

Hi Piet,

Have you set the EXTRA_JAVA_OPTS, as described here? I’d also advice to use symlinks to give your USB device a meaningful and constant name, as described here.

Good luck!
Bart

Also did you look into these suggestions in the documentation:
https://www.openhab.org/docs/administration/serial.html

Thanks for the fast reply guys appreciate it,

I added the following code the the openhab2 file (/etc/default/openhab2)

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

I already tried before to add symlinks but I think something went wrong because I don’t see the name apearing which I added.

This is the line I added in the 99-rules file:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A13M4HEW", SYMLINK+="ttyFT232-P1"

I could not find ttyF232-P1 anywhere. Tried both F232-P1 and USB0. Currently my dutch meters are giving offline - configuration error and “unknown”.

Got a piece of my log here:

18:16:42.415 [DEBUG] [mr.internal.handler.DSMRBridgeHandler] - No data received for 270 seconds, restarting port if possible.
18:16:42.420 [DEBUG] [.device.connector.DSMRSerialConnector] - Closing DSMR serial port
18:16:42.423 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.
18:16:42.425 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.
18:16:42.429 [DEBUG] [.device.connector.DSMRSerialConnector] - Port /dev/ttyF232-P1 does not exists
18:16:42.496 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Error during discovery of port settings: @text/error.connector.dont_exists, current state:DISCOVER_SETTINGS.
18:16:42.498 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.
18:16:42.620 [DEBUG] [mr.internal.handler.DSMRBridgeHandler] - No data received for 270 seconds, restarting port if possible.
18:16:42.622 [DEBUG] [.device.connector.DSMRSerialConnector] - Closing DSMR serial port
18:16:42.623 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.
18:16:42.625 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.
18:16:42.627 [DEBUG] [.device.connector.DSMRSerialConnector] - Port /dev/ttyUSB0 does not exists
18:16:42.628 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Error during discovery of port settings: @text/error.connector.dont_exists, current state:DISCOVER_SETTINGS.
18:16:42.629 [DEBUG] [.internal.device.DSMRSerialAutoDevice] - Stop discovery of port settings.

Gr Piet

:grinning: It’s working now! Now I don’t know exactly what steps are required (next time, after a clean install) but I do know that the last missing link was adding openhab user to dailout.

adduser openhab dialout

The log eventually showed something like:

Failed to read: No provider for port /dev/ttyUSB0 found.

Which eventually led me to Add openhab user to dialout group #18. And after some reverse searching I found it mentioned on this thread also. Problem was that I only added openhab to tty an NOT dailout.

Any way thanks for the help guys.

I have a problem with the DSMR items. I think the binding itself puts a unit behind the value of an item. For example the Kwh.
Now I want to export the values ​​to node-red, but it cannot handle these values.
I have already tried to convert the value with a proxy item but I have not yet succeeded. Does anyone have a solution for this so that I only get the value without unity?