modbus_MediaPipe/MQTT_project/MQTT_sub_main.py

16 lines
319 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pip install paho-mqtt
import json
import time
from paho.mqtt import client as mqtt
from MQTT_sub_Module import sub_to_plc
BROKER_HOST = "169.254.11.130"
BROKER_PORT = 1886
TOPIC = "topic_plc_and_py_for_AXIS"
# 建議測試用 QoS=1retain=False
QOS = 1
RETAIN = False
sub_to_plc(BROKER_HOST, BROKER_PORT, TOPIC)