-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can This Broker be STABLE with a “Tasmota” implemented Sonoff Devices? #27
Comments
An MQTT broker is waiting for incoming conections, i.e. it does nothing with the clients as long as they are not connecting - it even doesn't know about them. I assume your problem might be the lwip - did you select "lwip Variant: 1.4 High Bandwidth" when building the broker? If not - the new lwip implementation in Arduino IDE causes problems with reconnects. You might also try my precompiled firmware at: https://github.com/martin-ger/esp_mqtt . It runs quite robust and has a lot more options than the basic Arduino implementation. |
Thank you for the kind response. I saw last night the previous conversation about the lwip. Do not yet know how to select the 1.4 variant but will investigate tonight. I do not build with the Arduino IDE; using visual studio 2017 (not VS Code) which uses all the Arduino libraries. I will be searching later how to do this selection for VS and for the IDE. If you have the patience to point me to how to select the iwip variant, that could save me a LOT of time. |
Sorry, no idea how to select this in VS - in Arduino it is a menue item. There it selects the following settings:
|
Thanks again... I will be working tonight. Also did some research; this will help. Next I will try to load your binary. This will allow me to get a stable version operating. But, I still want to add custom items to my broker. LZH |
Please excuse me for having to ask such BASIC questions. However, I can not discover how to use the serial commands to reset the broker parameters. Successfully loaded the bin files: uMQTT Broker V2.0.7 starting No config found, saving default in flash |
Generally looks good. Do you use correct terminal settings? Try Ctrl-M as line end. |
Have your binary loaded and talking. Some additional help for others is below. Help #1 Help #2 Loading with QIO/DIO |
System operating very well and stable. Next item is to enable more than the 8 standard clients. Closing this thread. THank you very much. |
Can This Broker be stable with a “Tasmota” implemented Sonoff Devices?
I have invested probably over 70 hours reading and attempting a solution to this... I am ready to ask questions before I give up: PLEASE.
This broker successfully connects and communicates with several “Tasmota loaded” Sonoff devices. Broker to 4 devices to existing HomeSEER operating application. However, connection to the BROKER typically REQUIRE the Sonoff devices to be active BEFORE starting the broker.
#1 Does the broker boot and send an MQTT initialize sequence that triggers the Sonoff devices to come alive and respond? If yes, then I can use a timer to force recovery should any devices power cycle during the day.
This timeout to a broker session is what the Sonoff device shows:
01:33:22 MQT: Attempting connection...
01:33:38 MQT: Connect failed to 10.0.0.8:1883, rc -4. Retry in 10 sec
Reboot the broker; the Sonoff finds success and we get:
received topic 'broker/counter' with data '100'
received topic 'tele/SONOFF_Device1/LWT' with data 'Offline'
The broker code is below, but except for my configuration it should be right from the example.
Any help will be appreciated.
`*
*/
#include <ESP8266WiFi.h>
#include "uMQTTBroker.h"
/*
*/
bool WiFiAP = false; // Do yo want the ESP as AP?
unsigned int mqttPort = 1883; // the standard MQTT broker port
/*
Custom broker class with overwritten callback functions
*/
class myMQTTBroker : public uMQTTBroker
{
public:
virtual bool onConnect(IPAddress addr, uint16_t client_count) {
Serial.println(addr.toString() + " connected");
return true;
}
virtual bool onAuth(String username, String password) {
Serial.println("Username/Password: " + username + "/" + password);
return true;
}
virtual void onData(String topic, const char *data, uint32_t length) {
char data_str[length + 1];
os_memcpy(data_str, data, length);
data_str[length] = '\0';
}
};
myMQTTBroker myBroker;
/*
*/
void startWiFiClient()
{
const char* Zssid[] = "AA_HOME-xxxx"; // your network SSID (name)
const char* Zpass[] = "12345678"; // your network password
}
void startWiFiAP()
{
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid, pass);
Serial.println("AP started");
Serial.println("IP address: " + WiFi.softAPIP().toString());
}
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println();
}
int counter = 0;
void loop()
{
/*
* Publish the counter value as String
*/
myBroker.publish("broker/counter", (String)counter++);
}
`
The text was updated successfully, but these errors were encountered: