Node with only sendBatteryLevel into Home Assistant



  • Hello experts,

    I've got the following question: Is it possible to have a node provide only it's battery level into home assistant?
    Basically I'm trying to run the example from link text. In the serial monitor of both the Node and the Gateway I'm seeing the battery level percentage correctly but I'm not able to get it to show up in home assistant. Sidenote, I've had a lot
    My hardware:
    Home Assistant running on a HP T620.
    Gateway: Arduino Uno with W5100 shield and NRF24L01+ radio
    Node: Arduino pro mini ATMEGA328p with NRF24L01+ radio with Voltage divider and filter cap from Mysensors documentation:
    link text

    Background: I'm playing around



  • I accidentally hit a keyboard shortcut to post this topic before it was ready. Now I'm not allowed to edit anymore (600s passed):
    Below is the post I intended with my edits to make it more clear:

    Hello experts,

    I've got the following question: Is it possible to have a node provide only it's battery level into home assistant?
    I don't see the example code "presenting" the battery percentage as with the DHT22. Could this be where my issue lies?

    Basically I'm trying to run the example from Mysensors Battery powered sensors. In the serial monitor of both the Node and the Gateway I'm seeing the battery level percentage correctly. I'm not able to get the value to show up in home assistant.

    Sidenote: I've had multiple DHT22 and DS18b20 sensors report succesfully with mysensors into home assistant before. When I was playing around and re-used the arduino (and didn't know to clear the EEPROM) I saw the battery percentage show up in HA under an old node-ID. So I cleared both Node, and Gateway EEPROM (using Mysensors sketch).

    Still no success so I've cleared both EEPROMs again, deleted my gateway in HA, deleted my configuration.yaml. deleted whatever log files I could find in HA, gave a new gateway IP. Reflashed both Arduinos and I'm not getting a "new device detected" in HA.

    My hardware:
    Home Assistant running on a HP T620.
    Gateway: Arduino Uno with W5100 shield and NRF24L01+ radio
    Node: Arduino pro mini ATMEGA328p with NRF24L01+ radio with Voltage divider and filter cap from Mysensors documentation:
    Mysensors Battery powered sensors

    I can include more logs, or whatever you need but I'll stop here to not make this post any bigger.
    Log showing Battery Percentage in the Gateway Log

    1624678 TSF:MSG:READ,1-1-0,s=255,c=3,t=0,pt=1,l=1,sg=0:65
    


  • Well, battery level is an attribute in Home Assistant, so you can only see it as a byproduct of a reading. Workaround is to open the persistence file, there, you can see the battery level even in no reading is shown in the frontend: Bildschirmfoto vom 2023-04-02 23-18-02.png



  • Thank you! I've been breaking my head over this, I'm still extremely new to home assistant and mysensors. It's indeed visible in my persistence file:
    3eabaa6a-3d65-4614-8a35-663ca2b5b6ae-image.png

    Next question: suppose I wish to use these attributes as if they are a sensor, for example in the "gauge" or "chart" card. Is there a common best practice you'd recommend me?

    I've found a topic on the home assistant website describing ways to use an attribute by creating a sensor entry in the configuration.yaml file.

    Home Assistant Community Lovelace UI - Gauge Card: Add attribute variable



  • @Arno

    sensor:
      - platform: template
        sensors:
          greenhouse_battery:
            friendly_name: "Batterie Gewächshaus-Klimasensor"
            unit_of_measurement: "%"
            icon_template: mdi:battery
            unique_id: "greenhouse_battery"
            value_template: "{{ states.sensor.air_temperature.attributes.battery_level }}"
    


  • Hi Eiten,

    I appreciate you helping me out. Unfortunately I'm still not getting it to work.
    How do I find the correct "name" of the battery measuring node?

    See a screenshot of my configuration.yaml. I've added a random binary sensor + sensor of the average ping time attribute (Fritzbox ping time avg) and that works as expected.

    Where do I find what I need to fill for "Battery_Meter2".
    The screenshot of my persistence file is also given: (same as above basically, there is an upload error for some reason)
    ![0_1681035971813_b5780ffd-b9ab-49d9-99ca-f2ffd2edd6c6-image.png](Uploading 100%)
    ![0_1681036107234_d45cb8ad-ac5a-44c0-a456-707aeeb6be51-image.png](Uploading 100%)



  • Hey Arno,

    now it's getting a little bit complicated... as I have my HomeAssistant in German. Go to "Developement tools" (Entwicklerwerkzeuge), then to "States" (Zustände). There you can finde the name of your device.



  • Hi Eiten,

    Vielen dank :). I've been succesfull to get a battery level to come through. Thanks again.

    In the end I used a DHT22 sensor with battery monitoring and the node was automatically detected as a "device". In the "states" section you mentioned I can also see my previous attempts with just battery monitoring so I'm confident it would work too.



  • Great! I'm glad it works and thank you very much for reporting back!


Log in to reply
 

Suggested Topics

  • 87
  • 1
  • 3
  • 5
  • 10
  • 8

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts