From 4492f4df1fe0937cfc1527e05a384eb63f426fe1 Mon Sep 17 00:00:00 2001 From: Daniel Albert <7432848+esclear@users.noreply.github.com> Date: Tue, 27 Dec 2022 14:14:18 +0100 Subject: [PATCH] Fix state / state_not logic error for entities (#637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- apps/nspanel-lovelace-ui/luibackend/pages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 74bdedb8..6bef5d10 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -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