Closed toedtling closed 2 years ago
Battery info doesn't come though on BLE
I am currently using a binary template sensor, to check the RSSI - if it's over 3 minutes since it last updated, then it's likely dead:
- platform: template
sensors:
ble_battery_sundew_3:
friendly_name: "Sundew 3 - Battery"
device_class: battery
value_template: >-
{% if ((as_timestamp(now()) - as_timestamp(states.sensor.ble_rssi_sundew_3.last_changed))) | round(0) > 180 %}
on
{% else %}
off
{% endif %}
This updated integration looks for a sensor, however, so is looking for a numerical value - when I add:
battery_sensor: binary_sensor.ble_battery_sundew_3
to the Lovelace card, I get off% - i.e the binary_sensor is off, because it is updating/changing and the battery is not dead. Would it be possible to support binary_sensor battery class?
For now, I shall probably adjust the template sensor to be a 'sensor' not binary_sensor to report 100 or 0
This 'works' for me - to show a battery class, % measurements - but as a sensor not binary_sensor, but does not seem to show on the card, will have to check further later
- platform: template
sensors:
ble_fake_battery_venus_flytrap_1:
friendly_name: "Venus Flytrap 1 - Battery"
unit_of_measurement: "%"
device_class: battery
value_template: >-
{% if ((as_timestamp(now()) - as_timestamp(states.sensor.ble_rssi_venus_flytrap_1.last_changed))) | round(0) > 180 %}
0
{% else %}
100
{% endif %}
Changed name to 'fake_' to avoid clashes with actual battery (if present) - but doesn't seem to show on the (updated) card:
type: custom:flower-card
entity: plant.venus_fly_trap_1
show_bars:
- illuminance
- dli
- temperature
- conductivity
- moisture
battery: sensor.ble_fake_battery_venus_flytrap_1
UPDATE: Doh, battery_sensor, not battery, works now.
type: custom:flower-card
entity: plant.venus_fly_trap_1
show_bars:
- illuminance
- dli
- temperature
- conductivity
- moisture
battery_sensor: sensor.ble_fake_battery_venus_flytrap_1
Any Documentation how to enable?
Just add
battery_sensor: sensor.whatever_battery_sensor_you_want
to the card config.
My battery icon is also not appearing - what is the format expected for the sensor? I have a template sensor set up for either % or unitless battery % and neither seems to mesh
type: custom:flower-card entity: plant.swedish_ivy show_bars:
It expects a sensor that has a state
which is a number between 0 and 100.
Make sure you have control of your whitespace as it is important in yaml.
Any Documentation how to enable?