fix: person attributes typing
This commit is contained in:
parent
8d271ab8b0
commit
5bfedb7078
|
@ -27,7 +27,7 @@ const ENTITIES = [
|
|||
}),
|
||||
getEntity("person", "paulus", "home", {
|
||||
friendly_name: "Paulus",
|
||||
picture: "/images/paulus.jpg",
|
||||
entity_picture: "/images/paulus.jpg",
|
||||
}),
|
||||
getEntity("sensor", "battery", 35, {
|
||||
device_class: "battery",
|
||||
|
|
|
@ -14,7 +14,7 @@ const ENTITIES = [
|
|||
}),
|
||||
getEntity("person", "paulus", "home", {
|
||||
friendly_name: "Paulus",
|
||||
picture: "/images/paulus.jpg",
|
||||
entity_picture: "/images/paulus.jpg",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ const ENTITIES = [
|
|||
}),
|
||||
getEntity("person", "paulus", "home", {
|
||||
friendly_name: "Paulus",
|
||||
picture: "/images/paulus.jpg",
|
||||
entity_picture: "/images/paulus.jpg",
|
||||
}),
|
||||
getEntity("sensor", "battery", 35, {
|
||||
device_class: "battery",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { HassEntityBase } from "home-assistant-js-websocket";
|
||||
import {
|
||||
HassEntityAttributeBase,
|
||||
HassEntityBase,
|
||||
} from "home-assistant-js-websocket";
|
||||
import { HomeAssistant } from "../types";
|
||||
|
||||
export interface BasePerson {
|
||||
|
@ -19,8 +22,18 @@ export interface PersonMutableParams {
|
|||
picture: string | null;
|
||||
}
|
||||
|
||||
interface PersonEntityAttributes extends HassEntityAttributeBase {
|
||||
id: string;
|
||||
user_id?: string;
|
||||
device_trackers?: string[];
|
||||
editable?: boolean;
|
||||
gps_accuracy?: number;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
}
|
||||
|
||||
export interface PersonEntity extends HassEntityBase {
|
||||
attributes: Person;
|
||||
attributes: PersonEntityAttributes;
|
||||
}
|
||||
|
||||
export const fetchPersons = (hass: HomeAssistant) =>
|
||||
|
|
|
@ -136,7 +136,7 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
|
|||
.image=${domain === "image"
|
||||
? computeImageUrl(stateObj as ImageEntity)
|
||||
: domain === "person"
|
||||
? (stateObj as PersonEntity).attributes.picture
|
||||
? (stateObj as PersonEntity).attributes.entity_picture
|
||||
: this._config.image}
|
||||
.stateImage=${this._config.state_image}
|
||||
.stateFilter=${this._config.state_filter}
|
||||
|
|
|
@ -149,7 +149,7 @@ class HuiPictureEntityCard extends LitElement implements LovelaceCard {
|
|||
.image=${domain === "image"
|
||||
? computeImageUrl(stateObj as ImageEntity)
|
||||
: domain === "person"
|
||||
? (stateObj as PersonEntity).attributes.picture
|
||||
? (stateObj as PersonEntity).attributes.entity_picture
|
||||
: this._config.image}
|
||||
.stateImage=${this._config.state_image}
|
||||
.stateFilter=${this._config.state_filter}
|
||||
|
|
|
@ -219,7 +219,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||
.image=${domain === "image"
|
||||
? computeImageUrl(stateObj as ImageEntity)
|
||||
: domain === "person"
|
||||
? (stateObj as PersonEntity).attributes.picture
|
||||
? (stateObj as PersonEntity).attributes.entity_picture
|
||||
: this._config.image}
|
||||
.stateImage=${this._config.state_image}
|
||||
.stateFilter=${this._config.state_filter}
|
||||
|
|
Loading…
Reference in New Issue