MQTT sample setup on ESP8266
-
@ragflyer Current SNAPSHOT build needs ESP driver update from here
-
@jkandasa OK, how do you change the node config once it is saved? Uploading the sketch does not set it back to AP mode
-
@ragflyer said:
OK, how do you change the node config once it is saved? Uploading the sketch does not set it back to AP mode
Node config will be stored on EEPROM. When you update firmware. No need to change node config. However when you want to change node config, just trigger
Erase configuration
from GUI (Resources >> Nodes >> Select your node >> Erase configuration
). Now you will get AP on the name/ssid of ESP device and configuration url http://192.168.4.1 -
Nice it works, thanks for pointing this out!
Few more things that might be helpful for newcomers:
-
If you misconfigured so far that no connection to MyController is possible, the above "Erase configuration" obviously won't work. Load the example sketch for eeprom_clear and upload it, then upload your MyControllerDevice sketch again, connect to the ESP SSID and rerun configuration at http://192.168.4.1
-
Feed ID will not take more than 6 characters
-
You cannot set up a second gateway at say :1884 if you configured the broker to run at :1883. But it seems to be ok to define several Gateways with different topics on the same port (so you don't have to migrate existing nodes to another topic now).
-
-
@ragflyer said:
Few more things that might be helpful for newcomers:
Thanks for the nice points!!
If you misconfigured so far that no connection to MyController is possible, the above "Erase configuration" obviously won't work. Load the example sketch for eeprom_clear and upload it, then upload your MyControllerDevice sketch again, connect to the ESP SSID and rerun configuration at http://192.168.4.1
Yes, We have to configure a PIN on ESP8266 to do force reset from device side. We have an option for this, actual code is here. But I never tested.
Feed ID will not take more than 6 characters
Yes, This is limitation, to limit topic length.
You cannot set up a second gateway at say :1884 if you configured the broker to run at :1883. But it seems to be ok to define several Gateways with different topics on the same port (so you don't have to migrate existing nodes to another topic now).
But for ESP8266 device you no need to configure more than one gateway. You can use same feed id across on all devices. MyController specific protocol born to support all the ESP devices from single gateway.
-
I have been using this set up with 5 esp8266 sensors from https://www.wemos.cc/. Tested even the update firmware OTA. working great.
Just remember to Change MQTT_MAX_PACKET_SIZE to 512 bytes on PubSubClient.h to allow for OTA
-
@paul Hi Paul, can you share you code, I am having problems with the Wemos D1 Mini boards, and also would like some inspiration to my code. Thanks!
-
Hello,
I also use ESP8266 (ESP07 & ESP12F & WEMO)Now i tried to send MQTT with MQTTBOX to see what happened .... arhh nothing
Have you any fully list of MQTT order to easy way write my arduino sample ?
Thanks
Best regards
-
Another thing , Should i have a MQTT Password ?
Because i use MQTT with another gateway (Domoticz) , i would like to keep it in this way.
Thanks. -
@Stephan35 MQTT password is optional.
Right now MyController gives direct support for ESP devices. you can have a look on https://github.com/mycontroller-org/MyControllerDevice -
Hello, i send an issue on GitHub,
ESP does not take good AP , take old one. ...thanks
-
@Stephan35 Hope issue addressed on GitHub
-
Right, Now two other things ...
First i try autodetect MQTT server, but failed .Now ESP disapear from wifi, so i can't access to ESP .
So, is there any special parameter to set MQTT as autodiscover ?
How can i change ESP parameter, i tried to flash it again, but keep parameter in memory.
thanks
- esp reset after one hour of waiting ... lost memory ?
C[I]: Configuration(NodeEUI:[ESP_8C0125], Mqtt{mDNS-status:[1], Server:[0.0.0.0], Port:[0], FeedId:[esp], User:[]})
MC[I]: MQTT settings(Broker:[0.0.0.0], Port:[0])
MC[I]: MQTT authenticating as anonymous
MC[I]: MQTT connection failed, rc=-2
MC[I]: MQTT failed! Retryting to connect...
MC[I]: Sending mDNS query[_mc_mqtt._tcp]...
Skipping compressed pointerSoft WDT reset
ctx: sys
sp: 3ffffa60 end: 3fffffb0 offset: 01b0stack>>>
3ffffc10: 402079e1 3ffffe20 3fff01c0 402079d6
3ffffc20: 61636f6c a48a006c 58540d4b 43076fd5
3ffffc30: 68965955 4e5f233f 58a15990 8cecc38a
3ffffc40: 36deb08a bd6b9bdb 358e7912 cbe029c8
3ffffc50: 1d343e93 7d7369fe 0896a8c6 4a9ff10c
3ffffc60: 863b39b9 6ff1395e 7f7e23b7 32d5f369
3ffffc70: e209547c 6d3c8869 38895b9a 912fb242
3ffffc80: 00000005 00000000 00000020 40101d0e
3ffffc90: 3ffe9e25 40104feb 3ffed8b0 ffffffff
3ffffca0: 40102a21 3ffed8b0 00000008 05b7eda3
3ffffcb0: 00000017 3f7c5564 3ffee29c 40102bb0
3ffffcc0: 3ffea6d0 00000000 00000000 3ffedf70
3ffffcd0: 00000000 3f7c5564 40102fee 00000100
3ffffce0: 7fffffff 3ffea6d0 3ffea6d0 00000001
3ffffcf0: 00000001 401041df 3ffedfa0 00000000
3ffffd00: 40104642 3f7c5564 00000000 4000050c
3ffffd10: 3fffc278 40102d88 3fffc200 c0000022
3ffffd20: 7674780c 3d737265 70720c31 7070693d
3ffffd30: 6972702f 6e05746e 3d65746f 6f747108
3ffffd40: 3d6c6174 72700b31 69726f69 313d7974
3ffffd50: 79741635 6e61433d 4d206e6f 30353347
3ffffd60: 65732030 73656972 6f72701d 74637564
3ffffd70: 6143283d 206e6f6e 3533474d 73203030
3ffffd80: 65697265 70312973 613d6c64 696c7070
3ffffd90: 69746163 6f2f6e6f 74657463 7274732d
3ffffda0: 2c6d6165 67616d69 72752f65 6d692c66
3ffffdb0: 2f656761 6765706a 6d646137 72756e69
3ffffdc0: 74683d6c 2f3a7074 3732342f 30324543
3ffffdd0: 30303030 6f6c2e30 2e6c6163 646e692f
3ffffde0: 682e7865 3f6c6d74 45474150 5041415f
3ffffdf0: 6273750d 47464d5f 6e61433d 75156e6f
3ffffe00: 4d5f6273 4d3d4c44 30353347 65732030
3ffffe10: 73656972 6273750b 444d435f 4652553d
3ffffe20: 49555529 30303d44 30303030 302d3030
3ffffe30: 2d303030 30303031 3030382d 32342d30
3ffffe40: 32454337 30303030 55003030 563d4652
3ffffe50: 2c332e31 2c315043 2d345150 53522c35
3ffffe60: 2c303036 42475253 a8c03432 424f0c0a
3ffffe70: 464f2c32 00000001 00000277 0000fffe
3ffffe80: 0000000c 4408543d 656c7075 06543d78
3ffffe90: 6e616353 4605543d 463d7861 70615011
3ffffea0: 614d7265 656c3d78 2d6c6167 6b1c3441
3ffffeb0: 3d646e69 75636f64 746e656d 766e652c
3ffffec0: 706f6c65 68702c65 156f746f 3d63616d
3ffffed0: 313a3036 42383a32 3a32343a 453a4337
3ffffee0: 00001432 00000000 3ffead68 3fff1c54
3ffffef0: 000000e0 3fffdc80 3fff2194 401074a0
3fffff00: 40220000 00000000 3ffeba21 3fff1c50
3fffff10: 3ffead68 3fff1c54 3fff1ce4 4022e70c
3fffff20: 00000002 3fff2114 3fff2114 3ffee9d0
3fffff30: 00000000 3fff1ce4 0000001c 3fff2114
3fffff40: 3ffead5a 00000000 3fff1ce4 4022db15
3fffff50: 0c0aa8c0 000002a8 00000000 0000003b
3fffff60: 00000002 00000018 4020e23b 3ffed888
3fffff70: 3ffead34 3fffdcc0 3ffe9ee0 3ffe9ee0
3fffff80: 4020e1ae 3ffed888 00000000 3fff219c
3fffff90: 3fffdc80 00000000 3fff1ce4 402224a7
3fffffa0: 40000f49 3fffdab0 3fffdab0 40000f49
<<<stack<<<ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
-
Tried this :
#define FACTORY_RESET_PIN 4
#define FACTORY_RESET_PIN_STATE 4
#define FACTORY_RESET_TIME 1000*1 //hold the button 9 secondsNo success , still no AP .
-
Again me ,
Is it possible to test MQTT to mycontroller without ESP ?
Can you give me, please, some MQTT order example to understand what is wrong.
MQTT works fine , made some test with domoticz implemented on the same server.
Thanks. -
@Stephan35 said:
First i try autodetect MQTT server, but failed .
On MyController server your have to enable
mcc.mdns.service.enable=true
on mycontroller.properties and stop and start.#define FACTORY_RESET_PIN 4
#define FACTORY_RESET_PIN_STATE 4
#define FACTORY_RESET_TIME 1000*1 //hold the button 9 secondsNo success , still no AP .
FACTORY_RESET_PIN_STATE
should be either0
or1
. When you press the button, If your pin(FACTORY_RESET_PIN
) connects onGND
, Then you have to enter0
, otherwise1
.MC[I]: Sending mDNS query[_mc_mqtt._tcp]...
Skipping compressed pointerYes, Sometimes I see this error when we use mDNS enabled on ESP device. This error happens on mDNS library.
-
These lines missing at the end of mycrontroller.properties files , very strange :
mcc.clear.message.queue.on.start=true
mcc.clear.smart.sleep.msg.queue.on.start=true#========================================================================
MyController mDNS service settings
Enable or disable mDNS service
#========================================================================
mcc.mdns.service.enable=trueAnyway, now ESP is connected to my home wireless , i forced ip of mqtt, because discover does not work correctly, and , i dont see anything with mqtt.
So i decided to fully reinstall mycontroller , to understand where i am wrong .
-
Ok now i installed lasted git version.
Here is screen shot :
Gateway
And arduino usb debug
Esp is configured as mentionned at AP Setting
Now, what next ?
MyController seem to be interesting, but, very hard to get it work ... for me .
Is there somewhere any video ? to explain how it work with example and sample.
Thanks
-
Now, what next ?
You can use your ESP as a node and can fun with your sensors with monitor, reports, and actions...
MyController seem to be interesting, but, very hard to get it work ... for me .
Is there somewhere any video ? to explain how it work with example and sample.I am sorry for this. Right now we do not have any videos. I will update a video when I get time. Thank you for your valuable feedback.
-
Thank for your support.
You can use your ESP as a node and can fun with your sensors with monitor, reports, and actions...
I am very sad : nothing appear in node and sensor.
So i was completly wrong about thinking autodiscover node with MQTT ?
I have to add manually all node and sensors ?
Or my arduino sketch does not contain good command to put it in mycontroller ?Thanks
Best regards