Skip to content

Commit

Permalink
gracefully use the default config.image if the person don't have an i…
Browse files Browse the repository at this point in the history
…mage (that works)
  • Loading branch information
Quentame authored Jul 22, 2024
1 parent 349b116 commit 0eb8b77
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-picture-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
case "image":
image = computeImageUrl(stateObj as ImageEntity);
break;
case "person" && (stateObj as PersonEntity).attributes.entity_picture:
image = (stateObj as PersonEntity).attributes.entity_picture;
case "person":
if ((stateObj as PersonEntity).attributes.entity_picture) {
image = (stateObj as PersonEntity).attributes.entity_picture;
}
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-picture-elements-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
case "image":
image = computeImageUrl(stateObj as ImageEntity);
break;
case "person" && (stateObj as PersonEntity).attributes.entity_picture:
image = (stateObj as PersonEntity).attributes.entity_picture;
case "person":
if ((stateObj as PersonEntity).attributes.entity_picture) {
image = (stateObj as PersonEntity).attributes.entity_picture;
}
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-picture-entity-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ class HuiPictureEntityCard extends LitElement implements LovelaceCard {
case "image":
image = computeImageUrl(stateObj as ImageEntity);
break;
case "person" && (stateObj as PersonEntity).attributes.entity_picture:
image = (stateObj as PersonEntity).attributes.entity_picture;
case "person":
if ((stateObj as PersonEntity).attributes.entity_picture) {
image = (stateObj as PersonEntity).attributes.entity_picture;
}
break;
}

Expand Down
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-picture-glance-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
case "image":
image = computeImageUrl(stateObj as ImageEntity);
break;
case "person" && (stateObj as PersonEntity).attributes.entity_picture:
image = (stateObj as PersonEntity).attributes.entity_picture;
case "person":
if ((stateObj as PersonEntity).attributes.entity_picture) {
image = (stateObj as PersonEntity).attributes.entity_picture;
}
break;
}
}
Expand Down

0 comments on commit 0eb8b77

Please sign in to comment.