The OPS allows you to associate multiple conditions with an OPS object.
opsObj.correlate("correlation expression")
Method |
Description |
---|---|
opsObj |
Specifies an OPS object. It is obtained through ops.ops() instantiation. |
correlation expression |
The value is a string of a maximum of 128 characters, consisting of a condition identifier string and an operator (and, or, or andnot). Operators and and andnot have the same priority, which is greater than that of or. |
test.py import ops def ops_condition(_ops): ret1, reason1 = _ops.cli.subscribe("con1","display device",True,True,False,20) ret2, reason2 = _ops.cli.subscribe("con2","display this",True,True,False,20) _ops.correlate("con1 and con2") def ops_execute(_ops): _ops.terminal.write("Hello world!",None) return 0
When con1 and con2 are both met, the assistant is triggered.