Good morning Cayenne-fellows,
The manual connection over MQTT to cayenne works perfectly (manual=python script executed in shell)
I’ve been trying for some time to get a python script executed automatically at startup and followed this nice tutorial:
I’ve tried all methods excluding the init.d-variant. Adding a service or using crontab looked like the best options to me.
So for example what I did for adding the auto startup is:
crontab -e
@reboot sudo python3 /home/pi/Desktop/pyprog/pytest.py > /home/pi/Desktop/pyprog/log.txt
crontab -l showed that the cronjob is running
The script connects to MQTT-Cayenne:
I see that there is one successful connection over Cayenne but then the RPI loses connection again. When i execute the script using python3 myscript.py it works fine.
I have also tried adding a sleep time of 30-120seconds to wait for internet connection to establish and used & to rund the process in the background.
Have you got an idea on how to troubleshoot this? The project involves three parts: RPI with cronjob, python3 and mqtt-cayenne.
Thank you!
I have used following library: