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. Do sensors report battery level?

Do sensors report battery level?

Scheduled Pinned Locked Moved Development
5 Posts 3 Posters 6.4k Views 1 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.
  • T Offline
    T Offline
    Tommy Sharp
    wrote on last edited by
    #1

    Hi, haven't seen this info anywhere yet..... Can sensors report their battery level back to the Vera like other z-wave sensors do?

    hekH 1 Reply Last reply
    0
    • T Tommy Sharp

      Hi, haven't seen this info anywhere yet..... Can sensors report their battery level back to the Vera like other z-wave sensors do?

      hekH Online
      hekH Online
      hek
      Admin
      wrote on last edited by hek
      #2

      @Tommy-Sharp

      Yes, it is possible. You'll find the API here:
      http://www.mysensors.org/build/sensor_api#the-full-api

      void sendBatteryLevel(int batteryLevel);
      

      If you want a battery-powered sensor to report its battery level use this method. The value is a percentage (0-100).

      Here is info on how to measure battery level:

      http://www.mysensors.org/build/battery#measuring-and-reporting-battery-level

      1 Reply Last reply
      0
      • BSoftB Offline
        BSoftB Offline
        BSoft
        wrote on last edited by
        #3

        Testing v1.4 beta.

        I'm already getting a very precise Tension value for Lipo batteries where stopping draining it at 3.2V (at max) could be crucial.

        The problem is, tension wise and under load:

        3.5V = 3.125 %
        3.4V = 1.25%
        3.3V = 0.2%
        3.2V = 0%

        I'm already interpolating for any value of tension (for middle values).

        As we can see, it drops and drops fast at the very ending, but for a low discharge scenario as we get with 328p, 1% for a 2000mAh still means many many days of use (maybe months).

        As tension calculation occurs before percentage on the node i could and should cut off at the node side based on tension.

        But for controller this means many days of use at 0% starting near below 3.38V because actually a percentage like 0.98% is truncated and sent like 0% because we are sending an uint8_t value.

        I'm trying to change that in MySensor::sendBatteryLevel changing 8bit integer to something like double/float, but i get compile errors.

        Is double/float supported for internal messages?

        1 Reply Last reply
        0
        • hekH Online
          hekH Online
          hek
          Admin
          wrote on last edited by
          #4

          For normal messages float/double will be converted to strings as found no c-standard standard way of sending then serialized OTA. If you want decimals I would suggest sending them *10 or *100 and divide result on receiving side. Floats in the AVR platform is very memory consuming anyway so try to avoid it.

          BSoftB 1 Reply Last reply
          1
          • hekH hek

            For normal messages float/double will be converted to strings as found no c-standard standard way of sending then serialized OTA. If you want decimals I would suggest sending them *10 or *100 and divide result on receiving side. Floats in the AVR platform is very memory consuming anyway so try to avoid it.

            BSoftB Offline
            BSoftB Offline
            BSoft
            wrote on last edited by
            #5

            @hek Thank you very much Henrik! I will try it!

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


            20

            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