MQTT controller - ping but Connection timeout on MQTT clients
-
Thanks for the answer but it's not the point - mosquitto_sub doesn't even connect to the server (Connection timed out).
How can I send you more data? I tried to println to serial:
int main(void) { init(); Ethernet.begin(TCP_MAC, TCP_IP); Serial.println("Ether initialized"); delay(1000); // Wait for Ethernet to get configured. gw.begin(RF24_PA_LEVEL_GW, RF24_CHANNEL, RF24_DATARATE, writeEthernet, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN); Serial.println("GW started");but it does not print anything besides some machine characters (ÿûï). If I add Serial.begin(9600); just after init I got "Ether initialized" but no GW started message.
Putting Serial.println in MyMQTT.cp after first line in this procedure doesn't print anything:
void MyMQTT::begin(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate, void (*inDataCallback) (const char *, uint8_t *), uint8_t _rx, uint8_t _tx, uint8_t _er) { Serial.begin(BAUD_RATE); Serial.println("Beginning GW begin"); repeaterMode = true; isGateway = true; MQTTClientConnected = false;I got:
Ether initialized \ÚAs the documentation states:
define TCPDUMP and connect serial interface if you have problems, please write on http://forum.mysensors.org/ and explain your problem, include serial output. Don't forget to turn on DEBUG in libraries\MySensors\MyConfig.h also.Have you tried this part (define tcpdump and uncomment debug)?
[EDIT] yes you did, sorry for not correct reading[/EDIT]
-
I can't compile this... After applying the patch I got some new error. @gadu Could you possibly share source files and version of your Arduino IDE?
This report would have more information with "Show verbose output during compilation" enabled in File > Preferences. Arduino: 1.0.6 (Mac OS X), Board: "Arduino Uno" MyMQTTClient.cpp.o: In function `MyMQTTClient::SendMQTT(MyMessage&)': MyMQTTClient.cpp:275: undefined reference to `MySensor::loadState(unsigned char)' MyMQTTClient.cpp:280: undefined reference to `MySensor::saveState(unsigned char, unsigned char)' MyMQTTClient.cpp:294: undefined reference to `MySensor::loadState(unsigned char)' MyMQTTClient.cpp:300: undefined reference to `MySensor::sendRoute(MyMessage&)' MyMQTTClient.cpp.o: In function `MyMQTTClient::processMQTTMessage(char*, unsigned char*, unsigned int)': MyMQTTClient.cpp:246: undefined reference to `MySensor::sendRoute(MyMessage&)' MyMQTTClient.cpp.o: In function `MyMQTTClient::processRadioMessage()': MyMQTTClient.cpp:176: undefined reference to `MySensor::process()' MyMQTTClient.cpp:179: undefined reference to `MySensor::getLastMessage()' MyMQTTClient.cpp.o: In function `MyMQTTClient::begin(rf24_pa_dbm_e, unsigned char, rf24_datarate_e, unsigned char, unsigned char, unsigned char)': MyMQTTClient.cpp:147: undefined reference to `MySensor::setupRepeaterMode()' MyMQTTClient.cpp:153: undefined reference to `MySensor::setupRadio(rf24_pa_dbm_e, unsigned char, rf24_datarate_e)' MyMQTTClient.cpp.o: In function `MyMQTTClient': MyMQTTClient.cpp:107: undefined reference to `MySensor::MySensor(unsigned char, unsigned char)' -
I'm pretty far from my computer today and tomorrow,but I'll check.
I have the latest IDE at least.Meanwhile perhaps @ntruchsess himself can help? :)
-
Last night I downloaded whole https://github.com/ntruchsess/MySensors/tree/mqttclient branch and tried to compile it - I got errors that ntruchsess supposed to fix in this branch (https://github.com/knolleary/pubsubclient/pull/47). Which is weird, I suspect some problems with my IDE... I will look into this today.
-
I use the latest 1.0.6 IDE on Win7 and loaded the latest MySensor libraries
https://github.com/mysensors/Arduino/
Added the attached libraries and they compiled just fine for me...MyMQTTGateway.zip
Note1: Included is MyMQTTGateway and Pubsubclient.Note2: This will make the gateway act as a MQTT client so you need Mosquitto (or similar) where you publish the topics from the gateway.
Note3: Remember to change the IP and Mac.
-
@gadu - thank you very much!
In the meanwhile I managed to compile on @ntruchsess code. I got past compiler error and also I noticed that my baund rater for serial monitor was incorrect (so I couldn't see anything usefull). Anyway I got this:
0;0;3;0;9;check wires
On all controllers: MQTTGateway, Ethernet gateway, Serial... I checked those wires many times, even I switched the radio. No luck. Then I noticed that I bought NRF24L01 - the verison withot + at the and. It should be NRF24L01+
Does it matter? I found that NRF24L01+ it differs only slightly from NRF24L01 version but I think that might be the casue. Anyone had such experience? It's hard to search for it on the forum since everyone is writing about NRF24L01+ only...
-
@gadu - thank you very much!
In the meanwhile I managed to compile on @ntruchsess code. I got past compiler error and also I noticed that my baund rater for serial monitor was incorrect (so I couldn't see anything usefull). Anyway I got this:
0;0;3;0;9;check wires
On all controllers: MQTTGateway, Ethernet gateway, Serial... I checked those wires many times, even I switched the radio. No luck. Then I noticed that I bought NRF24L01 - the verison withot + at the and. It should be NRF24L01+
Does it matter? I found that NRF24L01+ it differs only slightly from NRF24L01 version but I think that might be the casue. Anyone had such experience? It's hard to search for it on the forum since everyone is writing about NRF24L01+ only...
@cayco
Yes, the non-plus variant is pretty useless. You can make it work (select 1MBPS instead of 250 kbps), but the price you have to pay is the distance you can maintain between sensor nodes, repeater(s) and gateway.
I personally invested many hours to get it working, but was very disappointed with the distance.
I bought new radio's (nrf24l01+) and found out that I wasted my time 😔Succes!
Boozz
-
I also managed to get it working! Besides non '+' radio I did not have SoftSPI enabled. I thought that I do not need it since I have a Ethernet Shield version. After enabling MQTT Gateway and MQTT ClientGateway started.
Now it's time for some soldering to make a client :)
-
When I try your files I get this error when compiling...
Any ideas? I'm using the Arduino 1.6.3 application.
In file included from C:\Users\Tommy\Documents\Arduino\libraries\MyMQTTClient/MyMQTTClient.h:16:0,
from MyMQTTClient.ino:46:
C:\Users\Tommy\Documents\Arduino\libraries\MyMQTTClient/PubSubClient.h:72:46: error: section attribute not allowed for '<anonymous>'
boolean publish_P(char *, uint8_t PROGMEM *, unsigned int, boolean); -
@TommySharp
Hmm dont really remember, but I think this was the solution
https://github.com/knolleary/pubsubclient/issues/46