Logical operations
This recipe uses
- 2 Switch Elements to control 2 boolean input values.
- 1 AND Element to calculate a logical AND result
- 1 OR Element to calculate a logical OR result
This example can be operated the best on the web ui as there are no pins assigned.
By using 2 Switch Elements to control 2 boolean input values.
These values are sent to 2 logical elements the AND Element and the OR Element where the calculated outputs are displayed.
{
"switch": {
"in1": {
"onvalue": "and/a?value[0]=$v,or/o?value[0]=$v"
},
"in2": {
"onvalue": "and/a?value[1]=$v,or/o?value[1]=$v"
}
},
"and": {
"a": {
"description": "Logical AND",
"invert": "false",
"value": [
"true",
"false"
],
"onvalue": "device/0?log=AND:$v",
"title": "and/a"
}
},
"or": {
"o": {
"description": "Logical OR",
"invert": "false",
"value": [
"true",
"false"
],
"onvalue": "device/0?log=OR:$v",
"title": "or/o"
}
}
}