Card to show who is home?

Firstly, I feel the need to always apologise when asking on here, but I am still new to HA and just cannot get to grips with it. I see something I like, try to mirror it, fail and get completely stuck by the documentation then have to come here.

So here goes. I would like a card that has a picture of me when I am home, a different picture when I am away and the status of myself ie Home or Away (I will add other people later but for now…)

So I have presence detection working using my iphone. It knows I am at work currently.
I thought this would work:

    - type: picture-glance
      title: Home
      entity:
      - device_tracker.matts_iphone
      state_image:
      "Away": /local/Matt_Away.png
      "Work": /local/Matt_Home.png
      "Home": /local/Matt_Home.png

But of course it doesnt, just says invalid config on the lovelace UI screen.

image

my images are in my www folder:

image

What have I done wrong this time?

I wanted this:

image

    - type: picture-glance
      title: Home
      entity:
      - device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png

Your indentation under state_image was off by 2 spaces. And you gotta use the correct ‘under the hood’ states, which are:

What It looks like in the UI What the state is under the hood
Home home
Away not_home
Zone Friendly Name Zone Friendly Name

You can find the under the hood names in the developer tools -> state tab.

Thank you!

the “under the hood” states are new to me! Only used “Work” before, assumed Home and Away were things too.

I have just pasted your code in instead and still get an invalid card config error though

    - type: picture-glance
      title: Home
      entity:
      - device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png



What’s the error? The code is correct.

I am seeing this on the screen:

image

No config errors though, is there a limit to the size the png files can be?

Ah, no, the config is actually wrong for the entity field.

    - type: picture-glance
      title: Home
      entity: device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png

Still not working. I am sure its something I have done wrong but why is something so simple proving to be so difficult?

image

    - type: picture-glance
      title: Home
      entity:
      - device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png

How do I check the entity ID is correct? I am using the same ID for my “how many hours at work” card but cannot remember how I found the actual entity ID. Where would this be?

I wish there was a bigger hint than just “invalid card config”

Can someone also just confirm if I am even using the right card?

Can a picture-glance card be used to give this:

image

Bro, did you read my post? You’re config is still wrong here:

      entity:
      - device_tracker.matts_iphone

which is producing this incorrectly
image

It needs to have this configuration, i’m guessing you didn’t try my last post?

    - type: picture-glance
      title: Home
      entity: device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png

To get the look in the image, you need to use a entities card, but the image will not changed based on your state.

Your screenshot says otherwise. "entities": wouldn’t have a [] if it were correct.

1 Like

I am restarting HA now to see if that helps but I didnt think you needed to restart if making changes to the Lovelace file.

Now this is the error:

image

You don’t need to restart when editing Lovelace

Thought so, thanks.

Still not working so must be something else. Thanks for helping guys just dont think I am ever going to get the hang of HA, thought it would be something someone with no experience could pick up but dont think I have the coding knowledge to do this.

So I am sitting here looking at the picture glance card configuration (which is not the same thing as your screenshot prior)

I think what you want is the ENTITIES CARD.

The error is that you are missing the required attribute entities, which displays a series of entities at the bottom of the picture-glance.

Change to a picture-entity card instead with the same configuration. The picture-entity card does not require a list of entities to display.

    - type: picture-entity
      title: Home
      entity: device_tracker.matts_iphone
      state_image:
        "not_home": /local/Matt_Away.png
        "Work": /local/Matt_Home.png
        "home": /local/Matt_Home.png

fwiw, I use an extended button-card setup for that, with dedicated images for the state and an overlay for the zone my family is in, displayed in the bottom right corner. Added to that I use a colored background to help identifying the state. Green for home, white for abroad, purple for zoning in life360 and grey for not_home :wink:

43

it needs 3 pictures for all family members, and an image for each zone.

Thanks Guys!

I changed my code to that provided by petro and the card works, show the picture and shows the name of the device and status “Away”

It is not the card I was after but might leave it for now. I think the card I need is as per flamingm0e says which is an entity card so will give that a read and see how I get on.

Thank you for all the help!

Just remember, that card doesn’t have the ability to change the picture based on the state.

This states otherwise.

By default it uses entities card model.