SML Reader - how to integrate

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

Edit:
Never mind, after de-installing the IEC 62056 21 Meter Binding, the error isn’t shown anymore. It appears both bindings were fighting over dev/ttyUSB0 or something

so-this below won’t apply anymore:


When i said, it is “nearly” fine, i meant those entries in the log:
everytime a item changes (in my case every 20seconds), I get the following in openhab.log:

2017-09-23 10:21:00.935 [ERROR] [e.internal.WriterInterceptorExecutor] - MessageBodyWriter not found for media type=text/event-stream, type=class org.glassfish.jersey.media.sse.OutboundEvent, genericType=class org.glassfish.jersey.media.sse.OutboundEvent.
2017-09-23 10:21:21.848 [ERROR] [e.internal.WriterInterceptorExecutor] - MessageBodyWriter not found for media type=text/event-stream, type=class org.glassfish.jersey.media.sse.OutboundEvent, genericType=class org.glassfish.jersey.media.sse.OutboundEvent.

the eventlog does this:

2017-09-23 10:21:00.928 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis changed from 22717819.1 to 22717821.700000003
2017-09-23 10:21:00.947 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis2 changed from 462.5 to 467.6
2017-09-23 10:21:00.965 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis4 changed from 22717819.1 to 22717821.700000003
2017-09-23 10:21:21.849 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis changed from 22717821.700000003 to 22717824.5
2017-09-23 10:21:21.863 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis2 changed from 467.6 to 504.70000000000005
2017-09-23 10:21:21.887 [ItemStateChangedEvent     ] - Powermeter_10_NumberObis4 changed from 22717821.700000003 to 22717824.5

I think your Errors in the Log have nothing to do with SML Reader Binding. Its Jersey and that is jax-rs (REST), which is not used in this binding.

Can i install the sml_reader-binding only with mrketplace or can i do that manual too?

I get very strange values from the binding. It seems that they are factor 1000 too big. I have an EHM ehz too.

@binderth
Can i use it at same time with the c-programm (sml-reader) or do i have to remove all settings from this inside openhab first?

Do you get the right values or do you get factor 1000 bigger values too?

EDIT:
Have seen it, i can set a conversion inside the thing in paper ui for each value. I entered 1000 and now i get the right values.

EDIT2:
199.130.3 shows “EHM” —> Herstelleridentifikation
199.130.5 shows crypric signs like "@�X��$�Y��KP���E�*�Q�…"
0.0.9 shows cryptic signs like “���͆��…”

199.130.3 --> Herstelleridentifikation --> Manufacturer
199.130.5 --> Public Key
0.0.9 ---------> Geräteidentifikation --> device identification - maybe serial number?

as I see it, at present, the binding is only available within the IoT Market…

I didn’t test it, because I used my “DEV”-OH2 for the binding… :wink:
I’m fed up, f$%"king up my installation with all my errors I make in testing new stuff! :wink: only tested stuff now gets on my PROD-OH2! :wink:
So in my DEV-Installation I didn’t install the sml-reader at all. But I can imagine, that only either instance has access to /dev/ttyUSB0

Yes, the value I get is also *1000, and I used the 1000 factor in the thing configuration.

oh, public key makes sense! Thanks!

@msteigenberger, once again, thanks for porting the binding!

Could you please provide some docu on how to use the OH2-version without PaperUI? Reason is, I want to synchronize my efforts through different OH2-installations and by using config files life is a lot easier! :wink:
I’m a bit stuck at the moment even getting a Thing running! :wink:

Thanks.

1 Like

Have you seen this page:

There is an example on how to configure.

2 Likes

That’s great! now it’s working, thanks! Got something mixed up… Thanks!

edit:
how can I configure the “conversionRatio” for channel 1-0:16.7.0? My eHZ has an quotient of 1000 here.

i tried:

Number 	Sensoren_Status_Strom	"Stromzählerstand [%.1f kwh]"	{ channel="smlreader:meter:BinderPower:1-0#1-8-0,conversionRatio=1000" }

which results in an ERROR

2017-09-26 11:56:41.686 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'powermeter.items'
2017-09-26 11:56:41.704 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'channel' of item 'Sensoren_Status_Strom' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: UID must have at least 4 segments.
	at org.eclipse.smarthome.model.thing.internal.GenericItemChannelLinkProvider.createItemChannelLink(GenericItemChannelLinkProvider.java:77)[133:org.eclipse.smarthome.model.thing:0.9.0.b5]
	at org.eclipse.smarthome.model.thing.internal.GenericItemChannelLinkProvider.processBindingConfiguration(GenericItemChannelLinkProvider.java:67)[133:org.eclipse.smarthome.model.thing:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:325)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:297)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:182)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:367)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:286)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:136)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:234)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:297)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:206)[98:org.eclipse.smarthome.core:0.9.0.b5]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Please try it Like this:

Number Sensoren_Status_Strom “Stromzählerstand [%.1f kwh]” { channel=“smlreader:meter:BinderPower:1-0#1-8-0”,conversionRatio=“1000” }

hmm. reload the items without ERRORs this time, but still the same value as before…

2017-09-26 12:21:28.797 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from 22764690.1 to 22764691.900000002
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:21:34.120 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'powermeter.items'
2017-09-26 12:21:34.185 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'powermeter.items'
==> /var/log/openhab2/events.log <==
2017-09-26 12:21:49.867 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from 22764691.900000002 to 22764693.700000003

is conversionRatio the correct attribute?

Hmm… should be fine.
Have you tried restarting openhab or at least the Binding?

I tried reloading the binding:

2017-09-26 12:45:49.401 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from 22764893.6 to 22764896.400000002
2017-09-26 12:46:05.173 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-09-26 12:46:05.179 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from ONLINE to UNINITIALIZED
2017-09-26 12:46:05.300 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:46:05.306 [WARN ] [g.smlreader.handler.SmlReaderHandler] - OBIS 1-0:16.7.0 is not available in Meter device!
2017-09-26 12:46:05.308 [WARN ] [g.smlreader.handler.SmlReaderHandler] - OBIS 1-0:1.8.0 is not available in Meter device!
==> /var/log/openhab2/events.log <==
2017-09-26 12:46:05.312 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from INITIALIZING to ONLINE
2017-09-26 12:46:05.322 [ThingUpdatedEvent         ] - Thing 'smlreader:meter:BinderPower' has been updated.
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:46:08.280 [ERROR] [smlreader.connectors.SerialConnector] - Error at SerialConnector.getMeterValuesInternal: Termination sequence is wrong
2017-09-26 12:46:08.292 [ERROR] [binding.smlreader.internal.SmlDevice] - smlreader:meter:BinderPower: Error during receive values from device: Termination sequence is wrong
2017-09-26 12:46:08.321 [ERROR] [g.smlreader.handler.SmlReaderHandler] - Failed to read SML
java.io.IOException: Termination sequence is wrong
	at org.openmuc.jsml.tl.SMLMessageExtractor.waitForStopSequence(SMLMessageExtractor.java:142)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openmuc.jsml.tl.SMLMessageExtractor.getSmlMessage(SMLMessageExtractor.java:86)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.SerialConnector.getMeterValuesInternal(SerialConnector.java:67)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.ConnectorBase.getMeterValues(ConnectorBase.java:67)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.connectors.SerialConnector.getMeterValues(SerialConnector.java:1)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.internal.SmlDevice.readValues(SmlDevice.java:266)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler.updateOBISValue(SmlReaderHandler.java:128)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler.access$0(SmlReaderHandler.java:126)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at org.openhab.binding.smlreader.handler.SmlReaderHandler$1.run(SmlReaderHandler.java:100)[214:org.openhab.binding.smlreader:2.1.0.201706271509]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
==> /var/log/openhab2/events.log <==
2017-09-26 12:46:08.884 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Termination sequence is wrong
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:46:10.095 [INFO ] [binding.smlreader.internal.SmlDevice] - 
==> /var/log/openhab2/events.log <==
2017-09-26 12:46:10.106 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from OFFLINE (COMMUNICATION_ERROR): Termination sequence is wrong to ONLINE
2017-09-26 12:46:10.126 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from 22764896.400000002 to 22764899.200000003

then restarting openHAB2:

2017-09-26 12:47:31.841 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.xx.xx:8080
2017-09-26 12:47:31.850 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.xx.xx:8443
2017-09-26 12:47:40.077 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'powermeter.items'
2017-09-26 12:47:47.360 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'powermeter.rules'
2017-09-26 12:47:48.677 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'powermeter.sitemap'
==> /var/log/openhab2/events.log <==
2017-09-26 12:47:48.720 [ItemChannelLinkAddedEvent ] - Link 'Sensoren_Status_Strom-smlreader:meter:BinderPower:1-0#1-8-0' has been added.
2017-09-26 12:47:48.735 [ItemChannelLinkAddedEvent ] - Link 'Sensoren_Leist_Strom-smlreader:meter:BinderPower:1-0#16-7-0' has been added.
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:47:49.022 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'powermeter.things'
2017-09-26 12:47:50.624 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-09-26 12:47:50.628 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqttoh2'
2017-09-26 12:47:50.865 [INFO ] [b.core.service.AbstractActiveService] - HTTP Refresh Service has been started
2017-09-26 12:47:52.109 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-09-26 12:47:52.228 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-09-26 12:47:52.485 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-09-26 12:47:52.621 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
==> /var/log/openhab2/events.log <==
2017-09-26 12:47:55.164 [ThingAddedEvent           ] - Thing 'smlreader:meter:BinderPower' has been added.
2017-09-26 12:47:55.252 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from UNINITIALIZED to INITIALIZING
2017-09-26 12:47:55.362 [hingStatusInfoChangedEvent] - 'smlreader:meter:BinderPower' changed from INITIALIZING to ONLINE
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:47:56.335 [INFO ] [binding.smlreader.internal.SmlDevice] - 
==> /var/log/openhab2/events.log <==
2017-09-26 12:47:56.427 [ItemStateChangedEvent     ] - Sensoren_Leist_Strom changed from NULL to 485.40000000000003
2017-09-26 12:47:56.430 [GroupItemStateChangedEvent] - gEnergie changed from NULL to ON through Sensoren_Leist_Strom
2017-09-26 12:47:56.438 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from NULL to 22764913.400000002
2017-09-26 12:47:56.440 [ThingUpdatedEvent         ] - Thing 'smlreader:meter:BinderPower' has been updated.
==> /var/log/openhab2/openhab.log <==
2017-09-26 12:48:03.721 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
2017-09-26 12:48:03.780 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2017-09-26 12:48:06.741 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-09-26 12:48:07.434 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
==> /var/log/openhab2/events.log <==
2017-09-26 12:48:17.150 [ItemStateChangedEvent     ] - Sensoren_Leist_Strom changed from 485.40000000000003 to 479.90000000000003
2017-09-26 12:48:17.158 [ItemStateChangedEvent     ] - Sensoren_Status_Strom changed from 22764913.400000002 to 22764916.200000003

I’m not sure, why reloading the binding results in ERRORs and restarting the OH2-service there’s not ERRORs?

It can be that there is an Error in the first try. That should not be an issue as it will work in the second try then.
I’m not sure about the configuration for a channel in a .items file. I can’t find documentation about it.

You mean, if the binding tries the second time to configure the reader it will get through, then? ok, that would be consistent with my ERRORs.

I do have some version2 bindings and they configure each differently:

like weather-binding:

Number Weather_Temperature	"Outside Temperature [%.1f °C]"	<temperature> (gWeather, Weather, Weather_Chart)	{weather="locationId=home, type=temperature, property=current"}

or like Astro-binding:

Number 	Astro_SunElevation	"Elevation Sonne"	<sun>  (gAstro, Astro) { channel = "astro:sun:home:position#elevation" }

so I was under the impression, the author of the binding decides how to configure it in the first place? :wink: :joy:

The first example is for openhab 1. There should be a general way in how to configure Channels. But i didn’t find it. Maybe its not yet implemented for .items files. I can’t have a look in the sources right now as I’m on my mobile.