DSMR binding: Channel state update does not always trigger Item state update

Hello all,

I need some help with my DSMR setup.

My setup:
I have OH3.2 running with the DSMR binding installed.
OH system is connecting via socat to a raspberry pi which is on his turn is running ser2net and is connected to my smartmeter.
OH event logs are being sent to a seperate log server, where I user grafana to generate graphs.

My problem:
I receive the data every 1 minute but notice intermittent drops in my graph.
Now and then event seem to missing.

In OH, the DSMR bridge timeout is set to 60sec.
Socat conf:

OPTIONS="pty,link=/dev/ttyUSB1,raw,user=root,group=dialout,mode=777,ignoreeof,b115200 tcp:10.0.0.22:2000"

Ser2net conf:

connection: &p1meter
    accepter: tcp,2000
    enable: on
    options:
      kickolduser: true
    connector: serialdev,
              /dev/ttyUSB0,
              115200n81,local

I don’t know what else I could check / modify.

Any Idea how to solve this?

The DSMR binding updates the state only when it has received data. If you have both the update of ser2net and the binding set to 60 seconds it’s possible for some reason the received values are somewhat delayed and it receives 2 updates from ser2net in a single update cycle in the binding. The onding misses the update in the next cycle because it already handled the update in the previous cycle. What you could try is either sent updates by ser2net more frequently or set the refresh in the DSMR binding to a lower value, for example 30 seconds. If you still have 1 update via ser2net you should still see one update every minute by the DSMR binding.

To my knowledge ser2net has no timer settings. It’s only converting serial to network.
The binding was set originaly to 30 seconds. Also then these “drops” where ocurring.
So I modified to 60 seconds, without any difference.

I enabled DEBUG logging on the binding.

Normal entry:

14:21:58.972 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_delivery_tariff2 to value 193.038 kWh
14:21:58.975 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MainElectricityMeter_DeliveryTariff2' changed from 193.029 kWh to 193.038 kWh
14:21:58.976 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff1 to value 0 kWh
14:21:58.978 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff2 to value 0.022 kWh
14:21:58.979 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_tariff_indicator to value 0002
14:21:58.979 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_delivery to value 0.42 kW
14:21:58.981 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MainElectricityMeter_ActualPowerDelivery' changed from 0.419 kW to 0.42 kW
14:21:58.986 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_production to value 0 kW
14:21:58.987 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_instant_power_delivery_l1 to value 0.42 kW

Entry missing the Item update:

14:22:59.006 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_delivery_tariff2 to value 193.045 kWh
14:22:59.010 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MainElectricityMeter_DeliveryTariff2' changed from 193.038 kWh to 193.045 kWh
14:22:59.013 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff1 to value 0 kWh
14:22:59.014 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_production_tariff2 to value 0.022 kWh
14:22:59.014 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_tariff_indicator to value 0002
14:22:59.015 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_delivery to value 0.42 kW
14:22:59.019 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_actual_production to value 0 kW
14:22:59.020 [DEBUG] [smr.internal.handler.DSMRMeterHandler] - Updating state for channel emeter_instant_power_delivery_l1 to value 0.42 kW

So the binding is updating the “emeter_actual_delivery” channel state, but then the Item ‘MainElectricityMeter_ActualPowerDelivery’ change update is not happening/triggered consistently.

Please note that an “update” is not necessarily a “change”. If a channel receives an update of 0.42, and the linked Item already has a value of 0.42, the item will not register a change. This is normal OpenHab behavior.

You probably have a rule triggering “when Item x changed” to write to your log server. Change that to “when item X received update”.

1 Like

Indeed. I overlooked that one.
Thanks for your help.