custom-cards / entity-attributes-card

Entity Attributes
Apache License 2.0
68 stars 12 forks source link

How to correctly format attribute if it contain spaces? #2

Open TheStigh opened 5 years ago

TheStigh commented 5 years ago

Hi, when using this card, if the attribute contain spaces, it does not show. Example: binary_sensor.530i_xdrive_condition_based_services.car = OK binary_sensor.530i_xdrive_condition_based_services.['brake fluid status'] = Not OK

Attributes from dev-state:

car: 530i xDrive brake fluid status: OK

    title: Attributes Card
    heading_name: List
    heading_state: States
    filter:
      include:
        - key: binary_sensor.530i_xdrive_condition_based_services.car
        - key: binary_sensor.530i_xdrive_condition_based_services.['brake fluid status']
nibblerrick commented 4 years ago

For me it worked just replacing the spaces with underscores (so would be binary_sensor.530i_xdrive_condition_based_services.brake_fluid_status in your case). I don't know if that's the designated way it shoudl be handled but may be worth trying.

rpitera commented 4 years ago

I ran into this with the Tautulli sensor. It has some attributes listed as

Setting the key to sensor.tautulli.top_tv_show didn't work. After a few other tries I ended up testing this for shits and giggles. Surely it wouldn't work...

filter:
  include:
     - key: sensor.tautulli.Top Movie
     - key: sensor.tautulli.Top TV Show
     - key: sensor.tautulli.Top User

And surprisingly this worked perfectly. I feel like this may be unique to certain entities, but you may want to try using the spaces and case as presented in the states view.