Install DSMR reader on hass os

Hi
I cant install dsmr reader …
Im running hass os on rasp pi 4
Itried teh dsmr “smart meter” config, but its less advanced so i want to use dsmr reader

i tried to use docker compose but its not installed and i cant install it
any idea how i get dsmr reader installed?

Start by describing the problem incl. log output…

ok i got a docker compose file
https://raw.githubusercontent.com/xirixiz/dsmr-reader-docker/master/docker-compose.example.yaml

I tried to “sudo docker-compose up” but it saying no such command
then i tried to “sudo apt install docker-compose” no such command either

No idea if i can install everything using portainer? (bit lost there)

Tried this as well… After install and run i get a error that DSMR cant connect to the database inside the docker

Have you installed docker compose ?

Installatie Docker-compose
sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev -y
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose

docker-compose is not installed.

Your system does not have the sudo or apt command, so it‘s not Debian, Raspbian or Ubuntu.

Since you are using a Raspberry Pi4, I’ll assume that you use Home Assistant OS, formerly known as Hass.IO.

Am I right?

The first 3 gives error: sudo apt no such file or command
the last one begins installing, then i get error

ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --igno                                                                                                             re-installed --no-user --prefix /tmp/pip-build-env-tjw3otra/overlay --no-warn-sc                                                                                                             ript-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple                                                                                                              -- 'setuptools>=40.8.0' wheel 'cffi>=1.1; python_implementation != '"'"'PyPy'"'                                                                                                             "''
       cwd: None
  Complete output (86 lines):
  Collecting setuptools>=40.8.0
    Downloading setuptools-52.0.0-py3-none-any.whl (784 kB)
  Collecting wheel
    Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
  Collecting cffi>=1.1
    Downloading cffi-1.14.4.tar.gz (471 kB)
  Collecting pycparser
    Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Using legacy setup.py install for cffi, since package 'wheel' is not installed                                                                                                             .
  Installing collected packages: setuptools, wheel, pycparser, cffi
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.ar                                                                                                             gv[0] = '"'"'/tmp/pip-install-3v7htn7e/cffi/setup.py'"'"'; __file__='"'"'/tmp/pi                                                                                                             p-install-3v7htn7e/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(                                                                                                             __file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(com                                                                                                             pile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-y0fk8ugb                                                                                                             /install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-                                                                                                             env-tjw3otra/overlay --compile --install-headers /tmp/pip-build-env-tjw3otra/ove                                                                                                             rlay/include/python3.8/cffi
           cwd: /tmp/pip-install-3v7htn7e/cffi/
      Complete output (68 lines):
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      unable to execute 'gcc': No such file or directory
      unable to execute 'gcc': No such file or directory

          No working compiler found, or bogus compiler options passed to
          the compiler from Python's standard "distutils" module.  See
          the error messages above.  Likely, the problem is not related
          to CFFI but generic to the setup.py of any Python package that
          tries to compile C code.  (Hints: on OS/X 10.8, for errors about
          -mno-fused-madd see http://stackoverflow.com/questions/22313407/
          Otherwise, see https://wiki.python.org/moin/CompLangPython or
          the IRC channel #python on irc.freenode.net.)

          Trying to continue anyway.  If you are trying to install CFFI from
          a build done in a different context, you can ignore this warning.

      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.8
      creating build/lib.linux-aarch64-3.8/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/recompiler.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/error.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/__init__.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/commontypes.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/model.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/cparser.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/api.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/lock.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/verifier.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/_embedding.h -> build/lib.linux-aarch64-3.8/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-aarch64-3.8/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-aarch64-3.8
      creating build/temp.linux-aarch64-3.8/c
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -g -fn                                                                                                             o-semantic-interposition -g -fno-semantic-interposition -g -fno-semantic-interpo                                                                                                             sition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libf                                                                                                             fi -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-aarch64-3.8                                                                                                             /c/_cffi_backend.o
      unable to execute 'gcc': No such file or directory
      error: command 'gcc' failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import                                                                                                              sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3v7htn7e/cffi/set                                                                                                             up.py'"'"'; __file__='"'"'/tmp/pip-install-3v7htn7e/cffi/setup.py'"'"';f=getattr                                                                                                             (tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',                                                                                                              '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install                                                                                                              --record /tmp/pip-record-y0fk8ugb/install-record.txt --single-version-externally                                                                                                             -managed --prefix /tmp/pip-build-env-tjw3otra/overlay --compile --install-header                                                                                                             s /tmp/pip-build-env-tjw3otra/overlay/include/python3.8/cffi Check the logs for                                                                                                              full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3                                                                                                             .8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-buil                                                                                                             d-env-tjw3otra/overlay --no-warn-script-location --no-binary :none: --only-binar                                                                                                             y :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel 'cffi>=1.1; py                                                                                                             thon_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.

Yes i’m running HASS OS
Like i said in my opening post
It’s true i dont have sudo or apt

Then you need an alternative installation method, like an (community-) add-on, as docker-compose will not work.

OK…

Any idea how?

Theres no dsmr addon reader addon…

I installed portainer, but not sure how to install it there?

I don’t use Home Assistant OS, I can’t help with that. But in Portainer, you can create “stacks”, using docker-compose file format version 2. Might be sufficient.

Possible to explain that to me cause its beyond my knowledge.When i look into portainer i can create stack
and theres a webeditor i should paste this in?

  GNU nano 4.9.3                                                                        docker-compose.yml
version: '3.8'

services:
  dsmrdb:
    image: postgres:12-alpine
    restart: always
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./dsmrdb:/var/lib/postgresql/data
    environment:
      - TZ=Europe/Brussels
      - PG_TZ=Europe/Brussels
      - POSTGRES_USER=dsmrreader
      - POSTGRES_PASSWORD=dsmrreader
      - POSTGRES_DB=dsmrreader

  dsmr:
#    build: .
    image: xirixiz/dsmr-reader-docker:latest
    depends_on:
      - dsmrdb
    cap_add:
      - NET_ADMIN
    restart: always
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./dsmr_backups:/dsmr/backups
    environment:
      - DJANGO_TIME_ZONE=Europe/Brussels
      - VIRTUAL_HOST=localhost
    ports:
      - 7777:80
      - 7779:443
    devices:
      - /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ5ADAWE-if00-port0:/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ5ADAWE-if00-port0

#volumes:
#   dsmrdb:
#   dsmrdb_backups:

And as I said, Portainer does only support version 2 of docker-compose files. Use this:

services:
  dsmrdb:
    image: postgres:12-alpine
    restart: always
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./dsmrdb:/var/lib/postgresql/data
    environment:
      - TZ=Europe/Brussels
      - PG_TZ=Europe/Brussels
      - POSTGRES_USER=dsmrreader
      - POSTGRES_PASSWORD=dsmrreader
      - POSTGRES_DB=dsmrreader

  dsmr:
    image: xirixiz/dsmr-reader-docker:latest
    depends_on:
      - dsmrdb
    cap_add:
      - NET_ADMIN
    restart: always
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./dsmr_backups:/dsmr/backups
    environment:
      - DJANGO_TIME_ZONE=Europe/Brussels
      - VIRTUAL_HOST=localhost
    ports:
      - 7777:80
      - 7779:443
    devices:
      - /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ5ADAWE-if00-port0:/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ5ADAWE-if00-port0
version: '2'

Ok i tried yours
Now the stack is deployed
and i get 2 containers
When i try to start i get this

chmod -R 777 /data/compose/1/dsmr

on the host to permit reading/writing/creating of files in that folder to everybody.

no such file or directory
not sure where to create it manually either

Sorry, take the paths from the error message,

  • /data/compose/1/dsmrdb
  • /data/compose/1/dsmr_backups

If they don’t exist, create them first using mkdir.

Hope DSMR is nothing of importance, as this setup is wacky your knowledge on what is actually going on is poor. It will probably run, but don’t blame me if things get messy.

Yeah, thats my opinion too, thatswhy i asked for help if someone succeeded and could point out a how-to

I know how to create directories but i dont know where that data folder is
is it under /home/user ?

The path is abolute, so not inside /home. It’s computed from the path Portainer uses as “home” directory and the realtive path defined in the docker-compose file (see volumes: section).

If you want that directory be created inside a user’s home directory, change “./dsmrdb” and “./dsmr_backups” in docker-compose / portainer stack file to absolute paths, using a user’s home directory.

    volumes:
      - /home/user/dsmr/dsmrdb:/var/lib/postgresql/data

and

    volumes:
      - /home/user/dsmr:/dsmr/backups

Of course, replace “user” with real user-id and create world-wide-writable sub-directory “dsmr” first.

i created the dirs and still cant start it
mm
i dont know what i’m doing either, i should probably quit until someone does the same and can help me?