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. Controllers
  3. OpenHAB
  4. MQTT batterylevel reporting

MQTT batterylevel reporting

Scheduled Pinned Locked Moved OpenHAB
3 Posts 2 Posters 3.9k 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.
  • H Offline
    H Offline
    Hausner
    wrote on last edited by
    #1

    Hi

    I've migrated from serial to mqtt. With the serial connection I got the sensors to report the batterylevel, but I can't get it to work with the MQTT GW.

    I've seen, that there's a "default" battery reporting line in MySensor.h

         void sendBatteryLevel(uint8_t level, bool ack);
    

    But how do I adapt that to mqtt?

    Can I just add the line at the end of the default temperature sensor loop?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bjornhallberg
      Hero Member
      wrote on last edited by
      #2

      Because I'm lazy at soldering I only have one battery board so far that actually reports battery level, but for me the battery is coming through as

      MyMQTT/4/255/50 92
      

      Or whatever, "92" being the payload. I went into MyMQTT.cpp and changed the pertinent line to

      char V_50[] PROGMEM = "BATTERY_LEVEL";
      

      So it looks a bit prettier and easier to catch in Python. As for actually using that value with some controller / HA software that is another matter. I myself save it as a "user variable" in Domoticz (since many of the dummy sensors in Domoticz can't have a battery level apparently). That way I can have a long list all in one place of all battery levels and can sort it.

      What sort of controller do you use?

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hausner
        wrote on last edited by Hausner
        #3

        I'm using OpenHab as controller.

        It worked pretty good when i had a raspberry as a serial gateway reporting to Openhab, but now I've switched to a MQTT gateway on an UNO. That works fine for a few temp sensors, but i'm having serious trouble getting a 8-channel relay node to work. It works for about 1-2 hours then it stops responding :( Then i have to powercycle it, to get it running again.

        Currently the temp sensors report this:

        0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1:81
        

        for a battery reading (81%).

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        14

        Online

        12.0k

        Users

        11.2k

        Topics

        113.4k

        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