Skip to content

publisher function for temperature #1

Closed
wants to merge 1 commit into from
Closed

Commits on Jul 31, 2024

  1. Add files via upload

    # Publisher function for temperature
    def publish_temperature_data(client):
        while True:
            temperature = random.uniform(18.0, 30.0)  # Simulate temperature in Celsius
            message = f"{temperature:.2f}"
            client.publish(temperature_topic, message)
            print(f"Published Temperature: {message} °C")
            time.sleep(5)  # Publish every 5 seconds
    kaurm105 committed Jul 31, 2024
    Configuration menu
    Copy the full SHA
    45a8409 View commit details
    Browse the repository at this point in the history