Replies: 4 comments 3 replies
-
Hi, if you have folllowed Wolfgangs instructions then presumably you have mosquitto running (and the tests he suggests ran ok). Might as well try to eliminate the variable of running from inside Thonny... What happens if you a) run PictureFrame in a command prompt in a terminal window opened from the desktop? $ cd ~/pi3d_demos
$ python3 PictureFrame2020.py --keyboard=true --verbose=true b) Exit to the command line (i.e. don't have the X11 desktop running at all) then at the command line $ cd ~/pi3d_demos
$ sudo xinit /usr/bin/python3 /home/pi/pi3d_demos/PictureFrame2020.py --keyboard=true --verbose=true setting keyboard true will allow you to stop the program with ESC and verbose true will make any error caught in the MQTT section get printed - worth a try. |
Beta Was this translation helpful? Give feedback.
-
@jimmyg83 That's great, thanks for the feedback. I will change the PictureFrame2020 code on master next release - without digging into how all the MQTT works it looks like doing the callback registration as part of the on_connect function is the logical place to do it. Paddy |
Beta Was this translation helpful? Give feedback.
-
Would it make sense to separate all MQTT stuff out in a separate file and only import it if needed (configured)? |
Beta Was this translation helpful? Give feedback.
-
Yes, at some stage the whole thing will need to be refactored with class instances rather than a global scope and functionality split out for the loop control, file loading, image info etc etc. Sometime early next year I will have a closer look. Have a look at this for the kind of way to break it down https://github.com/helgeerbe/picture_frame, https://pypi.org/project/picframe/ |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am having some issues with the MQTT functionality of the PictureFrame2020.py script. I am running this on 2 raspberry pi4's one 4gb and one 8gb and both have the same issue.
I have set it up as per all the instructions etc however I can only get it to work if I run the script in a debug mode (I have been using Thonny and it only works if I use the "nicer" debug function not the "faster" debug function).
I have been playing in the code to try and pin point the issue without luck. It almost looks like the callbacks stop functioning when the code gets past the on_connect callback function. I added a publish script to a status topic on the MQTT and a print in the on_connect and on_message functions to see what was happening. I can see the print and MQTT message from the initial on_connect and then I never get anything from the on_message function (even when the script publishes on the paused topic at the end of the MQTT setup code).
I have also written a standalone MQTT script to test the MQTT functions and I can get this to work without any issues. The rest of the PictureFrame2020 script appears to be working fine just MQTT does not work for me.
Has anyone else had this issue or can point me in the direction of what might be causing it.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions