moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

COAP service stopped working #77

Closed kjlisby closed 5 years ago

kjlisby commented 5 years ago

I had the problem that suddenly (after rebooting my Raspberry Pi), the systemd service stopped working. The twistd process used a lot of CPU, but nothing else happened.

Researching made me realize that the twistd.pid file for some reason has become empty (size == 0). And that made the Twisted refuse to start.

Further, this page https://twistedmatrix.com/documents/13.0.0/core/howto/systemd.html informs that when using the —nodaemon option in the systemd service definition file, Twisted is running in the foreground, and that when running in the foreground, no .pid file is needed.

I therefore changed the .service file like this, which made the service work . I.e. I suggest this change in the template .service file to enhance stability (the backslashes are still there, although they may be invisible in your browser):

[Unit] Description=IKEA Tradfri COAP-adapter

[Service] Type=simple ExecStart=/usr/local/bin/twistd --nodaemon \ --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri \ --pidfile= \ --python=/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac

User=pi Group=pi

Restart=always

[Install] WantedBy=multi-user.target

moroen commented 5 years ago

Updated, thanks!