piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.5k stars 328 forks source link

Person - Greyscale Entity Picture on Away #215

Open capandcamera opened 2 years ago

capandcamera commented 2 years ago

Currently within Musthroom, when a person is marked as away the state changes and the icon is amended, However as a fast glance option it would be useful to have the entity_picture apply a filter of greyscale on away

filter: grayscale(100%);

This could be optional for example:

- type: custom:mushroom-person-card
  entity: person.me
  use_entity_picture: true             
  hide_name: true
  greyscale_on_away: true
davidcoulson commented 2 years ago

Is there a way to do this with the card-mod frontend module?

greghesp commented 2 years ago

I have a draft of this working, but the issue we currently having is knowing which zone is at home, and which zone is away.

The icon for example goes lighter if the entity state is not home, however since a person can also be in a room from the mqtt_room integration, it shows the icon as the lighter colour for this when they're still at home. Applying the same logic here would make the picture greyscale when they're in a room, as their state isn't home.

Unsure how best to handle this one, as it is technically a bug as well

piitaya commented 2 years ago

My proposal :

I don't think we should split zones into 2 types (not home/home). The passive zone options can be used to exclude zones you don't want to be considered as home.

greghesp commented 2 years ago

My proposal :

  • if state is away or unavailable : grey-scale
  • if state in home or zone : colored

I don't think we should split zones into 2 types (not home/home). The passive zone options can be used to exclude zones you don't want to be considered as home.

Right now, the grey-scale icon is shown based purely on if state === home

Should be a simple logic change, but this does mean that if you're in the zone labelled as office as per the dev container, you'll be showing in colour, not grey scale, even though you're not home?

I can make the PR if you're happy with that flow?

piitaya commented 2 years ago

Yep but you are in a known zone. 😅

piitaya commented 2 years ago

I will give some tests. Zones entity contains a person list. What happen if you define a zone inside the home zone ? 😅