0

I'm setting my MQTT devices. My code to send from ESP8266 + NodeMCU v2 is something like that:

client.publish(ANSWER_TEMPERATURE_TOPIC, buffer);

Where ANSWER_TEMPERATURE_TOPICis "answer/node_1/temperature" and buffer is for example 22.10. I set my device during connecting to const char* CLIENT_ID = "node_1";

client.connect(CLIENT_ID, MQTT_USERNAME, MQTT_PASSWORD)

Is there any possibility to check this ID CLIENT during receiving message? I run in my raspberry Pi this command:

 mosquitto_sub -d -u pi -P channel -t answer/node_1/temperature

And the answer is

Client mosqsub/1021-raspberryp sending CONNECT
Client mosqsub/1021-raspberryp received CONNACK
Client mosqsub/1021-raspberryp sending SUBSCRIBE (Mid: 1, Topic: 
answer/node_1/temperature, QoS: 0)

Client mosqsub/1021-raspberryp received SUBACK
Subscribed (mid: 1): 0

Client mosqsub/1021-raspberryp received PUBLISH (d0, q0, r0, m0, 
'answer/node_1/temperature', ... (5 bytes))
21.8

Is there any possibility to see this CLIENT_ID? In future, I want to create PHP file to receiving this message.

David J.
  • 23
  • 1
  • 4

1 Answers1

0

You can not, there is no information about the sender encoded in the message unless you add it yourself to the payload, or in the topic you publish the message to.

hardillb
  • 54,545
  • 11
  • 67
  • 105