volkszaehler / mbmd

ModBus Measurement Daemon - simple reading of data from ModBus meters and grid inverters
BSD 3-Clause "New" or "Revised" License
229 stars 81 forks source link

[SOLVED] Support needed, config not working with Kostal devices (for use with docker) #288

Closed andreaslink-de closed 1 year ago

andreaslink-de commented 1 year ago

I am somehow too stupid to transform my well working command line into the corresponding config file :-/.

This command works fine with my Kostal inverter as well as with my Kostal smartmeter:

./mbmd run -d KOSTAL:71@172.23.23.141:1502 -d KOSTAL:71@172.23.23.142:502 -m tcp://192.168.42.253:1883 --mqtt-topic pv --mqtt-homie ""

Now, I wanted to transform this into the yaml config to just run the service and have easier maintenance with this transformed config "~/mbmd.yaml":

# REST api, use 127.0.0.1 to restrict to localhost
api: 0.0.0.0:8080
rate: 5s

# mqtt config
mqtt:
  broker: localhost:1883
  topic: mbmd
  user:
  password:
  clientid: mbmd-docker
  qos: 0
  #homie: homie
  homie: ""

# adapters are referenced by device
adapters:
  - device: 172.23.23.141:1502
    rtu: false # Modbus RS485 to Ethernet converter uses RTU over TCP
  - device: 172.23.23.142:502
    rtu: false # Modbus RS485 to Ethernet converter uses RTU over TCP

# list of devices
devices:
  - name: wechselrichter
    type: KOSTAL
    id: 71
    adapter: 172.23.23.141:1502
  - name: smartmeter
    type: KOSTAL
    id: 71
    adapter: 172.23.23.142:502

Sadly no error is given, just the help is shown, also not, when I run this in verbose mode. I would appreciate a golden hint or an error message pointing me into the right direction :-).

andreaslink-de commented 1 year ago

Aiii, I have solved it on my own. So stupid, I omitted the "run" because I thought, when passing in with "-c" it is obvious to run with "run", which was my false assumption. But I leave this hear, as this might help others as well.

My overall purpose was to run this in a docker container using docker-compose and in case someone is looking for a solution here now, this is how my docker-compose.yaml looks like by having the above used mbmd.yaml:

version: '3.4'

#ModBus Measurement Daemon (mbmd)
services:
  pv-mbmd:
    image: volkszaehler/mbmd
    container_name: pv-mbmd
    command: run
    volumes:   #Local-Path:Container-Path
      - ./mbmd.yaml:/etc/mbmd.yaml
    ports:  #Local-Port:Container-Port
      - "9191:8080/tcp"
    restart: unless-stopped
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

Remind: I use watchtower as well as have pointed to a different port on my host.