mpepping / solarman-mqtt

Send Solarman Smart PV inverter metrics to MQTT
Apache License 2.0
61 stars 21 forks source link

ERROR:root:Error on start: [Errno 2] No such file or directory: 'config.json' #37

Closed rieders closed 1 year ago

rieders commented 1 year ago

Hello Thank you very much for the great project. Finally I can integrate the Deye inverter into my smart home. I had first created that with Docker that ran until my Raspi had not found its image anymore. Now I tried to start it via Python3. From "hand" this is also possible but if I want to start the daemon automatically I get this message. ERROR:root:Error on start: [Errno 2] No such file or directory: 'config.json'. Can they help me with the problem.

Greetings André

cooling75 commented 1 year ago

Hi, that sounds like the program cannot find the config.json file. Did you rename the sample.config.json to config.json bevore trying to run run.py? You can validate it using:

python3 run.py --validate
rieders commented 1 year ago

Hi

Many thanks for the help

I had already renamed the config. The program can be started manually as a daemon. Unfortunately, this only works as long as putty is running. If I just start it with run.py I get these messages.

I added this entry under rc.local. python3 /opt/solarman-mqtt/run.py &

Regards

root@raspberrypi:~# cd /opt/solarman-mqtt/ root@raspberrypi:/opt/solarman-mqtt# python3 run.py usage: run.py [-h] [-d] [-s] [-i INTERVAL] [-f FILE] [--validate] [--create-passhash CREATE_PASSHASH] [-v]

Collect data from Trannergy / Solarman API

optional arguments: -h, --help show this help message and exit -d, --daemon run as a service -s, --single single run and exit -i INTERVAL, --interval INTERVAL run interval in seconds (default 300 sec.) -f FILE, --file FILE config file (default ./config.json) --validate validate config file and exit --create-passhash CREATE_PASSHASH create passhash from provided password string and exit -v, --version show program's version number and exit root@raspberrypi:/opt/solarman-mqtt#

root@raspberrypi:/# python3 /opt/solarman-mqtt/ run.py /usr/bin/python3: can't find 'main' module in '/opt/solarman-mqtt/'

mpepping commented 1 year ago

I added this entry under rc.local. python3 /opt/solarman-mqtt/run.py &

Change this to python3 /opt/solarman-mqtt/run.py -d & and you should be good.

https://github.com/mpepping/solarman-mqtt/blob/main/Dockerfile#L16-L17