- Notifications
You must be signed in to change notification settings - Fork 70
AI revamp by https://github.com/danmrossi #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hjelev wants to merge 74 commits into master Choose a base branch from dev_new
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
client.loop_start() spins up Paho’s I/O loop in a separate thread, honoring the reconnect_delay_set back-off policy. The while not stop_event.is_set(): time.sleep(1) keeps the main thread alive, so the other threads (metrics gathering + update checker) can run and the on_message callbacks still fire. When someone publishes “shutdown”/“restart” (or you hit Ctrl+C), you set stop_event, exit the loop, call client.loop_stop(), and then exit cleanly. Because we’re no longer using loop_forever, there’s no more attempt to call .recv() on a missing socket, and the commands will continue to work after a broker restart.
Worker‐thread variables declared up front Old: thread1 and thread2 only ever appeared inside __main__. New: thread1 = None and thread2 = None are defined near the top, so both your connect handler and shutdown logic can safely refer to them. on_message uses subprocess.run() instead of os.system() All reboot/shutdown/display commands now call subprocess.run([...], check=True) for better error handling, instead of plain os.system("…"). Graceful “install” path tears down threads The install branch’s update_and_exit() now sets stop_event, joins both threads if alive, and then exits, ensuring no stray background tasks. gather_and_send_info() wrapped in a try/except Your main metric‐collection loop is now protected so that any unexpected exception inside it will be caught and logged rather than killing the whole service. Switched from loop_forever() to loop_start()/loop_stop() Old: Paho’s client.loop_forever(retry_first_connection=True) ran in the main thread (and hid socket teardown bugs). New: The network loop is kicked off with client.loop_start() once at startup, and explicitly stopped in the finally: block (or in your install/reboot paths) with client.loop_stop(). Main thread now just waits on stop_event Instead of blocking inside Paho’s loop, there’s a simple while not stop_event.is_set(): time.sleep(1) in __main__. Ctrl+C (or an MQTT “install” message) sets stop_event and flows cleanly to shutdown. Return codes and exit flags unified You no longer mix exit_flag = True and sys.exit(0) in several places—everything uses stop_event (and thread joins) to coordinate a single, orderly teardown. Why this fixes the NoneType.recv crash Switching away from loop_forever() (which can tear down the socket under certain reconnect races) to a single, continuously running loop_start() thread—and only stopping it once when you really exit—prevents the Paho client from ever calling .recv() on a None socket. Fix spelling of Default
convert rpi-mqtt-monitor to rpi-mqtt-monitor-v2
convert rpi-mqtt-monitor to rpi-mqtt-monitor-v2
Rename rpi-mqtt-monitor to rpi-mqtt-monitor-v2
Changed rpi-mqtt-monitor to rpi-mqtt-monitor-v2
Change rpi-mqtt-monitor to rpi-mqtt-monitor-v2
Change rpi-mqtt-monitor to rpi-mqtt-monitor-v2
…-improvements Implement logging and update subprocess usage
…improvements Fix sensors and version typo
…improvements Fix update logic and installer quoting
…stability-improvements Improve publishing reliability and config handling
…-and-recovery Improve sensor stability
…--online Fix online/offline status strings
Fix capitalization in docs and translations
…-monitor Append '-v2' to rpi-mqtt-monitor references
…in-service-mode Use single MQTT client in service mode
….exit-in-handler Fix update shutdown to use sys.exit
Fix import order in tests
…-ioerror-block Fix unused variable in ds18b20
…lay-for-service Add service startup delay
…2.service-timeout Adjust service timeout and reload via installer
…cripts Use git from PATH
…3-requirement Clarify Python 3 requirement
…ervice-timeout-issue Add Python 3 auto-installation
…ervice-startup-error Fix remote installer service override
…ncy-on-mqtt-broker Improve MQTT start-up resilience
incorrect device_class set for ext humidity sensor
…nal_strength The unit of measurement % is not valid together with device class signal_strength
add ssl options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
AI revamp by https://github.com/danmrossi