Esp8266 interact with mosquitto broker

I have a esp8266 01 module,my Project based on iot and i create a broker on ubuntu 16.04 after that i wrote a code for the communicartion between eps8266 and mosquitto broker ,i control a relay with my phone app mymqtt..project works at 80-85% success, what i mean i write a pub message "0" relay become in high situation after that i publish a "1" and relay becomes in low situatio n if i'm lucky this mode 0 high 1 low 0 high 1 low...works continuity but some times i sent message 0 nothing again 0 nothing again 0 nothing again 0 realy is high after that publish 1 nothing didn't appear in serial when 0 or 1 appears in serial relay works.the esp8266 01 has the problem i believe my code is right and works fine maybe i should buy another esp8266 module for faster and continuously results? For example 12 ? What's wrong?

What’s wrong?

  1. Single paragraph post with no line breaks = impossible to read, even worse to comprehend.
  2. No schematic.
  3. No code.
  4. No links to relay used.

The result? No help for you!

If you just want someone to agree with you that the problem is the ESP8266, that will not be me. If want help, follow the rules in the “How to use this forum” sticky post. There’s a reason why those things are requested.

Sorry for bad post,i agree with you.
From this post did you understand my problem?

I understand that you built something that doesn't work. Chances are very good the hardware, as individual bits and pieces works the way they should. Now, you put them together into a system and it does not do what only you know you want it to do. We have no idea of what you're doing since verbal descriptions are usually wrong and always impercise.

It's really simple. With no documentation, there can be no help. This is not a description of a problem:

what i mean i write a pub message "0" relay become in high situation after that i publish a "1" and relay becomes in low situatio n if i'm lucky this mode 0 high 1 low 0 high 1 low...works continuity but some times i sent message 0 nothing again 0 nothing again 0 nothing again 0 realy is high after that publish 1 nothing didn't appear in serial when 0 or 1 appears in serial relay works

Good afternoon,

I work on a project based on IoT.

Components: Arduino Uno R3, ESP8266-01, Breadboard, Relay, Laptop with Operating System: Ubuntu 16.04 LTS.

I created a MQTT broker on Ubuntu 16.04, that communicates via the MyMQTT App (for Android) with the ESP8266-01, using the serial Communication of the Arduino IDE.

The ESP-01 exchanges messages with the broker, that call the mode of the relay (On/Off). Even though, I manage to open/close the relay with a decent percent of success (etc. 75-80%) using the subscription/publish process of the MyMQTT App, I need to improve this percent to something close to 100%.

To be more precise with the problem, I use a callback function that handles "0" as HIGH (closes the relay) and "1" as LOW (opens the relay). The problem that I try to deal with, is that there are "missed" 0 and 1 that although are sent via the MyMQTT App (publish), don't eventually reach the Serial Communication of Arduino IDE.

I have embedded the callback function and I'll do the same with whatever is needed.

When you press the button does the callback function get triggered every time but sometimes does not operate the relay or is the problem that you press the button and the callback does not always receive the message?

What QoS are you using, I would think you need level 1 or 2.