Show the entity id that first used the context in logbook

This commit is contained in:
J. Nick Koston 2020-08-24 12:45:04 -05:00 committed by GitHub
commit 5989560f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -7,6 +7,12 @@ export interface LogbookEntry {
entity_id?: string;
domain: string;
context_user_id?: string;
context_event_type?: string;
context_domain?: string;
context_service?: string;
context_entity_id?: string;
context_entity_id_name?: string;
context_name?: string;
}
const DATA_CACHE: {

View File

@ -118,6 +118,26 @@ class HaLogbook extends LitElement {
? ` (${item_username})`
: ``}</span
>
${!item.context_event_type
? ""
: item.context_event_type === "call_service"
? // Service Call
html` by service ${item.context_domain}.${item.context_service}`
: item.context_entity_id === item.entity_id
? // HomeKit or something that self references
html` by
${item.context_name
? item.context_name
: item.context_event_type}`
: // Another entity such as an automation or script
html` by
<a
href="#"
@click=${this._entityClicked}
.entityId=${item.context_entity_id}
class="name"
>${item.context_entity_id_name}</a
>`}
</div>
</div>
</div>