eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
217 stars 60 forks source link

Raspberry Pi auto start #84

Open peterbeeston opened 3 years ago

peterbeeston commented 3 years ago

Installed on Raspberry Pi 3, all worked after loading Python3 utilities. Runs fine executing python3 mqtt.py and /usr/bin/python3 /home/pi/broadlink-mqtt/mqtt.py (command in service file)

Contents of /lib/systemd/system/broadlink-mqtt.service

[Unit]
Description=Broadlink MQTT Service
After=multi-user.target
Conflicts=getty@tty1.service

[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/pi/broadlink-mqtt/mqtt.py
StandardInput=tty-force

[Install]
WantedBy=multi-user.target

sudo systemctl start broadlink-mqtt.service gives no error sudo systemctl status broadlink-mqtt.service gives the following:

● broadlink-mqtt.service - Broadlink MQTT Service
   Loaded: loaded (/lib/systemd/system/broadlink-mqtt.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-10-21 16:08:09 BST; 7min ago
  Process: 8674 ExecStart=/usr/bin/python3 /home/pi/broadlink-mqtt/mqtt.py (code=exited, status=1/FAILURE)
 Main PID: 8674 (code=exited, status=1/FAILURE)

Oct 21 16:08:09 bg1mqtt systemd[1]: Started Broadlink MQTT Service.
Oct 21 16:08:09 bg1mqtt systemd[1]: broadlink-mqtt.service: Main process exited, code=exited, status=1/FAILURE
Oct 21 16:08:09 bg1mqtt systemd[1]: broadlink-mqtt.service: Failed with result 'exit-code'.

Good work, integrated with HomeAssistant great.

eschava commented 3 years ago

@VincentSC maybe you could help?

fapgomes commented 3 years ago

@peterbeeston can you run manually the command

/usr/bin/python3 /home/pi/broadlink-mqtt/mqtt.py

in the console to see the error?