0

I have been attempting to setup a mosquitto server in order to publish data about my IoT devices to the IoT core service. This would then be picked up by Alexa so that someone can say "What is my battery voltage?" and Alexa will reply correctly.

Anyways, I followed this guide:

Tutorial

Since I am hosting the Mostquitto on a RPI (I updated to the latest version of mosquitto), I skipped the part about the EC2 server. Everything was able to install fine without issues. When I get to the step on testing the setup, this is were the "error" occurs.

Per the guide, In my MQTT test client on the IoT core, I subscribe to the localgateway_to_awsiot. When I run this command from my RPI: mosquitto_pub -h localhost -p 1883 -q 1 -d -t localgateway_to_awsiot -i localClientID -m "{\"message\": \"helloFromLocalGateway\"}"

I do not see the output on the Test MQTT Client. However, the output of the command is as follows:

Client localClientID sending CONNECT
Client localClientID received CONNACK (0)
Client localClientID sending PUBLISH (d0, q1, r0, m1, 'localgateway_to_awsiot', ... (36 bytes))
Client localClientID received PUBACK (Mid: 1, RC:0)
Client localClientID sending DISCONNECT

From the messages it appears that the message was sent, but why did it not appear on my MQTT test client?

philm
  • 101
  • 2
  • How have you subscribed to the mosquito test client? When I run that command (adjusted for my mqtt server) it works fine. If your MQTT client is not seeing it, maybe its because you are not subscribed to the correct topic? (To subscribe to that topic I ran the equivalent of **mosquitto_sub -h localhost -t "localgateway_to_awsiot"** ) – davidgo Dec 22 '21 at 22:54
  • On the Test MQTT server, I am subscribed to the localgateway_to_awsiot. On the RPI, I am sending data to it. Here is the command that I use: mosquitto_pub -h localhost -p 1883 -q 1 -d -t localgateway_to_awsiot -i localClientID -m "{\"message\": \"helloFromLocalGateway\"}" The log I posted above is from the RPI. It is the Test MQTT server that is not displaying anything – philm Dec 23 '21 at 01:23
  • I'm not sure I understand what you are saying. AFAIK (and I'm no expert), you don't subscribe on a MQTT server, you subscribe on an MQTT client. IE there are 3 moving parts here - the MQTT server (broker), An MQTT client with a subscription (ie mosquitto_sub) and a mosquitto publisher (mosquito_pub). It is possible to run a client and server on the same box (and indeed if you are publishing to localhost you need to do that) – davidgo Dec 23 '21 at 02:57
  • So in the MQTT test it is actually a MQTT client. It is a web interface provided by Amazon. There, I can subscribe to the localgateway_to_awsiot. On my server instance, I am publishing to the localgateway_to_awsiot – philm Dec 23 '21 at 14:59
  • Your statements appear inconsistent. We cant help you if you give us wrong information. Localost has a specific meaning of "this device". If you ate talking about Amazon Web Interfaces you are not dealing with localhost - and most likely have a firewall issue. Between misusing the term server and client and localost and otherip this question is so meaningless as to be unanswerable. – davidgo Dec 23 '21 at 17:54

0 Answers0