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. Development
  3. JSON payload in MQTT message

JSON payload in MQTT message

Scheduled Pinned Locked Moved Development
9 Posts 3 Posters 3.2k Views 3 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.
  • jjkJ Offline
    jjkJ Offline
    jjk
    wrote on last edited by
    #1

    Hi there, hope someone can point e in the right direction with this. I'd like to modify the mqtt client in a way that it posts json payloads containing the sensor id and possibly other information in the message. Where and how would I go for this?
    Thanks, jjk

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      You could modify the protocol file found here:

      https://github.com/mysensors/MySensors/blob/development/core/MyProtocolMySensors.cpp

      1 Reply Last reply
      0
      • jjkJ Offline
        jjkJ Offline
        jjk
        wrote on last edited by
        #3

        thanks for the lead, I will check into that!

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

          Do you mind if I ask what are you trying to do? I'm just curious 😀

          1 Reply Last reply
          1
          • jjkJ Offline
            jjkJ Offline
            jjk
            wrote on last edited by
            #5

            I don't mind at all ;)
            The idea is to post the sensor data to an uninformed controller/service, possibly web-based. Currently, the service would need to know what sensors are available and subscribe to the corresponding mqtt topics to get the sensor value as the message. I'd like it to simply subscribe to the top-level mystt topic and get all necessary information (like sensor id etc. ) in the actual message. There might be other ways to do this, I'm just experimenting and using a json container seems like a clean solution.

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

              Maybe you could take a look at how they implemented the mysensors mqtt plugin in other controllers without reinventing the wheel :)

              1 Reply Last reply
              0
              • jjkJ Offline
                jjkJ Offline
                jjk
                wrote on last edited by
                #7

                no intention to reinvent anything that is proven and works ;) If you could kindly point me in the right direction for an example, I am more than happy to rely on what's available!

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

                  Have you already looked at github? https://github.com/search?utf8=✓&q=mysensors+plugin

                  1 Reply Last reply
                  0
                  • jjkJ Offline
                    jjkJ Offline
                    jjk
                    wrote on last edited by
                    #9

                    I have not, but will now ;) thanks!

                    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