Closed QuagmireMan closed 6 years ago
Maybe startup script runs mqtt.py under the root user while paho-mqtt library is installed for regular user?
Please try to execute
sude pip install paho-mqtt
Installed it with sudo, and I am still having the same issue.
If I run with python3 i get
File "/home/openhabian/broadlink-mqtt/mqtt.py", line 67 except Exception, e: ^SyntaxError: invalid syntax
Well, it looks like i needed to install broadlink with sudo and it fixed the problem.
sudo pip install paho-mqtt broadlink
Thank you for the help!
hello, I'm windows user and I run on startup mqtt.py and it's ok. I need to know if mqtt.py can run like a service?
Sorry, I have no experience with Windows services. Somebody on the StackOverflow suggested using http://nssm.cc/ for managing user services Could you please try it and tell if it helps
I tried it and it's works fine!! I use Windows 10, then I downloaded the last version,
You have mqtt.py like a service, and you can see it in your Services.
For documentation
sudo pip install paho-mqtt broadlink
sudo nano /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 daemon-reload
> sudo systemctl start broadlink-mqtt.service
> sudo systemctl status broadlink-mqtt.service
I am trying to have the mqtt.py run on startup. I added
python /home/openhabian/broadlink-mqtt/mqtt.py &
to rc.local, but it did not seem to trigger the script.I also get errors when trying to execute mqtt.py from node red.
Traceback (most recent call last): File "mqtt.py", line 3, in <module> import paho.mqtt.client as paho # pip install paho-mqttImportError: No module named paho.mqtt.client
I assume that has to do with the way paho was installed and it can't find the module... but I haven't figured that out either. I am assuming they might be related.
Is it something simple I am missing?