Fix state / state_not logic error for entities (#637)

According to the documentation, an entity is only displayed
* if `state` is set: if the entity state is equal to the `state` value
* if `state_not` is set: if the entity state is _not_ equal to the `state_not` value

So `""` – an **empty** string – shall only be returned – i.e. the **entity be hidden**
* if `state` is set: if the entity state is **not** equal to the `state` value
* if `state_not` is set: if the entity state is equal to the `state_not` value

Co-authored-by: Daniel Albert <esclear@users.noreply.github.com>
This commit is contained in:
Daniel Albert
2022-12-27 14:14:18 +01:00
committed by GitHub
parent d83cebdf29
commit 4f66d0eaca

View File

@@ -256,9 +256,9 @@ class LuiPagesGen(object):
# HA Entities
entity = apis.ha_api.get_entity(entityId)
# check state for if a condition is defined
if item.condState is not None and item.condState == entity.state:
if item.condState is not None and item.condState != entity.state:
return ""
if item.condStateNot is not None and item.condStateNot != entity.state:
if item.condStateNot is not None and item.condStateNot == entity.state:
return ""
# common res vars