SML Reader - how to integrate

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:
https://github.com/dailab/libsml

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:

Can you turn on debug logging? Also you should see the messages on the very first try (after the SML binding ist startest). Maybe we can see something meaningful there…

ok, step by step :stuck_out_tongue_winking_eye:
I found the reason for “no channels”.
My usb device connected not every time to the same usb port (ttyUSB1, ttyUSB2, etc.)
So I set up an udev rule for my “reading head”.
Now I see the channels under things :muscle::grinning:


The values I get, these are in hex format?

The numbers you get are the channels of the power-meter.

129-129:199.130.
Public Key of the power meter

1-0:1.8.2
This is the counter of your power meter. You have a 2-way-counter, so you get 1.8.1 and 1.8.2. 1-way-counter only have 1.8.0

Here some information i got from another forum:

[Iskra]
    [[stand]]
        iskra_code = 1-0:1.8.0*255
    [[leistung]]
        iskra_code = 1-0:15.7.0*255
    [[leistung_L1]]
        iskra_code = 1-0:21.7.0*255
    [[leistung_L2]]
        iskra_code = 1-0:41.7.0*255
    [[leistung_L3]]
        iskra_code = 1-0:61.7.0*255

@msteigenberger and @halloween -> THX for ur support :+1::+1::+1:
works now perfect

Anybody tested this with an EHM ehz power meter?

hi there!

at first, thanks @msteigenberger for the nice binding-port!
For me, it worked. I’m using a EMH eHZ-IW8E2A and with that, (nearly) all is fine (I’m still opposed to configuring Things in PaperUI and have to figure out, why my configuring with files didn’t work… :wink: )

What did I do:

  1. installed the “Eclipse IoT Market” (PaperUI > AddOns > “MISC-Section”)
  2. dropped “SmlReader Binding” from the "Eclipse Marketplace"
    2.1 just click on search: https://marketplace.eclipse.org/search/site/smlreader?
    2.2 drag/drop the “install” Icon to the open PaperUI
  3. I got now a new “Thing”, which I called Powermeter
  4. There are seven channels with my eHZ
  5. configured a Item for all the channels

so, as I don’t understand the OBIS nomenclature, I just figured, these channels to be the ones for my purpose (as I don’t feed any power back, I am only consuming the power from the network):

  • smlreader:meter:METERNAME:1-0#1-8-0: this seems to be the overall consumption (*1000)
  • smlreader:meter:METERNAME:1-0#1-8-1: this one is slighty different (but could be due to parallel processing?)
  • smlreader:meter:METERNAME:1-0#16-7-0: this seems to be the actual consumption

the other channels seem to be:

  • smlreader:meter:METERNAME:129-129#199-130-3: manufacturer (in my case EMH)
  • smlreader:meter:METERNAME:129-129#199-130-5: is somewhat cryptical
  • smlreader:meter:METERNAME:1-0#1-8-2: is 0 all the time
  • smlreader:meter:METERNAME:1-0#0-0-9: seems also to be the manufacturer (EMH)

Is there a list of channels and what they really mean somewhere?

1 Like