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. General Discussion
  3. How to get sensor data into influxdb?

How to get sensor data into influxdb?

Scheduled Pinned Locked Moved General Discussion
databasetimeinfluxdb
7 Posts 2 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.
  • MaKinM Offline
    MaKinM Offline
    MaKin
    wrote on last edited by
    #1

    Hey guys,

    I am running several sensors (mysensors) and would like to push them into an influxDB instance in order to visualize it with Grafana.

    Influxdb and Grafana are already running on my Pi3 but I'm not sure what is the most elegant and easy way to push the data into the database.

    Any hint is appreciated. :-)

    YveauxY 1 Reply Last reply
    0
    • MaKinM MaKin

      Hey guys,

      I am running several sensors (mysensors) and would like to push them into an influxDB instance in order to visualize it with Grafana.

      Influxdb and Grafana are already running on my Pi3 but I'm not sure what is the most elegant and easy way to push the data into the database.

      Any hint is appreciated. :-)

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #2

      @MaKin I'm running an MQTT gateway and use Node-Red to glue things together:

      0_1495733276194_upload-44c705c1-bdd5-462f-9746-2c5fa8995e03

      Node-Red subscribes to some relevant MQTT topics. As data comes in it can be formatted or whatever is required; the RBE blocks make sure only changes in values are recorded.
      Then a query is created and depending on the MQTT topic the measurement is set and stored in an InfluxDB database.
      This is just one way to organize stuff, but I find it very flexible and powerful!

      If you like, I can post the 'code' behind the flow in the picture above, which can directly be imported in Node-Red.

      http://yveaux.blogspot.nl

      1 Reply Last reply
      1
      • MaKinM Offline
        MaKinM Offline
        MaKin
        wrote on last edited by
        #3

        Thanks a lot and yes please, that'd be very helpful!

        YveauxY 1 Reply Last reply
        0
        • MaKinM MaKin

          Thanks a lot and yes please, that'd be very helpful!

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #4

          @MaKin Here you go:

          [{"id":"da963db0.0867b","type":"debug","z":"2f969f93.19b74","name":"","active":true,"console":"false","complete":"true","x":1329.2905349731445,"y":185.33306121826172,"wires":[]},{"id":"b83858ac.4ac2e8","type":"influxdb out","z":"2f969f93.19b74","influxdb":"3f3f1a0f.6ffe36","name":"","measurement":"","x":1367.6238708496094,"y":128.66622734069824,"wires":[]},{"id":"1ed7a7f.80dd758","type":"switch","z":"2f969f93.19b74","name":"","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"/0/1/0/0$","vt":"str","case":false},{"t":"regex","v":"0/1/0/1$","vt":"str","case":false},{"t":"regex","v":"6/1/0/4$","vt":"str","case":false},{"t":"regex","v":"/255/3/0/0$","vt":"str","case":false},{"t":"regex","v":"/7/1/0/24$","vt":"str","case":false},{"t":"regex","v":"/7/1/0/25$","vt":"str","case":false},{"t":"regex","v":"/7/1/0/26$","vt":"str","case":false}],"checkall":"true","outputs":7,"x":802.123908996582,"y":139.33292198181152,"wires":[["801cd988.7e82d8"],["c28e857e.6d6ed8"],["8354a90c.dcd808"],["60a92141.810fb"],["9b06911c.0fa8c"],["9dd58b0.4d51178"],["3c4b9e9c.e42232"]]},{"id":"801cd988.7e82d8","type":"change","z":"2f969f93.19b74","name":"temp","rules":[{"t":"set","p":"measurement","pt":"msg","to":"temp","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000.7904052734375,"y":44.666215896606445,"wires":[["6c56a47c.b486ec"]]},{"id":"c28e857e.6d6ed8","type":"change","z":"2f969f93.19b74","name":"hum","rules":[{"t":"set","p":"measurement","pt":"msg","to":"hum","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":998.2904052734375,"y":86.66621589660645,"wires":[["6c56a47c.b486ec"]]},{"id":"60a92141.810fb","type":"change","z":"2f969f93.19b74","name":"batt","rules":[{"t":"set","p":"measurement","pt":"msg","to":"batt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1001.29052734375,"y":179.33305549621582,"wires":[["6c56a47c.b486ec"]]},{"id":"ad56ce03.4ea93","type":"function","z":"2f969f93.19b74","name":"Format query","func":"msg.payload = [\n    [{\n        value: parseFloat(msg.payload),\n    },\n    {\n        location:\"capacitive_rain_gauge\",\n    }],\n];\nreturn msg;","outputs":1,"noerr":0,"x":634.9572448730469,"y":135.33306884765625,"wires":[["1ed7a7f.80dd758"]]},{"id":"62ada75b.f34ab8","type":"mqtt in","z":"2f969f93.19b74","name":"","topic":"mySensors/0/in/126/0/1/0/0","qos":"2","broker":"fb1ad45d.04e528","x":142.6240234375,"y":95.99990844726562,"wires":[["bdf94461.98ebc8"]]},{"id":"f3a6161b.ee8328","type":"mqtt in","z":"2f969f93.19b74","name":"","topic":"mySensors/0/in/126/0/1/0/1","qos":"2","broker":"fb1ad45d.04e528","x":138,"y":156.00001525878906,"wires":[["bf2405b6.04e9c8"]]},{"id":"23239f4b.0508f","type":"mqtt in","z":"2f969f93.19b74","name":"","topic":"mySensors/0/in/126/255/3/0/0","qos":"2","broker":"fb1ad45d.04e528","x":136.68701171875,"y":245.9999542236328,"wires":[["ee4b3125.b6179"]]},{"id":"bdf94461.98ebc8","type":"rbe","z":"2f969f93.19b74","name":"","func":"rbe","gap":"","x":452.6239929199219,"y":99.9998779296875,"wires":[["ad56ce03.4ea93"]]},{"id":"bf2405b6.04e9c8","type":"rbe","z":"2f969f93.19b74","name":"","func":"rbe","gap":"","x":448.2809753417969,"y":147.83416748046875,"wires":[["ad56ce03.4ea93"]]},{"id":"ee4b3125.b6179","type":"rbe","z":"2f969f93.19b74","name":"","func":"rbe","gap":"","x":453.6869812011719,"y":246.33282470703125,"wires":[["ad56ce03.4ea93"]]},{"id":"8354a90c.dcd808","type":"change","z":"2f969f93.19b74","name":"pres","rules":[{"t":"set","p":"measurement","pt":"msg","to":"pres","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":999.2905426025391,"y":129.33308601379395,"wires":[["6c56a47c.b486ec"]]},{"id":"d658a498.ae0158","type":"mqtt in","z":"2f969f93.19b74","name":"","topic":"mySensors/0/in/126/6/1/0/4","qos":"2","broker":"fb1ad45d.04e528","x":136.48825073242188,"y":197.4251708984375,"wires":[["8aebab69.e1b3f8"]]},{"id":"8aebab69.e1b3f8","type":"rbe","z":"2f969f93.19b74","name":"","func":"rbe","gap":"","x":461.5662536621094,"y":198.40170288085938,"wires":[["ad56ce03.4ea93"]]},{"id":"6b37c9c8.9da608","type":"mqtt in","z":"2f969f93.19b74","name":"","topic":"mySensors/0/in/126/7/1/0/+","qos":"2","broker":"fb1ad45d.04e528","x":426.3333282470703,"y":306.33333587646484,"wires":[["ad56ce03.4ea93"]]},{"id":"9b06911c.0fa8c","type":"change","z":"2f969f93.19b74","name":"cap0","rules":[{"t":"set","p":"measurement","pt":"msg","to":"cap0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":998.333366394043,"y":218.33333015441895,"wires":[["6c56a47c.b486ec"]]},{"id":"9dd58b0.4d51178","type":"change","z":"2f969f93.19b74","name":"cap1","rules":[{"t":"set","p":"measurement","pt":"msg","to":"cap1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":996.333366394043,"y":258.33335304260254,"wires":[["6c56a47c.b486ec"]]},{"id":"3c4b9e9c.e42232","type":"change","z":"2f969f93.19b74","name":"cap2","rules":[{"t":"set","p":"measurement","pt":"msg","to":"cap2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":992.333366394043,"y":302.3333549499512,"wires":[["6c56a47c.b486ec"]]},{"id":"6c56a47c.b486ec","type":"function","z":"2f969f93.19b74","name":"Show","func":"node.status({text:(msg.payload+'')});\nreturn msg;","outputs":1,"noerr":0,"x":1174.3332481384277,"y":152.3333339691162,"wires":[["da963db0.0867b","b83858ac.4ac2e8"]]},{"id":"3f3f1a0f.6ffe36","type":"influxdb","z":"","hostname":"localhost","port":"8086","protocol":"http","database":"test","name":""},{"id":"fb1ad45d.04e528","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"willQos":"0","birthQos":"0"}]
          

          http://yveaux.blogspot.nl

          1 Reply Last reply
          1
          • MaKinM Offline
            MaKinM Offline
            MaKin
            wrote on last edited by
            #5

            I have just discovered that there is an option for external servers like influxdb in mycontrollers. Can you say something about it compared to red node?

            And thanks for the code!

            YveauxY 1 Reply Last reply
            0
            • MaKinM MaKin

              I have just discovered that there is an option for external servers like influxdb in mycontrollers. Can you say something about it compared to red node?

              And thanks for the code!

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by
              #6

              @MaKin no, sorry, I don't have experience with it.

              http://yveaux.blogspot.nl

              MaKinM 1 Reply Last reply
              0
              • YveauxY Yveaux

                @MaKin no, sorry, I don't have experience with it.

                MaKinM Offline
                MaKinM Offline
                MaKin
                wrote on last edited by
                #7

                @Yveaux do you also use Grafana in order to visualize the data? I am not sure what fields/attributes are necessary despite "time" and "value" for a binary sensor.

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


                17

                Online

                11.7k

                Users

                11.2k

                Topics

                113.1k

                Posts


                Copyright 2025 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