Do not overwrite an entity's state from an event if the state was not sampled

This commit is contained in:
Fabio Manganiello 2022-04-24 01:41:45 +02:00
parent a9751f21f1
commit 8e2154f2b5
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 2 additions and 0 deletions

View File

@ -238,6 +238,8 @@ export default {
this.clearEntityTimeouts(entityId)
const entity = {...event.entity}
if (event.entity?.state == null)
entity.state = this.entities[entityId]?.state
if (entity.meta?.name_override?.length)
entity.name = entity.meta.name_override
else if (this.entities[entityId]?.meta?.name_override?.length)