while True:
aft = datetime.datetime.now()
mongoQry = {"time": aft.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3], "Housing Input BWD Sensor": "NULL",
"Inverter Run": "NULL",
"Pressure Sensor": "NULL", "NGQuantity": "NULL", "RedQuantity": "NULL",
"SilverQuantity": "NULL",
"Alarm-Insert Disassembly Down Sensor": "NULL", "Alarm-Insert Input Up Sensor": "NULL",
"Alarm-Housing Input Forward Sensor": "NULL", "Alarm-Housing Input Backward Sensor": "NULL"}
strmongoQry = json.dumps(mongoQry)
# bimongoQry = dict_to_binary(mongoQry)
publish.single("paho/test/single",strmongoQry , hostname="192.168.0.12")
print("Mongo success")
sleep(1)
这是我非常简单的代码 但是pc(192.168.0.12)无法接收到 当我使用pc(192.168.0.12)将MQTT消息发送到以前是发布者的计算机时, 可以。
我还关闭了pc(192.168.0.12)的防火墙
谁会让我知道怎么了..