GithubHelp home page GithubHelp logo

benct / lovelace-battery-entity-row Goto Github PK

View Code? Open in Web Editor NEW
69.0 69.0 7.0 66 KB

Show battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI

License: MIT License

JavaScript 100.00%
attribute battery card entity entity-rows hacs home-assistant home-assistant-frontend lovelace lovelace-ui state

lovelace-battery-entity-row's People

Contributors

benct avatar chris-v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lovelace-battery-entity-row's Issues

Binary Sensors seems not supported

There are BinarySensors with device_state: battery available...
grafik

default state, when the battery is OK -> is OFF
When the battery becomes empty, the state will switch to ON

Unfortunately it seems, the battery-entity-row does not support binary sensors

This is how the battery looks like in a regular entity card:
grafik

And this, when I apply the battery-entity-row:
grafik

I would really appreciate if the entity-row would support these binary sensors, since I have a lot of them that should be included into one card - and I would really like to have the color-indication for their state.

I am aware of the fact, that these sensors could only be green & red - nothing in between :)

Charging status icon does not show

Hi

I need reload UI to see charging ststus icon change.
I see in Developers tool that the value was changed but it does not change (charging icon) on dashboard

  entity: sensor.wall_panel_2_battery_level
  charging: 
    attribute: charging
    state: 
      - "True"

tested also with separate charging sensor entity defined

  entity: sensor.wall_panel_2_battery_level
  charging: 
    entity: sensor.wall_panel_2_battery_charging_state
    state: 
      - "True"

HA: 2021.1.4

Date Breaking Changes

Hello,

First, thank you for this card!

In the latest release 2020.12.x, HA made a breaking change in the way it works with dates. Due to this change, the last-changed variable no longer works for secondary-info attribute.

For example:

    - type: 'custom:battery-entity-row'
      entity: sensor.parlor_motion_st_battery
      name: Parlor Motion
      unit: '%'
      secondary_info: last-changed
      warning: 50
      critical: 25

Will result in

image

In a nushell, you need to use a timestamp value, instead of a duration in seconds value. Is this something the card controls or is the 'last-changed' property from the sensor?

Improve Battery Charging Icons

As a follow-up to #4 , some entities are a bit different and require a bit more than the boolean .

Two examples of this that I have are my iOS App devices, and my vacuum (Roomba).

Vacuum:
By default, it's using these attributes (example):

battery_level: 100
battery_icon: 'mdi:battery-charging-100'
status: Charging

The main thing here is that the status could also indicate other things than just the battery status, ie stopped, running, etc

The other is the iOS devices, using the official iOS app. These have a battery state sensor, for example: sensor.my_iphone_battery_state where it has the actual state being either Charging or Not Charging. This sensor also has some other attributes, such as the below:

Battery Level: 20
Low Power Mode: false
friendly_name: My iPhone Battery State
icon: 'mdi:battery'
device_class: battery

Further to that, the sensor which is actually used in the battery entity card is the sensor.my_iphone_battery_level. This has an attribute called Battery State: which seems to be referencing the battery state sensor. Attribute example:

Battery State: Charging
Low Power Mode: false
unit_of_measurement: '%'
friendly_name: My iPhone Battery Level
icon: 'mdi:battery-charging-20'
device_class: battery

Most of this can be found in the HA Companion Documentation, and more specifically, the Battery Sensors

Does not Work with Auto Entities

I would Iike to use your card with Auto Entities card but it says that a entity must be provided. The purpose of the auto entities is to provide the entity_id to various cards. Can this be added to your feature list?

Charging Status Icon

I noticed that items which are charging do not show the charging icon as it does with the standard icon.
Could this be added?

Additionally, to add the battery state as secondary info (charging / not charging). Although Iโ€™d say the icon has priority.

Don't see the 'critical' level color?

HA: 2021.2.3
Theme: yourname

I built up this for my batteries:

type: 'custom:auto-entities'
card:
  type: entities
sort:
  method: state
  numeric: true
filter:
  exclude:
    - entity_id: '*mobil*'
    - entity_id: '*h8*'
    - entity_id: '*life360*'
    - entity_id: '*netatmo*'
    - entity_id: binary_sensor.*
    - state: '> 50'
  include:
    - entity_id: '*_battery'
      options:
        type: 'custom:battery-entity-row'
        warning: 50
        critical: 25
        charging: true
    - entity_id: '*_battery_level'
      options:
        type: 'custom:battery-entity-row'
        warning: 50
        critical: 25
        charging: true
    - entity_id: '*_batteriniveau'
      options:
        type: 'custom:battery-entity-row'
        warning: 50
        critical: 25
        charging: true
    - entity_id: '*_battery_charge'
      options:
        type: 'custom:battery-entity-row'
        warning: 50
        critical: 25
        charging: true

And it works for the most part, except tht the 'critical' doesn't show:

image

Support string values

Hi, I've got a few battery powered devices I monitor, where the unit is: normal or low
When using your battery-entity-row, what unit should I be using for these devices?

Defaulting to % is great, in most cases, for these devices, it just shows 0%, when in-fact the state is actually normal. I've tried "unit: " & "unit: string" but not getting the result I'd expect. Are their more options for unit than "%"?

cheers

Display float numbers without truncating

I have a battery sensor that is a voltage, not a percentage, and want to show "2.65" for example, and compare to that. It is truncated/turned into an int, so it is always shown as "2". can't see a way to change that.

The ask is to handle float values for non-percent, including comparisons to critical etc.

Example desired config:

  - type: custom:battery-entity-row
    entity: sensor.smartweather_battery
    name: Smartweather Battery
    unit: volts
    warning: 2.5
    critical: 1.95

thanks for considering!

No secondary info

Hi

I have the following configuration.

type: 'custom:auto-entities'
card:
  type: entities
  title: Windows
filter:
  include:
    - entity_id: binary_sensor.*_window
      options:
        type: 'custom:battery-entity-row'
        warning: 85
        critical: 83
        secondary_info: last_updated
sort:
  method: attribute
  attribute: battery_level

The card displays this:
Screenshot 2021-01-23 at 11 36 04

Each entity has these attributes:
Screenshot 2021-01-23 at 11 36 42

How can I get the display like this:
Screenshot 2021-01-23 at 11 39 22

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.