DSMR Reader Add-on for Home Assistant

when i try to update i get the following error

The command '/bin/ash -o pipefail -c curl -J -L -o /tmp/bashio.tar.gz "https://github.com/hassio-addons/bashio/archive/v0.14.3.tar.gz" && mkdir /tmp/bashio && tar zxvf /tmp/bashio.tar.gz --strip 1 -C /tmp/bashio && mv /tmp/bashio/lib /usr/lib/bashio && ln -s /usr/lib/bashio/bashio /usr/bin/bashio && rm -f -r /tmp/*' returned a non-zero code: 1

I have exactly the same error.
Hass is updated to the last versions.
DSMR wants to upgrade from 1.03 to 1.10

Maybe some upgrade errors are because of skipping some intermediate versions. Try to uninstall the addon and install/reconfigure it again (just note down your settings somewhere).

Note, last addon version is 1.2.0 so press the “Check for Updates” button first in the Add-on Store.

copied the yaml configuration
and reinstalled and pasted back configuration on line 2 (ENABLE_INGRESS: false is new)
and it works again
(btw this ingress inclusion is really nice)

I had turned off the auto update after the timescaledb problems
so i was a bit hesitant with the autoupdate, but only skipped due to pending one update :confused:

Did exactly the same, working like a charm with ingress :slight_smile:

2022-05-24: DSMR Reader Add-on v1.2.1, Ingress out of BETA, see changelog
Changelog here

1 Like

what does ingress do?
if i have it turned on it is son steady text only think the web browser looks nicer or am i doing something wrong?

what does ingress add?
because everyone says it works great, I just don’t think it looks like it, but I have the idea that I’m doing something wrong.

Read back a few comments, DSMR Reader Add-on for Home Assistant - #252 by MrBlond and onward.

Just set the webserver to Ingress and see if you can open the app with the open the ui button.

2022-05-26: DSMR Reader Add-on v1.3.0, DSMR-reader v5.2
Changelog here

I got no new readings… the website is working but no actual data. I use a ip slimmemetergateway that I also have in Domoticz. with the same settings I see there new readings. but the addon gives me an error in the log. (this is after the update to 2022.06 i think (after the update dsmr reader got no new readings)

022-06-02 23:12:57,120 ERROR    mixins       run_once                        103 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/serial/urlhandler/protocol_socket.py", line 171, in read
    raise SerialException('socket disconnected')
serial.serialutil.SerialException: socket disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/dsmr_backend/mixins.py", line 92, in run_once
    self.run(data=self.data, **options)
  File "/app/dsmr_datalogger/management/commands/dsmr_datalogger.py", line 29, in run
    telegram = next(self.telegram_generator)
  File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 53, in read_telegram
    incoming_bytes = serial_handle.read(MAX_BYTES_PER_READ)
  File "/usr/local/lib/python3.10/site-packages/serial/urlhandler/protocol_socket.py", line 178, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: socket disconnected

what can I do?

After months of flawless operation, my reader suddenly stopped working. I have tried re-installing the add-on, restarting the host, etc. But unfortunately that did not work out.

Config:

WEBSERVER: Ingress
DSMRREADER_ADMIN_USER: ****
DSMRREADER_ADMIN_PASSWORD: ****
DJANGO_DATABASE_NAME: dsmrreader
DJANGO_DATABASE_USER: postgres
DJANGO_DATABASE_PASSWORD: ****
DJANGO_DATABASE_HOST: 77b2833f-timescaledb
DJANGO_DATABASE_PORT: '5432'
DSMRREADER_REMOTE_DATALOGGER_MODE: standalone
DSMRREADER_REMOTE_DATALOGGER_API_HOSTS: http(s)://<YOUR_DSMR_HOST>:<PORT>
DSMRREADER_REMOTE_DATALOGGER_API_KEYS: <YOUR_API_KEY>
DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0
DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD: serial
DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE: '115200'
DSMRREADER_REMOTE_DATALOGGER_NETWORK_HOST: x.x.x.x
DSMRREADER_REMOTE_DATALOGGER_NETWORK_PORT: x
DSMRREADER_REMOTE_DATALOGGER_SLEEP: '3'
DSMRREADER_LOGLEVEL: ERROR
DJANGO_FORCE_SCRIPT_NAME: ''
DJANGO_STATIC_URL: static/
DATALOGGER_MODE: standalone
DATALOGGER_SERIAL_PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0
DATALOGGER_INPUT_METHOD: serial
DATALOGGER_SERIAL_BAUDRATE: '115200'
DATALOGGER_NETWORK_HOST: x.x.x.x
DATALOGGER_NETWORK_PORT: x
DATALOGGER_SLEEP: '0.5'

Error log:

RuntimeError: ('Failed to connect: {}', SerialException(12, "could not open port /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0: [Errno 12] Out of memory: '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0'"))
127.0.0.1 - - [04/Jun/2022:22:37:24 +0200] "GET /about HTTP/1.1" 200 19065 "-" "curl/7.80.0" "-"
127.0.0.1 - - [04/Jun/2022:22:37:29 +0200] "GET /about HTTP/1.1" 200 19065 "-" "curl/7.80.0" "-"
Starting DSMR Reader - datalogger...
Current logging level set to "ERROR". More information can be found here: https://dsmr-reader.readthedocs.io/en/latest/how-to/troubleshooting/enabling-debug-logging.html
127.0.0.1 - - [04/Jun/2022:22:37:35 +0200] "GET /about HTTP/1.1" 200 19065 "-" "curl/7.80.0" "-"
2022-06-04 22:37:35,334 ERROR    mixins       run_once                        103 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/serial/serialposix.py", line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 12] Out of memory: '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 37, in read_telegram
    serial_handle = serial.serial_for_url(url=url_or_port, timeout=MAX_READ_TIMEOUT, **serial_kwargs)
  File "/usr/local/lib/python3.10/site-packages/serial/__init__.py", line 90, in serial_for_url
    instance.open()
  File "/usr/local/lib/python3.10/site-packages/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 12] could not open port /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0: [Errno 12] Out of memory: '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A13LNT9A-if00-port0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/dsmr_backend/mixins.py", line 92, in run_once
    self.run(data=self.data, **options)
  File "/app/dsmr_datalogger/management/commands/dsmr_datalogger.py", line 29, in run
    telegram = next(self.telegram_generator)
  File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 39, in read_telegram
    raise RuntimeError('Failed to connect: {}', error)

Can you tell more about your setup? Did you try uninstalling and reinstalling the addon?

From the log it seems it can’t connect to the usb device, can you try the usb device directly instead (something like /dev/ttyUSB0) of it’s id?

I have uninstalled reinstalled. And tested with ingress and normal.
In my config there is a USB but I use ipv4 slimme metergateway. Maybe my config can help?
I can’t remember that I have changed something and because of that I don’t know the config from last month…

WEBSERVER: Standard
DSMRREADER_ADMIN_USER: admin
DSMRREADER_ADMIN_PASSWORD: admin
DJANGO_DATABASE_NAME: dsmrreader
DJANGO_DATABASE_USER: postgres
DJANGO_DATABASE_PASSWORD: homeassistant
DJANGO_DATABASE_HOST: 77b2833f-timescaledb
DJANGO_DATABASE_PORT: ‘5432’
DSMRREADER_REMOTE_DATALOGGER_MODE: standalone
DSMRREADER_REMOTE_DATALOGGER_API_HOSTS: http://192.168.0.9:7777
DSMRREADER_REMOTE_DATALOGGER_API_KEYS: 31M84RW1MCZDOFTVKU2GWPIS72H55G5TXQMGC2R8MM8DJ30OLOTP6INAZ2EZT6YI
DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT: /dev/ttyUSB1
DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD: ipv4
DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE: ‘115200’
DSMRREADER_REMOTE_DATALOGGER_NETWORK_HOST: 192.168.0.82
DSMRREADER_REMOTE_DATALOGGER_NETWORK_PORT: ‘23’
DSMRREADER_REMOTE_DATALOGGER_SLEEP: ‘0.5’
DSMRREADER_LOGLEVEL: ERROR
DJANGO_FORCE_SCRIPT_NAME: ‘’
DJANGO_STATIC_URL: static/

After some more research, in the host log I found:

[1354263.894274] xhci-hcd xhci-hcd.8.auto: Ring expansion failed
[1354263.898730] ch341-uart ttyUSB1: usb_serial_generic_submit_read_urb - usb_submit_urb failed: -12

So would this be a host issue?

Did you try /dev/ttyUSB0 or /dev/ttyUSB1? What is your setup? HA OS on hardware or in VM?

I see that you specified some settings like ‘DSMRREADER_REMOTE_DATALOGGER_API_HOSTS’ which you don’t need.

As you are using a remote datalogger which sends data over to this addon, please reset the settings of the addon, configure your db settings, set the mode to receiver and open up the port in the network settings of the addon.

In the admin ui, you need to activate the API and get the KEY.

Then in the ‘slimme metergateway’ you configure the correct HA ip + port you opened up (7777?) and the KEY.

I’m on vacation. But emptied the fields, you said. The website is working, but no new meters and same error.
The gateway is working on the 82 up and port 23.

Any other ideas?

Updated Dockers. Rebooted the host and removed USB in dsmrreader and configuration. Then I changed to dsmr 2.x instead of 4/5. Was the key!

Thanks for support, you are great.

Hi, I would like to recalculate the prices but I can’t get it to change.

When I try to do it with ssh I get the following error: django.db.utils.OperationalError: could not translate host name “dsmrdb” to address: Name does not resolve
I use this command: python manage.py dsmr_stats_recalculate_prices
When I do this using portainer I get the same error.

Can someone point me in the right direction.

For me it would be a lot easier to have a button in the webinterface.