• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    MQTT sample setup on ESP8266

    Scheduled Pinned Locked Moved MyControllerDevice (ESP8266)
    29 Posts 5 Posters 24.8k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jkandasaJ Offline
      jkandasa @Stephan35
      last edited by

      @Stephan35 Hope issue addressed on GitHub

      1 Reply Last reply Reply Quote 0
      • Stephan35S Offline
        Stephan35
        last edited by Stephan35

        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 pointer

        Soft WDT reset

        ctx: sys
        sp: 3ffffa60 end: 3fffffb0 offset: 01b0

        stack>>>
        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

        jkandasaJ 1 Reply Last reply Reply Quote 0
        • Stephan35S Offline
          Stephan35
          last edited by

          Tried this :

          #define FACTORY_RESET_PIN 4
          #define FACTORY_RESET_PIN_STATE 4
          #define FACTORY_RESET_TIME 1000*1 //hold the button 9 seconds

          No success , still no AP .

          1 Reply Last reply Reply Quote 0
          • Stephan35S Offline
            Stephan35
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • jkandasaJ Offline
              jkandasa @Stephan35
              last edited by

              @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 seconds

              No success , still no AP .

              FACTORY_RESET_PIN_STATE should be either 0 or 1. When you press the button, If your pin(FACTORY_RESET_PIN) connects on GND, Then you have to enter 0, otherwise 1.

              MC[I]: Sending mDNS query[_mc_mqtt._tcp]...
              Skipping compressed pointer

              Yes, Sometimes I see this error when we use mDNS enabled on ESP device. This error happens on mDNS library.

              1 Reply Last reply Reply Quote 0
              • Stephan35S Offline
                Stephan35
                last edited by

                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=true

                Anyway, 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 .

                1 Reply Last reply Reply Quote 0
                • Stephan35S Offline
                  Stephan35
                  last edited by

                  Ok now i installed lasted git version.

                  Here is screen shot :

                  0_1487365886889_Capture d’écran_2017-02-17_22-08-55.png

                  Gateway

                  0_1487365900097_Capture d’écran_2017-02-17_22-08-29.png

                  And arduino usb debug
                  0_1487365868189_Capture d’écran_2017-02-17_22-10-26.png

                  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

                  jkandasaJ 1 Reply Last reply Reply Quote 0
                  • jkandasaJ Offline
                    jkandasa @Stephan35
                    last edited by

                    @Stephan35

                    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.

                    1 Reply Last reply Reply Quote 0
                    • Stephan35S Offline
                      Stephan35
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • Stephan35S Offline
                        Stephan35
                        last edited by

                        Hello,
                        Me again .
                        So now esp seem to send data to mqtt , here is usb logger :

                        0_1487718035316_Capture d’écran_2017-02-22_00-00-26.png

                        If i correctly understand, ESP_8C0125 connect to broker and subscribe to in_esp/ESP_8c0125
                        [in_esp/ESP_8C0125/#]

                        Ok , here is mqtt box sniffer :
                        0_1487718204528_Capture d’écran_2017-02-22_00-03-14.png

                        etc
                        etc
                        etc

                        MyController does not see anything ... Arrghhh , going to be mad !!! 😡

                        ID Client have to set to esp_client , but esp client is ESP_8C0125 ?
                        If changed ti ESP_8C0125, failed connect ...

                        inverting in_esp and out_esp does not change anything ?

                        0_1487718404870_Capture d’écran_2017-02-22_00-06-29.png

                        Can you drive me please to get it work ..... 😞

                        Thanks

                        jkandasaJ 1 Reply Last reply Reply Quote 0
                        • jkandasaJ Offline
                          jkandasa @Stephan35
                          last edited by

                          @Stephan35 Sorry for the inconvenience caused.

                          I see you have selected MySensors as a network type. Which is wrong. You have to select MyController as network type if you use https://github.com/mycontroller-org/MyControllerDevice
                          I believe you are using built in MQTT broker. What is your MyController local IP? Is it 192.168.0.25?

                          Here is screenshot from my setup,
                          0_1487750138920_upload-b9ad5e29-a9a3-473c-a23a-6a6f72f0df83

                          • in_esp >> feed data to ESP devices
                          • out_esp >> data from ESP devices
                          1 Reply Last reply Reply Quote 0
                          • Stephan35S Offline
                            Stephan35
                            last edited by Stephan35

                            Ok,

                            What is your MyController local IP? Is it 192.168.0.25?

                            Yes MyController local IP is 192.168.0.25 (depending of wich router is connected to)

                            believe you are using built in MQTT broker.

                            What do you mean by using built in MQTT broker ? this one : First image of this post

                            Because i have installed mosquitto also , do MyController have it self mqtt broker ?
                            AND SHOULD IT WORK ALONE ???
                            I guess my big mistake was there ... 😇

                            Also , I have so solve install from github to get last version as your .

                            Thanks again for support 👍

                            jkandasaJ 1 Reply Last reply Reply Quote 0
                            • jkandasaJ Offline
                              jkandasa @Stephan35
                              last edited by

                              @Stephan35

                              What do you mean by using built in MQTT broker ? this one : First image of this post
                              Because i have installed mosquitto also , do MyController have it self mqtt broker ?
                              AND SHOULD IT WORK ALONE ???

                              Yes, MyController has built in broker. No need to install any external brokers like mosquitto. If you want to use an external broker. Kindly disable internal (inbuilt) broker first.

                              Also , I have so solve install from github to get last version as your .

                              You can download most recent version from here.

                              From your post picture, I see you have selected MySensors as a network. Which is wrong. Select MyController as a network type.

                              1 Reply Last reply Reply Quote 0
                              • Stephan35S Offline
                                Stephan35
                                last edited by

                                Here is some good news !!!

                                First after getting update from github , here is some screen shot from GUI

                                0_1487795384107_Capture d’écran_2017-02-22_21-29-34.png

                                We can see that MyController is in the list !

                                Also, Esp send correctly data to mosquitto (which i use by default)

                                0_1487795639762_Capture d’écran_2017-02-22_21-33-47.png

                                0_1487795522154_Capture d’écran_2017-02-22_21-31-14.png

                                Now , i have to test and learn to send data , like temperature or lighmeter .

                                Thank you for your time and your support.

                                😆

                                1 Reply Last reply Reply Quote 2
                                • First post
                                  Last post

                                0

                                Online

                                590

                                Users

                                529

                                Topics

                                3.4k

                                Posts
                                Copyright © 2015-2025 MyController.org | Contributors | Localization