mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Get attributes from first state when using minimal responses (#12732)
This commit is contained in:
parent
5b7b0ea326
commit
1f105b6c15
@ -272,7 +272,7 @@ const processTimelineEntity = (
|
|||||||
states: EntityHistoryState[]
|
states: EntityHistoryState[]
|
||||||
): TimelineEntity => {
|
): TimelineEntity => {
|
||||||
const data: TimelineState[] = [];
|
const data: TimelineState[] = [];
|
||||||
const last: EntityHistoryState = states[states.length - 1];
|
const first: EntityHistoryState = states[0];
|
||||||
for (const state of states) {
|
for (const state of states) {
|
||||||
if (data.length > 0 && state.s === data[data.length - 1].state) {
|
if (data.length > 0 && state.s === data[data.length - 1].state) {
|
||||||
continue;
|
continue;
|
||||||
@ -282,7 +282,7 @@ const processTimelineEntity = (
|
|||||||
localize,
|
localize,
|
||||||
language,
|
language,
|
||||||
entityId,
|
entityId,
|
||||||
state.a || last.a,
|
state.a || first.a,
|
||||||
state.s
|
state.s
|
||||||
),
|
),
|
||||||
state: state.s,
|
state: state.s,
|
||||||
@ -307,7 +307,7 @@ const processLineChartEntities = (
|
|||||||
|
|
||||||
Object.keys(entities).forEach((entityId) => {
|
Object.keys(entities).forEach((entityId) => {
|
||||||
const states = entities[entityId];
|
const states = entities[entityId];
|
||||||
const last: EntityHistoryState = states[states.length - 1];
|
const first: EntityHistoryState = states[0];
|
||||||
const domain = computeDomain(entityId);
|
const domain = computeDomain(entityId);
|
||||||
const processedStates: LineChartState[] = [];
|
const processedStates: LineChartState[] = [];
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ const processLineChartEntities = (
|
|||||||
|
|
||||||
data.push({
|
data.push({
|
||||||
domain,
|
domain,
|
||||||
name: computeStateNameFromEntityAttributes(entityId, last.a),
|
name: computeStateNameFromEntityAttributes(entityId, first.a),
|
||||||
entity_id: entityId,
|
entity_id: entityId,
|
||||||
states: processedStates,
|
states: processedStates,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user