Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. MQTT Client Gateway / Node Controller / OTA

MQTT Client Gateway / Node Controller / OTA

Scheduled Pinned Locked Moved Hardware
otamqtt
50 Posts 9 Posters 14.3k Views 10 Watching
  • 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.
  • maghacM maghac

    @Samuel235 Great news! How does your final setup look like - how did you configure MyController? And what is the steps to follow when publishing an OTA update to the nodes?

    Maybe the reboot issue can be solved by manually sending a message to the node to reboot it? Assuming there is such a functionality in the protocol of course.

    S Offline
    S Offline
    Samuel235
    Hardware Contributor
    wrote on last edited by
    #40

    @maghac - I have been speaking to a couple of people, one of which is Jkandasa himself, to my understanding, using MYSBootloader does not enable us to issue a firmware update and then to automatically reboot itself. However, as you suggested, there is a reboot option in MyController. As far as I understand (I may be slightly wrong here, but i don't think i am) every time a MYSBootloader enabled node boots up, it asks MyController if there is a firmware update for it (is there a linked firmware to me that i do not have?) and if so, it goes ahead and downloads it.

    I'm happy to confirm i have this all working now.

    A vague outline of what we have to do:

    • Install MyController.
    • Edit the conf files (On linux its: <MYCONTROLLER INSTALL LOCATION>/conf/mycontroller.properties) to change the port that it uses from 8443 to anything you wish, i have set mine to 9443 and save the changes to that conf file.
      issue the start command inside of the /bin folder and then use your browser to go to https://<IPOFMYCONTROLLERMACHINE>:<PORTNUMBER> then you should be greeted with the login page for your mycontroller install.
    • log in with admin and admin (change these).
    • Navigate to the Settings>MQTT Broker page and disable the MQTT broker functionality.
    • Navigate to Resources>Gateway and then click Add gateway. This is where you enter the MQTT settings to enable MyController to find your gateway and nodes.
    • Give the gateway a name, then select the MySensors type and MQTT. Add your details here for the MQTT server.
    • Once added, you can select your gateway and in the drop down menu (top right above the list of gateways) you can select discovery, this should automatically discover your nodes.

    To send a new firmware to the node, follow the guide on MySensors to create the hex file. then follow the section related to firmware on the user guide of MyController. Once you have saved a new firmware, you then go into the nodes list and associate that node with the new firmware by editing the settings on that node and there should be a firmware box that your able to drop down and select an uploaded firmware. Then you can select the node and issue a reboot from the drop down at the top right of the list of nodes. The version control of the firmware files that you upload is really awesome! I must thank @jkandasa for that!

    If you have any issues at all, please ask more questions here, i'm willing to help. I may even write a little more in-depth guide for others to use. That way we can always link people to this thread for the information to do such.

    I have a few little bits of config left to do in terms of security of the server and then i'm all set.

    MySensors 2.1.1
    Controller - OpenHAB (Virtual Machine)
    Gateway - Arduino Mega MQTT Gateway W5100

    rozpruwaczR P 2 Replies Last reply
    2
    • maghacM Offline
      maghacM Offline
      maghac
      wrote on last edited by maghac
      #41

      Wow, I was actually able to get this to work now. Like you I also noticed that the nodes do not reboot automatically, but since you can execute a reboot from the MyController UI, it's not such a big problem. I also learnt that you need to use smartSleep() rather than sleep() in your sketch, otherwise the node won't process the incoming reboot request.

      It also takes a while for the firmware to upload, but that's OK. Still saves a lot of time compared to manually uploading new sketches.

      Next step is to try this on some "real" battery-operated nodes. Currently I'm only testing it on one test node which doesn't do anything except blink the LED.

      S 1 Reply Last reply
      0
      • maghacM maghac

        Wow, I was actually able to get this to work now. Like you I also noticed that the nodes do not reboot automatically, but since you can execute a reboot from the MyController UI, it's not such a big problem. I also learnt that you need to use smartSleep() rather than sleep() in your sketch, otherwise the node won't process the incoming reboot request.

        It also takes a while for the firmware to upload, but that's OK. Still saves a lot of time compared to manually uploading new sketches.

        Next step is to try this on some "real" battery-operated nodes. Currently I'm only testing it on one test node which doesn't do anything except blink the LED.

        S Offline
        S Offline
        Samuel235
        Hardware Contributor
        wrote on last edited by
        #42

        @maghac - yeah, i read about that smartsleep() function. I'm really glad that you managed to get this to work dude! I don't care how long the firmware takes to upload, as long as i know its doing it, and i monitor my MQTT server broker for this. Its not about saving time for me, its about the fact i couldn't get to some nodes that are in the ceiling, so this just saves literally having to rip floors up or lights down. Its awesome!

        I'm yet to install it on any nodes in practical uses yet. But my latest board is running it and soon as tests have finished, i will be sure to use it in full time production.

        MySensors 2.1.1
        Controller - OpenHAB (Virtual Machine)
        Gateway - Arduino Mega MQTT Gateway W5100

        1 Reply Last reply
        0
        • S Samuel235

          @maghac - I have been speaking to a couple of people, one of which is Jkandasa himself, to my understanding, using MYSBootloader does not enable us to issue a firmware update and then to automatically reboot itself. However, as you suggested, there is a reboot option in MyController. As far as I understand (I may be slightly wrong here, but i don't think i am) every time a MYSBootloader enabled node boots up, it asks MyController if there is a firmware update for it (is there a linked firmware to me that i do not have?) and if so, it goes ahead and downloads it.

          I'm happy to confirm i have this all working now.

          A vague outline of what we have to do:

          • Install MyController.
          • Edit the conf files (On linux its: <MYCONTROLLER INSTALL LOCATION>/conf/mycontroller.properties) to change the port that it uses from 8443 to anything you wish, i have set mine to 9443 and save the changes to that conf file.
            issue the start command inside of the /bin folder and then use your browser to go to https://<IPOFMYCONTROLLERMACHINE>:<PORTNUMBER> then you should be greeted with the login page for your mycontroller install.
          • log in with admin and admin (change these).
          • Navigate to the Settings>MQTT Broker page and disable the MQTT broker functionality.
          • Navigate to Resources>Gateway and then click Add gateway. This is where you enter the MQTT settings to enable MyController to find your gateway and nodes.
          • Give the gateway a name, then select the MySensors type and MQTT. Add your details here for the MQTT server.
          • Once added, you can select your gateway and in the drop down menu (top right above the list of gateways) you can select discovery, this should automatically discover your nodes.

          To send a new firmware to the node, follow the guide on MySensors to create the hex file. then follow the section related to firmware on the user guide of MyController. Once you have saved a new firmware, you then go into the nodes list and associate that node with the new firmware by editing the settings on that node and there should be a firmware box that your able to drop down and select an uploaded firmware. Then you can select the node and issue a reboot from the drop down at the top right of the list of nodes. The version control of the firmware files that you upload is really awesome! I must thank @jkandasa for that!

          If you have any issues at all, please ask more questions here, i'm willing to help. I may even write a little more in-depth guide for others to use. That way we can always link people to this thread for the information to do such.

          I have a few little bits of config left to do in terms of security of the server and then i'm all set.

          rozpruwaczR Offline
          rozpruwaczR Offline
          rozpruwacz
          wrote on last edited by
          #43

          @Samuel235 great stuff ! :P Worked like a charm :) one question, when using with dualoptiboot, how to check if firmware upload is done ? now I have to stop the gateway and run it in debug mode, then i can see all the messages. In MYSController there is log with all the messages, is there any such log in the MyController ?

          1 Reply Last reply
          0
          • S Samuel235

            @maghac - I have been speaking to a couple of people, one of which is Jkandasa himself, to my understanding, using MYSBootloader does not enable us to issue a firmware update and then to automatically reboot itself. However, as you suggested, there is a reboot option in MyController. As far as I understand (I may be slightly wrong here, but i don't think i am) every time a MYSBootloader enabled node boots up, it asks MyController if there is a firmware update for it (is there a linked firmware to me that i do not have?) and if so, it goes ahead and downloads it.

            I'm happy to confirm i have this all working now.

            A vague outline of what we have to do:

            • Install MyController.
            • Edit the conf files (On linux its: <MYCONTROLLER INSTALL LOCATION>/conf/mycontroller.properties) to change the port that it uses from 8443 to anything you wish, i have set mine to 9443 and save the changes to that conf file.
              issue the start command inside of the /bin folder and then use your browser to go to https://<IPOFMYCONTROLLERMACHINE>:<PORTNUMBER> then you should be greeted with the login page for your mycontroller install.
            • log in with admin and admin (change these).
            • Navigate to the Settings>MQTT Broker page and disable the MQTT broker functionality.
            • Navigate to Resources>Gateway and then click Add gateway. This is where you enter the MQTT settings to enable MyController to find your gateway and nodes.
            • Give the gateway a name, then select the MySensors type and MQTT. Add your details here for the MQTT server.
            • Once added, you can select your gateway and in the drop down menu (top right above the list of gateways) you can select discovery, this should automatically discover your nodes.

            To send a new firmware to the node, follow the guide on MySensors to create the hex file. then follow the section related to firmware on the user guide of MyController. Once you have saved a new firmware, you then go into the nodes list and associate that node with the new firmware by editing the settings on that node and there should be a firmware box that your able to drop down and select an uploaded firmware. Then you can select the node and issue a reboot from the drop down at the top right of the list of nodes. The version control of the firmware files that you upload is really awesome! I must thank @jkandasa for that!

            If you have any issues at all, please ask more questions here, i'm willing to help. I may even write a little more in-depth guide for others to use. That way we can always link people to this thread for the information to do such.

            I have a few little bits of config left to do in terms of security of the server and then i'm all set.

            P Offline
            P Offline
            p359
            wrote on last edited by
            #44

            @Samuel235 thanks for listing your steps. I cannot get my laptop to link to mqtt on pi gateway. Do you have to have mycontroller on the pi? I have all working on laptop, can log in and disable inbuilt mqtt broker, just unable to connect to mosquitto on pi. I use tcp://(ip of pi):1883 Thankyou for any help!

            1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #45

              Are you sure mosquitto is running? What conf are you using for it?

              P 1 Reply Last reply
              0
              • gohanG gohan

                Are you sure mosquitto is running? What conf are you using for it?

                P Offline
                P Offline
                p359
                wrote on last edited by
                #46

                @gohan Hi. I'll say tentative yes, all mysensors coms from nodes go through mosquitto to domoticz via pi gateway. Ready to be told otherwise if config needed? Cheers

                P 1 Reply Last reply
                0
                • P p359

                  @gohan Hi. I'll say tentative yes, all mysensors coms from nodes go through mosquitto to domoticz via pi gateway. Ready to be told otherwise if config needed? Cheers

                  P Offline
                  P Offline
                  p359
                  wrote on last edited by
                  #47

                  Progress report. Looks like config issue. On mosquitto config, if I comment out

                  "Binding 127.0.0.1"

                  Then can connect via laptop to mosquitto via mycontroller. Issue then is mysensor gateway fails and can't see nodes or data haha.

                  Will have to put my controller onto pi unless some other way to bind?

                  1 Reply Last reply
                  0
                  • gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #48

                    Comment that line in the conf file and try again, as that allows connections only from the local host and not from the network

                    P 1 Reply Last reply
                    0
                    • gohanG gohan

                      Comment that line in the conf file and try again, as that allows connections only from the local host and not from the network

                      P Offline
                      P Offline
                      p359
                      wrote on last edited by
                      #49

                      @gohan sorry, my post not so clear. I comment this out as you suggest then mysensor nodes stop reporting in to gateway.

                      1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #50

                        can you login to the mqtt server with any mqtt client for computer (like mqtt spy or similar)?

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        14

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.0k

                        Posts


                        Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular