maxwroc / battery-state-card

Battery state card for Home Assistant
MIT License
848 stars 38 forks source link

Exception: e.formatEntityState is not a function #688

Closed rathinho closed 7 months ago

rathinho commented 7 months ago

Describe the bug

BATTERY-STATE-ENTITY
Exception: e.formatEntityState is not a function

Please check if the problem was reported already
Click [here](https://github.com/maxwroc/battery-state-card/issues?q=is%3Aissue+is%3Aopen+Exception%3A%20e.formatEntityState%20is%20not%20a%20function) to search
If it wasn't please consider creating one
Click [here](https://github.com/maxwroc/battery-state-card/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Exception%3A%20e.formatEntityState%20is%20not%20a%20function) to create
Please copy-paste the below stack trace.
TypeError: e.formatEntityState is not a function
    at http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:35:11444
    at qt.<anonymous> (http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:35:11567)
    at Generator.next (<anonymous>)
    at http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:1:633
    at new Promise (<anonymous>)
    at e (http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:1:378)
    at qt.internalUpdate (http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:35:9852)
    at qt.<anonymous> (http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:35:2146)
    at Generator.next (<anonymous>)
    at http://192.168.1.185:8123/hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682320:1:633

YAML configuration


type: custom:battery-state-card
title: ''
sort_by_level: asc
collapse: 10
color_gradient:
  - '#ff0000'
  - '#ffff00'
  - '#00ff00'
entities:
  - entity: sensor.iphone_13_battery_level
    name: my iPhone 13
    tap_action:
      action: more-info
    charging_state:
      entity_id: sensor.iphone_13_battery_state
      state: Charging
  - entity: sensor.loock_v8_f8d0_battery_level
    name: lock
    tap_action:
      action: more-info
  - entity: sensor.loock_v02_e29f_battery_level
    tap_action:
      action: more-info
  - entity: sensor.apc_bk650m2_ch_battery_charge
    name: APC UPS
    tap_action:
      action: more-info
  - entity: sensor.miaomiaoce_t2_5b3b_battery_level
    name: living room hygrothermograph
    tap_action:
      action: more-info
  - entity: sensor.miaomiaoce_t2_9707_battery_level
    name: washroom hygrothermograph
    tap_action:
      action: more-info

Entity debug data

Dev console errors

Screenshots

Version v3.2.0

maxwroc commented 7 months ago

You must be on old HA instance.

You have two options to solve your problem:

  1. Upgrade your HA
  2. Use default_state_formatting: false in your card config

More info here: #623

rathinho commented 7 months ago

You must be on old HA instance.

You have two options to solve your problem:

  1. Upgrade your HA
  2. Use default_state_formatting: false in your card config

More info here: #623

thanks, my Home Assistant version is 2023.7.3. By adding default_state_formatting: false in card config, it works properly.