Is Smartmeter Reading over serial interface recommended?


I’m thinking of using Openhab to read a smartmeter over the serial interface (SML). Reading the forum there are several users reporting issues, with not stable serial connections (SML/Modbus/Z-Wave).

I have found this bug report from 2020, which I think describes the issue.

But users seem to still have issues in OH4:

The only solution seems to be using the alternative PureJavaComm. But why isn’t this implemented by default in OH4?

As due to the issues users are switchting to Volkszaehler/Tasmota and then read the energy readings over MQTT into Openhab, maybe this is the better way. What do you think?
In addition this might also reduce the load for Openhab reading the values all 1-3s and avoid additional wear out of the SD card?

if I had known the problems I would struggle with reading two serial ports parallel in java, I wouldn’t have bought these two usb serial port readers (without “tasmota mqtt extension”).
But I was stupid and the few euros more would have been paid for a long time.

Since the fix was merged i don’t have problems anymore.

I am not sure if such fast readings are possible with optical reading at all…
Why do you need such fast data?

I think it is worth trying to read data with openhab directly.

I don’t think that a sd wear out is a problem.
But you should always be prepared, it can happen anytime.

I don’t know if it is really fixed, as users are still having issues:

My smartmeter is pushing every 1-2s over the optical interface. I’m not able to change the push time. The question is how to get the data into Openhab. I’m still not sure if an USB-to-serial adapter is a good idea. But what are the alternatives.

There are TTL/RS485-to-Ethernet adapters, but as far as I know the smartmeter binding is not supporting ethernet. Does anybody have more details here, if it might work?

There was an issue where the port was blocked after some time and no communication was possible anymore. Only a restart of the whole OpenHAB instance could solve this problem.
Its is fixed.
Depending on the setup of the users (hardware which is used) they might have better luck to read data with the alternative serial provider.

You are right. I was looking for the “refresh” parameter but this might not have any effect when you do SML reading.

I don’t know. But there is something to make your USB-to-serial adapter available via ethernet. But is might alos not help you with your specific use case.

If you ask me: It might be the best to install a second meter with modbus TCP or an other IP based protocoll, before trying without guarantee of success.

Or get an ESP/Tasmota based WiFi reader for the optical interface.
It is just around 30€ at ebay…

But if you need the data every couple seconds e.g. for load management Wifi and MQTT is not a good idea. There are also RS485 IR readers. With a regular RS485-Ethernet Gateway which you could also use for Modbus you could get the data over Ethernet. Iobroker is supporting this but not Openhab.

Don‘t see an issue here. As already said in the other topic, I get updates about every 3 seconds. All you need is a stable WiFi connection. My router is just 2m away from my smartmeter, so no issue, but if you have a bigger distance and prefer ethernet, add a repeater in WiFi2Ethernet bridge mode.

Can you please provide a link to see how this should work?
Maybe there is a way to implement this in the smart meter binding.

Meanwhile ser2net for providing a rfc2217 port might be a good solution for you.

There is a guide in this thread which is describing it, but it is in german:

They are using a Hager EHZ001K with RS485 and are connecting it to a RS485-Ethernet Gateway like USR-TCP232-306 or 410S. In the smartmeter binding you need to put in a TCP server and port. I guess it is similar what is already available in the Openhab Modbus binding.

+1 from me.
I have multiple D1Mini sensors and many of them have an intervall of down to 1 second. Works just fine, even though my D1Minis are nowhere near an accesspoint, some only have an signal strenght of -80dBm or less.

1 Like

With Tasmota and MQTT?

Just checked again, Tasmota SML protocol can be set to immediately push sensor updates over MQTT

1,77070100100700ff@1,Current consumption,W,Power_curr,16  

The param „16“ at the end or the line sets it to immediate updates.

Ok, Tasmota is a definitely a way to go!

But at the moment I still would prefer a complete solution with Openhab.
I took a look at the smartmeter binding, but I’m missing following feature.

  • Is there something like a REFRESH (similar to Modbus binding) or even an PUSH_ENABLE (to get all pushed values from the meter) to temporary gain more data.
  • Having the 1.8.0 Active Energy in [kWh], could the Smartmeter Binding calculate the Power in [W] out of it. You need exact timestamps for this, so it is not the best way to do it external.

@Tuny What do you think?
Should I create some issues for the smartmeter binding?

I think you’re mixing up things here. Datapoint 1.8.0 is „just a counter“ which sums up your usage. Updates can arrive at different intervals according to your power usage. Therefore the binding cannot and should not recalculate the values, as it does not know the timebase for this.
If you want to see your actual (momentary) power usage, SML protocol has a different datapoint to show this. Your smartmeter just has to deliver it.

Edit: My smartmeter reports at datapoint 1.8.0 kWh. So wat does this say in power usage (W). Nothing, it is just saying that I have used that amount of energy since Installation in February last year. Whereas the other datapoint show that i am actually using approximately 740W.

No, e.g. Volkszaehler is doing this. You don’t need a separate datapoint. Reason is that you get the counter value with a very high resolution like 0,xxx kWh. So you only need exact timestamps. I was also surprised, but it is working perfect in Volkszaehler.

Still, this is nothing the Binding should do.
By design, a binding should not store values internally, nor access persisted data. Those calculations have to be done by using rules or transformations.

According to the datasheet of your meter, it already delivers actual power usage at SML datapoint 16.7.0.
What else do you need ?

The Hager EHZ001K is only an optical reader. What SML datapoints are available depend on the energy meter and which are activated by the power company. A lot of energy meter only provide 1.8.0 and maybe 2.8.0.

Ok, so what smartmeter do you use ?
Most of them can be switched from short to long protocol, which then includes datapoint 16.7.0