Skip to content

Commit

Permalink
Support services without entities
Browse files Browse the repository at this point in the history
  • Loading branch information
EdLeckert authored and daringer committed Mar 18, 2024
1 parent f7cf240 commit e967490
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions flex-table-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,16 @@ class FlexTableCard extends HTMLElement {
}).then(return_response => {
const entities = new Array();
Object.keys(return_response.response).forEach((entity_id, idx) => {
const entity_key = (Object.keys(return_response.response))[idx];
const resp_obj = { "entity_id": entity_id, "attributes": return_response.response[entity_key] };
let resp_obj = {};
if (entity_list.length > 0) {
// Return payload(s) below entity key(s).
const entity_key = (Object.keys(return_response.response))[idx];
resp_obj = { "entity_id": entity_id, "attributes": return_response.response[entity_key] };
}
else {
// Return entire response payload.
resp_obj = { "entity_id": entity_id, "attributes": return_response.response };
}
entities.push(resp_obj);
})
this._fill_card(entities, config, root);
Expand Down

0 comments on commit e967490

Please sign in to comment.