New DSMR-binding for OpenHAB 2

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?

Without specific details I have no idea on how to fix this. But It’s not the problem of the binding. It’s probably because the items are UoM types. Those have unit information. Search for UoM related questions here on the forum. That might give you some information. Or else open a new topic with specific details on what you have configured and how you send the information to node-red.

Hi all,

I installed the latest SMDR binding after first trying the 2.4 version, but that does not resolve my problem:

I have a new “/Ene5\XS210 ESMR 5.0” meter, with some sunpanels delivering power back.
I installed the “Slimme Meter Bridge”, after that is detects two smart meters:
“Algemene DSMR Meter” (DSMR V5), with 2 channels: P1 Versie, and Tijd.
“Elektriciteitsmeter” (DSMR V5.0), with 3 channels: Elektriciteitsverbruik Daltarief, Elektriciteitsverbruik Piektarief and Huidige Elektriciteitsverbruik.

What is should expect somewhere is also something like “Elektriciteitgeleverd Dal/Piektarief”. But these values are not detected. However can see them passing by in de datagrams, and also in the debug logs:

21:05:09.178 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel p1_version_output to value 50
21:05:09.181 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel p1_timestamp to value 2019-12-02T21:04:42.000+0100
21:05:09.181 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel p1_text_string to value
21:05:42.012 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_equipment_identifier to value E0047000055950719
21:05:42.013 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_delivery_tariff1 to value 581.622 kWh
21:05:42.015 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_delivery_tariff2 to value 497.707 kWh
21:05:42.015 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff1 to value 113.142 kWh
21:05:42.016 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff2 to value 279.564 kWh
21:05:42.017 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_tariff_indicator to value 0002
21:05:42.017 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_delivery to value 0.286 kW
21:05:42.018 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_production to value 0.000 kW
21:05:42.028 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_power_failures to value 2
21:05:42.029 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_long_power_failures to value 1
21:05:42.031 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_power_failure_log_entries to value 0

What can i do the get these values into openhab?

(I stole this image from @wborn :wink: and it’s for an other binding, but the message is the same)

Really? Aaarghh. I was stumbling too long for this… Thank you!