ble_monitor icon indicating copy to clipboard operation
ble_monitor copied to clipboard

No battery information

Open eliobou opened this issue 7 years ago • 13 comments

Hello, I succesfully installed the custom component and it's working great except I don't have the battery sensor. I don't find it in the entity list. Is it a bug or something I miss ?

eliobou avatar Nov 27 '19 08:11 eliobou

It's not a sensor, it's an attribute of the temperature and humidity sensor (see battery_level at the bottom). You can see it if you click on the temperature sensor or humidity sensor.

image

You can use a template sensor if you want this displayed as a sensor in Home Assistant

https://www.home-assistant.io/integrations/template/

Ernst79 avatar Nov 27 '19 09:11 Ernst79

@Ernst79, how long have you been using the sensor in your screenshot? I collect statistics on battery consumption, but my sensors are now only 3 months old (85% of the charge on average). At the beginning there were experiments, and not all these 3 months used a passive scanning mode. But while it turns out about 5% per month approximately.

Magalex2x14 avatar Nov 27 '19 13:11 Magalex2x14

Mine is of 11 months old now, but I started with the original home assistant component in the beginning. Not sure when I changed to your custom_component.

Ernst79 avatar Nov 27 '19 13:11 Ernst79

Thanks for you answer. My config if someone don't know how to do it :

- platform: template
   sensors:
     mi_b_582d3435cfeb:
       friendly_name: "Niveau de batterie"
       unit_of_measurement: "%"
       value_template: "{{ state_attr('sensor.mi_t_582d3435cfeb', 'battery_level') }}"

eliobou avatar Nov 28 '19 19:11 eliobou

You mixed the first to lines. Try this:

sensor:
  - platform: template
     mi_b_582d3435cfeb:
       friendly_name: "Niveau de batterie"
       unit_of_measurement: "%"
       value_template: "{{ state_attr('sensor.mi_t_582d3435cfeb', 'battery_level') }}"

Ernst79 avatar Nov 28 '19 20:11 Ernst79

Do not forget to device_class. Correct config is:

sensor:
  - platform: template
    sensors:
      mi_b_582d34339449:
        friendly_name: "Baterie"
        unit_of_measurement: "%"
        value_template: "{{ state_attr('sensor.mi_t_582d34339449', 'battery_level') }}"
        device_class: "battery"

ma-zal avatar Dec 06 '19 17:12 ma-zal

@Magalex2x14 regarding the battery life, it died yesterday. The display was still working, but Bluetooth didn’t make it from the bedroom to the basement below 35%. I first thought bluetooth on my raspberry was not working anymore, but it worked fine, but no more messages from my device. A new battery was the solution -:) . So, about 1 year battery life. Luckily it’s a cheap AAA battery.

Ernst79 avatar Dec 08 '19 20:12 Ernst79

@Magalex2x14 any plans on adding a battery sensor automatically like temperature and humidity?

sti0 avatar Jan 14 '20 13:01 sti0

Do you mean for miFlora? It's hard to say now. I will answer that there is, but before that a lot needs to be done (the principle of receiving data must be completely changed #9). Therefore, if this happens, then not very soon, because I have to learn a lot... The only thing I can please now is that I am going to force the transition to a new principle, since this should solve a lot of problems with HASS.io (HassOS).

Magalex2x14 avatar Jan 14 '20 17:01 Magalex2x14

No, I mean for the temperature sensors. At the moment battery is only available as an attribute. Therefore we have to create template sensors manually (e.g. to monitor low battery states to replace them etc.).

My question was if it is planned to add this battery sensors automatically? Than it's not necessary to create battery sensors manually via template.

sti0 avatar Jan 14 '20 18:01 sti0

No, there were no such plans... Nobody has requested so far ) and the attribute is needed anyway. I might think of such an option, but it will be in low priority...

Magalex2x14 avatar Jan 14 '20 18:01 Magalex2x14

Should I create a new ticket to keep this feature request on track?

sti0 avatar Jan 14 '20 18:01 sti0

Please, add your suggestion to #3

Magalex2x14 avatar Jan 14 '20 18:01 Magalex2x14