Skip to content

publisher function for temperature #1

Closed
wants to merge 1 commit into from
Closed

Conversation

kaurm105
Copy link
Owner

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

# 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 kaurm105 closed this Jul 31, 2024
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant