Setup: Make Docker Compose, Scheduler, and Simclient fully operational

This commit is contained in:
2025-07-14 18:41:28 +00:00
parent 7c1f546af9
commit 2fa84c1e2b
7 changed files with 99 additions and 3 deletions

24
simclient/simclient.py Normal file
View File

@@ -0,0 +1,24 @@
# simclient/simclient.py
import time
import paho.mqtt.client as mqtt
def on_message(client, userdata, msg):
print(f"Empfangen: {msg.topic} {msg.payload.decode()}")
def main():
client = mqtt.Client()
client.on_message = on_message
# Im Docker-Netzwerk: Hostname des MQTT-Brokers ist "mqtt"
client.connect("mqtt", 1883)
client.subscribe("infoscreen/+/now")
while True:
# Heartbeat senden
client.publish("infoscreen/client1/heartbeat", "alive")
client.loop(timeout=1.0)
time.sleep(5)
if __name__ == "__main__":
main()