DSMR/Slimme meter problem

2 days ago i started with home assistant and compared with Domoticz i think i will go on with it.
My situation is like:

  • Synology DSM 916+ with Docker installed and within Docker Home Assistant

My problem is:

  • Within domoticz i have my gas en electra consumption. I arranged this with a usb to smart meter cable and in Domoticz i see my gas en electric on /dev/ttyUSB0
  • Now i want this also in HA. The code is implemented as follows:

Smart meter

  • platform: dsmr
    host:
    port: /dev/ttyUSB0
    dsmr_version: 4

  • After restarting HA i get the following error in home-assistant.log
    17-04-20 08:11:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
    Traceback (most recent call last):
    File “uvloop/future.pyx”, line 374, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112704)
    File “/usr/src/app/homeassistant/components/sensor/dsmr.py”, line 139, in connect_and_reconnect
    reader_factory())
    File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
    File “uvloop/future.pyx”, line 434, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:114018)
    File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
    File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
    File “uvloop/future.pyx”, line 372, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112669)
    File “uvloop/loop.pyx”, line 1510, in create_connection (uvloop/loop.c:29709)
    File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
    File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
    socket.gaierror: [Errno -8] Servname not supported for ai_socktype

Is there anyone who can help me with this?

Thanks in advance

The issue seems to be caused by the empty host: parameter.
In your case (where the USB device is locally available to your HA install) this is not needed and should be removed. Afterwards it should work fine.

i filled my host with my ip number of my synology.
But it isn’t copied in the text above.

So my P1 meter is connected to my synology with usb to serial. It is working with domoticz and my port is /dev/ttyUSB0 (according to domoticz) but no luck in HA at this moment

i removed the host (domoticz i manually stopped to avoid interference) i now i receive next output

17-04-20 09:33:22 ERROR (MainThread) [homeassistant.components.sensor.dsmr] error connecting to DSMR
Traceback (most recent call last):
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/sensor/dsmr.py”, line 139, in connect_and_reconnect
reader_factory())
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 434, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:114018)
File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “uvloop/future.pyx”, line 372, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112669)
File “/usr/local/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.5/site-packages/serial_asyncio/init.py”, line 410, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File “/usr/local/lib/python3.5/site-packages/serial/init.py”, line 88, in serial_for_url
instance.open()
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’
17-04-20 09:33:52 ERROR (MainThread) [homeassistant.components.sensor.dsmr] error connecting to DSMR
Traceback (most recent call last):
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/sensor/dsmr.py”, line 139, in connect_and_reconnect
reader_factory())
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 434, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:114018)
File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “uvloop/future.pyx”, line 372, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112669)
File “/usr/local/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.5/site-packages/serial_asyncio/init.py”, line 410, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File “/usr/local/lib/python3.5/site-packages/serial/init.py”, line 88, in serial_for_url
instance.open()
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

I think i see a little change now. My log is filling up (openend in notepad ++ and i have to reload it because it has new information.

And it is a copy of what i wrote above

Are you sure the meter is connected to the port you set it to in te config? Log says it doesn’t exist.

Thats the strange part. Within domoticz i see that my smart meter is connected to /dev/ttyUSB0.

So i assume this is Allright. But i had to install the package usb2serial driver package from jandahl and then it was working.

But now it is Ha within docker with is landing as package om Synology like domoticz

Is there somebody with an idea?

Do you have domoticz and home assistant on at the same time? Because they can’t access that port at the same time. You should stop domoticz before starting home assistant

I had it in first place. But i tested it also with domoticz stopped. I will do it again and will post the results here

17-04-24 08:18:57 ERROR (MainThread) [custom_components.sensor.dsmr] error connecting to DSMR
Traceback (most recent call last):
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/config/custom_components/sensor/dsmr.py”, line 139, in connect_and_reconnect
reader_factory())
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 434, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:114018)
File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “uvloop/future.pyx”, line 372, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112669)
File “/usr/local/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.5/site-packages/serial_asyncio/init.py”, line 410, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File “/usr/local/lib/python3.5/site-packages/serial/init.py”, line 88, in serial_for_url
instance.open()
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’
17-04-24 08:19:27 ERROR (MainThread) [custom_components.sensor.dsmr] error connecting to DSMR
Traceback (most recent call last):
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/config/custom_components/sensor/dsmr.py”, line 139, in connect_and_reconnect
reader_factory())
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 434, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:114018)
File “uvloop/future.pyx”, line 146, in uvloop.loop.BaseFuture.result (uvloop/loop.c:109361)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “uvloop/future.pyx”, line 372, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112669)
File “/usr/local/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.5/site-packages/serial_asyncio/init.py”, line 410, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File “/usr/local/lib/python3.5/site-packages/serial/init.py”, line 88, in serial_for_url
instance.open()
File “/usr/local/lib/python3.5/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

Extra information
On my synology i have python 2.7 installed. the log files is searching for python 3.5. I can’t find this package with winscp. I installed synology package python 3 whick is version 3.5 but i cant find it on my nas with ssh.

I have the following packages installed for making it work on domoticz when i start using it:
USBSerialDrivers DSM 6.0 by Jumbotroll
usbutils by Jumbotroll
Domoticz
give full control to /dev/ttyUSB0 with chmod 777
Python 3 (today)

And still it cant find my usb0. Domoticz does!

1 Like

Is there anyone with a solution? Or can help me

I use a raspberry pi with the USB cable connected to the SmartMeter. I use Ser2Net on the raspberry and point HA to that port. It just works. Not a solution but might be a good work around.

I have it working. Problem was docker. I installed Home Assistant directory on my Synology and the DSMR is working. Now i have to figure out what power production is.

thnx for your reply

Hi everyone,

I have installed a DSMR and am running version 5.

My problem is that the data is coming in so fast (at least once a second) that my history fills up terribly fast. Is there a way to refresh just once every 30 seconds or something?

Hope someone can help me :slight_smile:

Hi all,

I think I am overseeing something to connect my smart meter to hassbian. I installed Hassbian with raspberry pi 3. Seems all to work fine. Now I wanted to read out my meter using following steps:

Note that I am quite a beginner:

Done so far:

  • I have a ISKRA meter ME382
    - question: Do i need to use DSMR 2.2?
  • checked for latest version of hassbian
  • updated configuration file (through network drive and saved as follows:)

added_config

  • saved the file and configured home assistant again (settings --> general --> restart server)
  • reboot raspberry pi (sudo reboot)
  • Question: not sure if I miss something here?
    i.e.: need to do a pip-install or anything else?
  • continue with giving dial-out persmissions by:
$ sudo usermod -a -G dialout homeassistant
  • do reboot:
$ sudo reboot

Current state:

  • Sensors are shown in Home Assistant overview but not showingreadings
  • No logging in “logbook”, however entities are found
  • What did I miss?/How to troubleshoot further?

Thanks!!!

hello, I have question.

I have hass running in esxi as an appliance. I have added a P1 port reader to the host and usb passthrough to the vm:
image

I can see this in the cli of hassos:
image

This is configuration.yaml:
image

I also tried /dev/ttyUSB0

but I do not get any readings:
image

I am 100% sure the port is ok cause on another devices I do see the readings…

Any tip/suggestion?

EDIT: got it working… despite the settnig that was described in the manual:


image
I have this meter but it is not version 4 thus

I had to set the dsmr to 2.2:
image

Could you please let us know what you have done to fix this problem, because I have the same problem and I have tried everything yet without succes.