hotplot / enviroplus-mqtt

A Python service for logging environmental data over MQTT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service failed to start

Mr0Cake opened this issue · comments

On reboot I get the message that the logger failed to start and exceeded the maximum retry count.
I think it is because the pms is not yet ready.
I made the following changes to the startup script:

[Unit]
Description=Enviro+ MQTT Logger
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=10

[Service]
ExecStart=/usr/bin/python3 /usr/src/enviroplus-mqtt/src/main.py <arguments>
WorkingDirectory=/usr/src/enviroplus-mqtt
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Hey, I had this issue as well, then when I looked at your config saw the user. Double checked mine since I changed the user on my pi from the default. Once I made that change the service worked.

I'm having a fail to start/retry count issue as well. It looks like the computer isn't seeing paho. Paho is in there, you can see it in the directory. I'm not sure what to do from here...

Here's a chunk from the journalctl output.

Jul 16 21:07:27 enviro systemd[1]: envlogger.service: Scheduled restart job, restart counter is at 5.
Jul 16 21:07:27 enviro systemd[1]: Stopped envlogger.service - Enviro+ MQTT Logger.
Jul 16 21:07:27 enviro systemd[1]: envlogger.service: Start request repeated too quickly.
Jul 16 21:07:27 enviro systemd[1]: envlogger.service: Failed with result 'exit-code'.
Jul 16 21:07:27 enviro systemd[1]: Failed to start envlogger.service - Enviro+ MQTT Logger.
root@enviro:/etc/systemd/system# journalctl -u envlogger.service -b
Jul 16 20:37:42 enviro systemd[1]: Started envlogger.service - Enviro+ MQTT Logger.
Jul 16 20:37:44 enviro python3[626]: Traceback (most recent call last):
Jul 16 20:37:44 enviro python3[626]: File "/usr/src/enviroplus-mqtt/src/main.py", line 3, in
Jul 16 20:37:44 enviro python3[626]: from logger import EnvLogger
Jul 16 20:37:44 enviro python3[626]: File "/usr/src/enviroplus-mqtt/src/logger.py", line 3, in
Jul 16 20:37:44 enviro python3[626]: import paho.mqtt.client as mqtt
Jul 16 20:37:44 enviro python3[626]: ModuleNotFoundError: No module named 'paho'
Jul 16 20:37:44 enviro systemd[1]: envlogger.service: Main process exited, code=exited, status=1/FAILURE