Skip to content

Commit

Permalink
document if/ifnot
Browse files Browse the repository at this point in the history
  • Loading branch information
keenanlang committed Aug 9, 2024
1 parent 21b1634 commit 6404d87
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/nodes/logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand All @@ -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
Expand All @@ -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

```

0 comments on commit 6404d87

Please sign in to comment.