Connecting Mobile with ESP8266
Asked Answered
O

1

11

I am working on a Home Automation project and I want to connect an Mobile Application to ESP8266.

  • I can Publish a message from Mobile App to AWS server which is setup as a broker. (Working)

  • I can Publish a message from AWS to Raspberry PI. (Working)

  • I can also Publish a Mqtt message from Raspberry PI to NodeMCU / ESP8266. (Working).

But the problem occurs when I am trying to set all these together. While Publishing a message from AWS it is received by Raspberry PI but it is not reflected on the NodeMCU / ESP8266.

Here is the code in use.

This is what I am using in my ESP8266. When I Publish from Raspberry PI it is working fine, even when I am connecting PI will MQTT client app on my mobile it is working. But there is no reaction on ESP8266 when I publish from AWS, but the PI as able to receive the message.

Onstad answered 22/8, 2016 at 7:4 Comment(5)
We need a lot more information before we can help here. Do you have a bridge configured, if so how, what topics is everything publishing/subscribing on. How are you testing things?Vinegarette
github.com/ItKindaWorks/ESP8266/blob/master/Home%20Automation/… This is what I am using in my ESP8266. When I Publish from Raspberry PI it is working fine, Even when I am connecting PI will MQTT client app on my mobile it is working. But there is no reaction on ESP8266 when I publish from AWS. but the PI as able to receive the message.Onstad
Edit the question to include the major details (don't just link elsewhere)Vinegarette
Can you post the serial logs? I see a similar example online but they are connecting/subscribing in a slightly different order (also using Ethernet).Othilie
Have you checked the QOS of the message from the message sent from AWS. Maybe with QOS1 or 2 you can solve this issue. Or try to deactivate the raspberry and see if you receive the message on the ESP then.Kassab
M
0

Your issue should be related retained flag of the message. Publishers can instruct the broker to deliver the last sent message to all the new subscribers. This is done by setting the retained flag to true. When the broker gets a retained message, it knows that the message has to be pushed to new subscribers. This feature is very useful for bringing the new subscribers up to speed with the same state as other subscribers, otherwise after message is pubblished, only the client already connected as subcribed can receive it (RasPi) and not the new subscribers (NodeMCU).

Monsoon answered 24/3, 2018 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.