Skip to content
  • 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 use sendBatteryLevel on the controller?
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

How to use sendBatteryLevel on the controller?

Scheduled Pinned Locked Moved General Discussion
9 Posts 3 Posters 1.2k Views 2 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.
  • C Offline
    C Offline
    chbla
    wrote on last edited by
    #1

    Hi there,

    Quick question, I read a lot about using sendBatteryLevel() on my nodes, however, I cannot find any information on how this is actually used on the controller side.

    My gateway forwards to MQTT, will it just generate a message for the battery level or how is it used?

    zboblamontZ mfalkviddM 2 Replies Last reply
    0
    • C chbla

      Hi there,

      Quick question, I read a lot about using sendBatteryLevel() on my nodes, however, I cannot find any information on how this is actually used on the controller side.

      My gateway forwards to MQTT, will it just generate a message for the battery level or how is it used?

      zboblamontZ Offline
      zboblamontZ Offline
      zboblamont
      wrote on last edited by
      #2

      @chbla I use serial to Domoticz where it records battery voltage. If it falls below 1.2v I have it set to send an alarm message...

      1 Reply Last reply
      0
      • C chbla

        Hi there,

        Quick question, I read a lot about using sendBatteryLevel() on my nodes, however, I cannot find any information on how this is actually used on the controller side.

        My gateway forwards to MQTT, will it just generate a message for the battery level or how is it used?

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #3

        @chbla controllers do whatever they want, so the question does not have a general answer. Are you developing your own controller? Or are you using a specific controller?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chbla
          wrote on last edited by
          #4

          Sorry I mixed up things - what I mean is, if I have a gateway that forwards to MQTT - regardless of the controller - how does the sendBatteryLevel data end up in the queue? Obviously it has different semantics that "normal" messages sent with send() ?

          mfalkviddM 2 Replies Last reply
          0
          • C chbla

            Sorry I mixed up things - what I mean is, if I have a gateway that forwards to MQTT - regardless of the controller - how does the sendBatteryLevel data end up in the queue? Obviously it has different semantics that "normal" messages sent with send() ?

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @chbla I see. Thanks for clarifying.

            I am compiling a MQTT gateway to find out. Compiling takes a while but I'll report back as soon as it is ready.

            1 Reply Last reply
            0
            • C chbla

              Sorry I mixed up things - what I mean is, if I have a gateway that forwards to MQTT - regardless of the controller - how does the sendBatteryLevel data end up in the queue? Obviously it has different semantics that "normal" messages sent with send() ?

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #6

              @chbla on my gateway, messages are sent to topic mysensors-out/0/255/3/0/0
              mysensors-out is configurable when you build the mqtt gateway
              The first 0 is probably the originating node (I let the gateway report its own battery level and the gateway has ID 0).
              255 is the child ID. Battery level always has child ID 255.
              I am not sure about the last two zeros.

              The payload is a string with the battery level. For 42% the string will be "42".

              C 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @chbla on my gateway, messages are sent to topic mysensors-out/0/255/3/0/0
                mysensors-out is configurable when you build the mqtt gateway
                The first 0 is probably the originating node (I let the gateway report its own battery level and the gateway has ID 0).
                255 is the child ID. Battery level always has child ID 255.
                I am not sure about the last two zeros.

                The payload is a string with the battery level. For 42% the string will be "42".

                C Offline
                C Offline
                chbla
                wrote on last edited by
                #7

                @mfalkvidd Thanks a lot for trying this out! I wondered if it is interpreted or used in a special way by the gateway already.
                But in this case I can do that myself.

                Thanks again!

                mfalkviddM 1 Reply Last reply
                1
                • C chbla

                  @mfalkvidd Thanks a lot for trying this out! I wondered if it is interpreted or used in a special way by the gateway already.
                  But in this case I can do that myself.

                  Thanks again!

                  mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #8

                  @chbla great. In case you want to reproduce what I did, use the following configure command for the raspberry pi gateway (I think it will run on any Linux machine):

                  ./configure --my-transport=none --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
                  

                  (this assumes you have a mqtt broker on localhost)

                  I added the following to examples_linux/mysgw.cpp:

                  void loop(){
                          sendBatteryLevel(42);
                          wait(5000);
                  }
                  

                  Then just run

                  make && sudo ./bin/mysgw -d
                  
                  1 Reply Last reply
                  1
                  • C Offline
                    C Offline
                    chbla
                    wrote on last edited by
                    #9

                    Thanks, I'll try that!

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


                    16

                    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
                    • OpenHardware.io
                    • Categories
                    • Recent
                    • Tags
                    • Popular