Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
LOOP THREAD
# Run the MQTT loop for the subscriber in a separate thread subscriber_thread = threading.Thread(target=subscriber_client.loop_forever) subscriber_thread.start() # Run the publisher functions in separate threads energy_thread = threading.Thread(target=publish_energy_data, args=(publisher_client,)) temperature_thread = threading.Thread(target=publish_temperature_data, args=(publisher_client,)) energy_thread.start() temperature_thread.start() # Wait for the threads to complete energy_thread.join() temperature_thread.join()
- Loading branch information