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 untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

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