SML Reader - how to integrate

I’m not sure, it “openHAB2” is the right place for it, but anyways.
I have a SML Reader, which reads my EHZ IW8E power meter.

The SML Reader is the IR-USB Reader from volkszaehler (Udo). I’m not able to get it running with the volkszaehler raspberry pi Image (I just don’t get it, how it works…).

but the Reader works with this https://github.com/dailab/libsml (with a bit of tweaking) and I can read the actual meter reading and the present power consumption:

pi@raspberrypi:/usr/src/libsml/examples $ ./sml_server /dev/ttyUSB0
1-0:1.8.0*255#18843.593#
1-0:1.8.1*255#18843.593#
1-0:16.7.0*255#1.110#

I could write a script and let it post the readings to openHAB2, but if there’s a better way, I would love to use it directly. I understand, the SMLReaderBinding is dead?


So is tehre another way to integrate an SML Reader?

Thanks!

I´m looking exactly for the same. I also will buy a usb-ir-reader from udo and integrate my 2 ehz power meter from EHM.

I have it running with volkszaehler (for logging into the DB) and enabled the push port in the vzlogger.conf. This gives me the possibility to push all values directly to openhab (only for display in the UI) using MQTT. This works very well.
Regards,
Michel

Can I get nearly real time reading of my power meter? It sends new data every 2 seconds. Can I read out the power meter in so short intervals?

Volkszähler is a little bit oversized to only send the data to openhab. Can I use vzlogger only without additional msql and Volkszähler software?

Hi Michel,
do you use an extra server for the volkszaehler-part? I didn’t get the pi-image to work, I fail at the part to fill out the exact configuration for vzlogger. Is there a HowTo just for EHZ? Didn’t find one on the volkszaehler-wiki, which focuses on getting the thing up (which I have), but there’s no description on how to integrate an Udo’s IR-Reader (or I didn’t find it).

Thanks,
Thomas.

Hi Thomas,
it took me also some time before I got the USB reader working with vzlogger…
I’m having vzlogger and openhab running on the same server with Ubuntu 14.04 LTS. Once you have the reader working in generell it’s straight forward.

{
  "retry": 30,
  "daemon": true,
  "verbosity": 0,
  "log": "/var/log/vzlogger.log",
  "push": [
    {
      "url": "http://127.0.0.1:5582"
    }
  ],
  "local": {
    "enabled": false,
    "port": 8080,
    "index": true,
    "timeout": 0,
    "buffer": 0
  },
  "meters": [
    {
      "enabled": true,
      "allowskip": false,
      "interval": 5,
      "protocol": "sml",
      "aggtime": 10,
      "aggfixedinterval": true,
      "device": "/dev/stromzaehler",
      "channels": [
        {
          "uuid": "93fef990-b58c-11e5-bf5f-dbf391d77a07",
          "identifier": "1-0:1.8.0",
          "api": "volkszaehler",
          "middleware": "http://vz.ubuntu-server.home:88/middleware.php",
          "type": "device",
          "aggmode": "MAX",
          "duplicates": 0,
        },
        {
        "uuid": "ddc84b20-b586-11e5-862b-f99b1b044b59",
        "identifier": "1-0:16.7.0",
        "api": "volkszaehler",
        "middleware": "http://vz.ubuntu-server.home:88/middleware.php",
        "type": "device",
        "aggmode": "AVG",
        "duplicates": 0,
        }
      ]
    }
  ]
}

Regards,
Michel

1 Like

that’s the point, when I just went off. As the Reader is the only USB-device, it’ll appear as /dev/ttyUSB0, I could get the Serial via /sbin/udevadm info --query=all --name=/dev/ttyUSB0, but the rule SUBSYSTEM=="tty", ATTRS{product}=="CP2104 USB to UART Bridge Controller", ATTRS{serial}=="ABC1234", NAME="lesekopf0" doesn’t add the /dev/lesekopf0. So I guess, the config you’re pasted here for vzlogger.conf doesn’t find the /dev/lesekopf0 (in your case obiously /dev/stromzaehler).
So, I’m using the RPi-Image from volkszaehler.org - Raspbian jessie lite I believe. I can however use the USB-Reader with the above posted script from DAI-Labor in Berlin:
GitHub - dailab/libsml: Implementation in C of the Smart Message Language (SML) protocol

Unfortunately, volkszaehler.org isn’t as good organized as openHAB… :grin:

Hi Thomas,

if you’re not using multiple USB devices you can go ahead using /dev/ttyUSB0 in vzlogger.conf. It’s just useful when you have multiple usb devices and you actually don’t know which is on startup assigned to /dev/ttyUSB0 and /dev/ttyUSB1 and so on. Therefore creating this link is helpful. I’m also reading data from my Viessmann Vitocall heating and therefore need the link.

So, skip this step and see if you get stty / minicom running.

Regards,
Michel

ok, for testing purposes, this should work - but on my OH2 productive RPi I have already four USB devices running! :wink:
I’d like to test it and changed your vzlogger.conf a bit - but I don’t know, how to start vzlogger.conf… Isn’t there a step-by-step howto for eHZs out there anywhere? (except volkszaehler.org, obviously! :disappointed_relieved:) But then: I could write a short script using the DAI-Labs SML-implementation and then post the result to OH2 via the API.

Hi Thomas,

if you didn’t created a start-script you can start the vzlogger using: /usr/local/bin/vzlogger -c /etc/vzlogger.conf . I installed the vzlogger following the installation guide on the volkszaehler wiki page: Installation Guide vzlogger.

Best,
Michel

For me the better way would be a small script to send the data to openhab.

I don´t want to install the whole volkszähler-software, only to send one small value of the power meter to openhab…

Volkszähler would be usefull if i would log many meters and use the volkszähler frontend to make charts and so on. But this is all doing openhab already for me.

Now i can read both of my usb readers with the script of Thomas, but it is not possible to get the data to openhab - at this time. There i need to get the output of the script (linux console) and send it to openhab.

The naming of my two usb-readers to /dev/lesekop0 and /dev/lesekopf1 worked. First i had problems to get all working (especially the libsml) in ubuntu, but whith debian it worked very good so far.

I’ve created a PR for openhab 2 binding to read a SML Meter: https://github.com/openhab/openhab2-addons/pull/2167

If someone is interrested, please Install it from the Market (install market Extensions and Filter addons for “market”, since 2.1.0 Snapshot).
Any Feedback is appreciated!

Thanks
Matthias

1 Like

Hi Matthias,

I’ve installed your binding
But how should I configure it :confused:

I own an ISKRA MT681

Robert

Are you configuring through PaperUI?
Then you have to create a Thing and set the serial Port on which it is
connected to your machine.
If you don’t see the binding installed at all in PaperUI, you probably are
missing dependencies as this are not getting installed with Marketplace
bindings. Please Install the serial binding and try again in that case.

Thanks 
Is the serial binding the only missing dependency or are there more?
Because I don’t see the binding in PaperUI.

Should be the only one. Can you look into the logs?

ok, after installation of the serial binding I can see your binding :grinning:
But I don’t see things or channels :open_mouth:
How should I configure the SML Reader?

portboy

In PaperUI you can add a new Thing. You have to set the serial Port in the configuration of the Thing. If everything is working you will see all available Channels in that Thing with its SML code.

Ok, there is an issue in my config. I can configure a new Thing. But I get no channels.
I run openhab in a docker container. maybe this is a problem …
on the other side, the thing is online …
but my log shows errors …

2017-09-15 10:49:10.368 [ERROR] [smlreader.connectors.SerialConnector] - Error at SerialConnector.getMeterValuesInternal: Timeout
2017-09-15 10:49:10.385 [ERROR] [binding.smlreader.internal.SmlDevice] - smlreader:meter:2d889a5b: Error during receive values from device: Timeout
2017-09-15 10:49:10.386 [ERROR] [g.smlreader.handler.SmlReaderHandler] - Failed to read SML
java.io.IOException: Timeout
	at org.openmuc.jsml.tl.SMLMessageExtractor.fillBufferWithTimeout(SMLMessageExtractor.java:197)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openmuc.jsml.tl.SMLMessageExtractor.waitForStartSequence(SMLMessageExtractor.java:93)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openmuc.jsml.tl.SMLMessageExtractor.getSmlMessage(SMLMessageExtractor.java:85)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.SerialConnector.getMeterValuesInternal(SerialConnector.java:67)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.ConnectorBase.getMeterValues(ConnectorBase.java:67)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.SerialConnector.getMeterValues(SerialConnector.java:1)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.internal.SmlDevice.readValues(SmlDevice.java:266)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler.updateOBISValue(SmlReaderHandler.java:128)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler.access$0(SmlReaderHandler.java:126)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler$1.run(SmlReaderHandler.java:100)[208:org.openhab.binding.smlreader:2.1.0.201706271509]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_144]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_144]
	at java.lang.Thread.run(Thread.java:748)[:1.8.0_144]

ok, the errors are gone.
Bu I don’t see a channel under things …


confusing … :confused: