Show user battery entity for individual users on the dashboard

yes, just find the entity names. there is a post pinned on top of this topic which shows you how to do that. and then just add a card to your liking and add the right entity.
if you want more cards? install hacs. just search for it

But that would just be a static entity wouldn’t it?

not if you add a state filter like so: (you can press edit as yaml)

type: entity-filter
entities:
  - device_tracker.sensor_woonkamer
  - device_tracker.sensor_sk_dm_sk_j
  - device_tracker.sensor_sk_s_bk
  - device_tracker.sensor_loungebar
  - device_tracker.sensor_schuur
state_filter:
  - operator: '!='
    value: home
card:
  type: glance
  title: Apparaat offline

in this example i used != home. meaning not is home

looks like this in the UI.
and show all devices which are offline
image

Hmm k I think I understand, but would state filter be for battery voltage?

have you checked this post at the top of this topic? i gues not because it shows you the state it has, use that state for your state filter. check it out.

Thanks I’ll look into this

Could you give me an example of how to add this for just displaying different users battery voltages.

There no real conditions other then which user is viewing the dashboard, to display their battery voltage.

I just dont understand this part.

state_filter:
  - operator: '!='
    value: home

Im guessing the entities are the entities that you want to include in the filter.

this means that everything is shown except the ones with state home.

i use this for my devices that are offline, so the device tracker can have a few states like home (device is connected to home wifi), not home (not connected), not available (device is offline), none (status unknown).
so the last 3 states all indicate that the device is offline or at least not usable. instead of making 3 filters, i make 1 filter and say if it is not state home then the device is offline.
but in your case you want it to display when a device is connected, soyou use ‘==’ instead of ‘!=’.
did you checked what the state is when it’s connected? use that state with ‘==’

also did you google on “home assistant state filter” ?
it will give you this page which explains all options and some examples:

so what is the entity name? and what is the state when it’s connected?
fill those in in my example with “==” instead of ‘!=’

the entity would be a mobile device battery status.

There’s no real connect or not connected as its just always a connected entity I guess, the battery voltage entity for a device, mobile device.

I want to display this entity status regardless of any conditions.

I just want to display battery voltage for that logged in user, regardless of whether they are home or not etc.

Thanks

ok, in that case you can make a template sensor. if user is logged in then state is sensor.battery_voltage else state is unavailable.
but you do need something to differentiate whether a user is logged in… so how can you detect that?
in this way you use some entity to detect if logged in, and if so the entity filter passes it through. does this makes sense?

you find more info about template sensors here:

and those if, elif and else statements are written in a code named jinja. it takes some time to get used to it, but with this link you get all the explaining and lots of examples…
https://jinja.palletsprojects.com/en/latest/templates/

Thanks for the help. I ended up using this card and its working well. Exactly as expected.

However, one small issue. How can I display a custom name rather then the entity name? Ive tried.

type: custom:state-switch
entity: user
default: default
states:
  user_1_here:
    type: entities
    title: Your title here
    show_header_toggle: false
    entities:
      - input_boolean.user_1_switch
        name: custom name here

But his just throws an error

Configuration errors detected:
bad indentation of a sequence entry (10:13)

  7 |     show_header_toggle: false
  8 |     entities:
  9 |       - sensor.sm_g973f_battery_level
 10 |         name: test
------------------^
 11 |   Sue:
 12 |     type: entities

this is the complete card.

type: custom:state-switch
entity: user
default: default
states:
  user_1_here:
    type: entities
    title: Your title here
    show_header_toggle: false
    entities:
      - input_boolean.user_1_switch
  user_2_here:
    type: entities
    title: Your Title Here
    show_header_toggle: false
    entities:
      - input_boolean.user_2_switch
  default:
    type: markdown
    content: >
      ## Unknown user

the indentation of name: is wrong.
try this:

type: custom:state-switch
entity: user
default: default
states:
  user_1_here:
    type: entities
    title: Your title here
    show_header_toggle: false
    entities:
      - input_boolean.user_1_switch
    name: custom name here

i’m not sure if the rest of the indentation is right. yaml code is very sensitive for wrong indentation, sometime i have to play with it too. just try different positions (always use 2 spaces per step)

did you get user_1_here: from some manual? i’m not sure if that is ok…

No, I replace user_1 and so on with the actual username of the user and it works. Quite handy and easy way to do it using the “User” entity.

Thanks, that indentation worked as the error is now gone, but the custom name does now display and it still just displays the entity name.

Am I missing something?

Like i said, play with the name: position.
Try it 2 or 4 spaces to the left.

I’m not familiar with this card, but you could see if there are examples in the manual for it.

#almost there :wink:

so did it work?

Nah,

No matter how I format it/indent it, the name does not change on the entity.

ok, let’s try something else.
go to settings → devices and services (the blue one) → entities

select the right entity

click it and then go to the cogwheel

try giving the entity a name, and if that doesn’t work you could change the entity id. in that case it will display whatever you want. but beware, if you use that entity name in an card, automation, script or something you need to change the name everywhere you used it to make it work again. but that’s logical right?