Advanced Pages Events
|Version||Status||Date Updated||Updated By|
The easiest way to add event handlers is using the Wizard > Events Handler > Respond to Events or Wizard > Events Handler > Timed Events. The most common event scenarios are "pre-built" there, such as responding to a sensor, or doing something when someone is watching media. Here in the advanced event section it is more complicated because you have total flexibility to define any event handler you want to respond to any event, and compare it against any criteria.
You could, for example, say that when the sun sets and it is less than 32 degrees outside and it is winter and the house is either in armed mode or extended away mode, or it is less than 20 degrees, then you want LinuxMCE to turn on a heat pump. You can see the flexibility is great, but, understandably it is more complicated to create such an event.
If you are familiar with programming concepts like if statements, then this will be fairly natural. First you choose the event you want the handler to respond to. In the above example it would be 'sun set'. The criteria section is where you build the 'if' clause that you want to be evaluated when LinuxMCE sees the event. You can nest criteria like: if( a=b and b=c and c=d and (d=e or e=f) ) by choosing 'add segment'. Each nesting level can be either an 'and' or an 'or'. If you want to mix them, as was in the a=b example, you create a new segment. You can also check the 'Not' box to make the segment be the inverse. For each expression you choose the 'what to compare', the 'operator' (ie <, >, =, <>) and what value to compare it to.
Then in the 'actions' section you choose what commands or actions you want executed when the event occurs and the criteria evaluates to true.