From 6404d8742d0d62cc864fe1b8e1ff48f48c918fb2 Mon Sep 17 00:00:00 2001 From: keenanlang Date: Fri, 9 Aug 2024 16:25:47 -0500 Subject: [PATCH] document if/ifnot --- docs/nodes/logic.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/nodes/logic.md b/docs/nodes/logic.md index 45e0372..4d5a49c 100644 --- a/docs/nodes/logic.md +++ b/docs/nodes/logic.md @@ -84,7 +84,13 @@ input data. The macro named by the `condition` macro is parsed and treated as a truthy value in python. If the macro's data is equivalent to a true value, then the conditional's contents are included in -the resulting UI screen. Otherwise, none of the children widgets are included. +the resulting UI screen. Otherwise, none of the children widgets are included. The condition can +be negated by using the '!Not' type indicator. + +Two aliases are also allowed, '!If' and '!IfNot'. These include the necessary condition in their tag +name. So, using the tag '!If:my-condition' would be equivalent to creating a '!Conditional' with the +condition of '"my-condition"'. And '!IfNot:my-condition' is the equivalent of creating a '!Conditional' +with the condition of '!Not "my-condition"'. * **Special Attributes** @@ -101,7 +107,7 @@ the resulting UI screen. Otherwise, none of the children widgets are included. * **Example** ```yaml -- !conditional +HaveLED: !conditional condition: "INCLUDE_LED" geometry: 0x20 x 0x0 @@ -115,5 +121,16 @@ the resulting UI screen. Otherwise, none of the children widgets are included. border-color: *transparent geometry: 15x0 x 22x22 + +SimplerVersion: !If:INCLUDE_LED + - !LED + pv: "xxx:yyy:bi.VAL" + true-color: *alarm_red + false-color: *alarm_green + + border-color: *transparent + + geometry: 15x0 x 22x22 + ```