Resolves #446 Fix conditional crads
This commit is contained in:
parent
e2e6c015de
commit
8c2316a51a
@ -25,14 +25,15 @@ class CardWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.conditions.isNotEmpty) {
|
if (card.conditions.isNotEmpty) {
|
||||||
bool showCardByConditions = false;
|
bool showCardByConditions = true;
|
||||||
for (var condition in card.conditions) {
|
for (var condition in card.conditions) {
|
||||||
Entity conditionEntity = HomeAssistant().entities.get(condition['entity']);
|
Entity conditionEntity = HomeAssistant().entities.get(condition['entity']);
|
||||||
if (conditionEntity != null &&
|
if (conditionEntity != null &&
|
||||||
(condition['state'] != null && conditionEntity.state == condition['state']) ||
|
((condition['state'] != null && conditionEntity.state != condition['state']) ||
|
||||||
(condition['state_not'] != null && conditionEntity.state != condition['state_not'])
|
(condition['state_not'] != null && conditionEntity.state == condition['state_not']))
|
||||||
) {
|
) {
|
||||||
showCardByConditions = true;
|
showCardByConditions = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!showCardByConditions) {
|
if (!showCardByConditions) {
|
||||||
|
Reference in New Issue
Block a user