Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporter show no smartmeter_ metrics only the python default ones #4

Open
databus23 opened this issue May 5, 2022 · 2 comments
Open

Comments

@databus23
Copy link

databus23 commented May 5, 2022

I tried running this exporter to collect data from an EMH mMe 4.0.

I can confirm that the smart meter is sending out sml frames which I can see using the example sml_server from the libsml project:

> ./sml_server /dev/ttyUSB0
1-0:96.50.1*1#EMH#
1-0:96.1.0*255#XX XX XX XX XX #
1-0:1.8.0*255#616.4#Wh
1-0:16.7.0*255#-7#W
1-0:96.50.1*1#EMH#
1-0:96.1.0*255#XX XX XX XX XX #
1-0:1.8.0*255#616.4#Wh
1-0:16.7.0*255#-33#W
1-0:96.50.1*1#EMH#
1-0:96.1.0*255#XX XX XX XX XX #
1-0:1.8.0*255#616.4#Wh
1-0:16.7.0*255#-38#W
...

Unfortunately the exporter is not showing any smart meter metrics but a single exception when its starting up:

Task exception was never retrieved
future: <Task finished name='Task-3' coro=<SmlProtocol._reconnect() done, defined at /usr/local/lib/python3.9/site-packages/sml/asyncio.py:107> exception=AttributeError("'NoneType' object has no attribute 'call_soon'")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/sml/asyncio.py", line 109, in _reconnect
    await self._disconnect()
  File "/usr/local/lib/python3.9/site-packages/sml/asyncio.py", line 140, in _disconnect
    self._transport.abort()
  File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 192, in abort
    self._abort(None)
  File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 396, in _abort
    self._loop.call_soon(self._call_connection_lost, exc)
AttributeError: 'NoneType' object has no attribute 'call_soon'

I was building the python package myself because I had to remove the vendor and device_id thing because my smart meter is not sending those apparently.

I'm not a python export so I'm pretty clueless about what is going wrong here. Help would be appreciated.

UPDATE: Looking at the output from sml_server it seems like my smart meter is sending out vendor and device_id. But with the unmodified 0.1.4 version I get zero output, no exception but also no metrics. Looking at the code I figured it was still waiting for the vendor or device_id but maybe I was wrong there.

UPDATE 2: Looking at it again the obis number for vendor on device_id seem to be different for my smart meter. So I think I do have the problem with the upstream version that the exporter waits for those indefinitely.

@databus23 databus23 changed the title exporter has no smart meter metrics exporter show no smartmeter_ metrics only the python default ones May 5, 2022
@mweinelt
Copy link
Owner

mweinelt commented May 5, 2022

I have only ever tested this against one model of smart meters, also an EMH, so I think it's fair to say that I may have introduced assumptions, that don't work for your smart meter.

Does yours actually spew out a binary format that you're decoding using sml_server? Can you try an example of pysml, the SML library used in this project?

I think this one should help us: https://github.com/mtdcr/pysml/blob/master/examples/test_asyncio.py

@mweinelt
Copy link
Owner

mweinelt commented Apr 3, 2023

With #10 there is an example where you need to add the proper OBIS IDs to identify the device. Only when vendor/model have been detected will SML frames be accepted.

The PR also adds more log messages that should help debug this scenario, if you are still interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants