Hallo zusammen,
und zwar möchte eine Kommunikation zwischen zwei TXT-Controllern herstellen. Mein Ziel ist es das der erste TXT-Controller eine Nachricht published z.B „test“. Und der zweite TXT-Controller soll überprüfen, ob die folgende Nachricht angekommen ist und z.B „Text ist da“ printen (Zur Überprüfung das dieser auch wirklich überprüft hat das der Text da ist).
Der erste Controller hat eine andere IP-Adresse als der andere.
1 TXT-Controller : 192.168.178.XX
2 TXT-Controller : 192.168.178.XX
Es wäre echt nett, wenn mir jemand eine Lösung zeigen könnte
Kommunikation TXT-Controller (MQTT)
Forumsregeln
Bitte beachte die Forumsregeln!
Bitte beachte die Forumsregeln!
Kommunikation TXT-Controller (MQTT)
- Dateianhänge
-
- mosquitto.JPG (66.91 KiB) 647 mal betrachtet
Re: Kommunikation TXT-Controller (MQTT)
Sorry but al the documentation is in English, it make no sense to translate this.
see: http://www.steves-internet-guide.com/mqtt-works/
Assume: 192.168.178.xx =MQTT-broker (service), xx can be 01, 02 or an other device with a MQTT broker
On 192.168.178.02 (and all the other system which have subscribe)
/usr/bin/mosquitto_sub.exe" -h 192.168.178.xx -t # -v -d
oder
/usr/bin/mosquitto_sub.exe" -h 192.168.178.xx -t test/topic -v -d
On 192.168.178.01
/usr/bin/mosquitto_pub -h 192.168.178.xx -t test/topic -m helloWorld -d
The 192.168.178.02 (and all the other system which have subscribe to that topic) will receive the message
helloWorld
Note: you don't publish to an certain client, only to the MQTT-broker.
=========================================================================================
In Python:
Subscribe to a topic and will receive the payloads for that topic:
http://www.steves-internet-guide.com/su ... tt-client/
Publish a topic with payload:
http://www.steves-internet-guide.com/pu ... tt-client/
In C++:
Subscribe and publish:
https://stackoverflow.com/questions/317 ... qtt-client
https://github.com/eclipse/paho.mqtt.cpp
see: http://www.steves-internet-guide.com/mqtt-works/
Assume: 192.168.178.xx =MQTT-broker (service), xx can be 01, 02 or an other device with a MQTT broker
On 192.168.178.02 (and all the other system which have subscribe)
/usr/bin/mosquitto_sub.exe" -h 192.168.178.xx -t # -v -d
oder
/usr/bin/mosquitto_sub.exe" -h 192.168.178.xx -t test/topic -v -d
On 192.168.178.01
/usr/bin/mosquitto_pub -h 192.168.178.xx -t test/topic -m helloWorld -d
The 192.168.178.02 (and all the other system which have subscribe to that topic) will receive the message
helloWorld
Note: you don't publish to an certain client, only to the MQTT-broker.
=========================================================================================
In Python:
Subscribe to a topic and will receive the payloads for that topic:
http://www.steves-internet-guide.com/su ... tt-client/
Publish a topic with payload:
http://www.steves-internet-guide.com/pu ... tt-client/
In C++:
Subscribe and publish:
https://stackoverflow.com/questions/317 ... qtt-client
https://github.com/eclipse/paho.mqtt.cpp