AND
Parameters
Returns
Places a time list on the stack.
Description
This function calculates the time frames where both frame_a and frame_b where active at the same time.
Example
In this example, we have two sensors - one detects if our air-conditioner is running, one is a door sensor that lets us know if the door is open.
We'd like to know if our staff are wasting power by running the air-con and at the same time leaving the door wide open.
First, we make a query to get the times when the door was open…
'Door' ASSET 'Status - Door' PROPERTY VALUES { “range”: “24 hours”, “method”: “raw” } GETHISTORY [ 0 EQUAL ] WHERE
Next, we make a query to get the times when the air-conditioner was running…
'ACUnit' ASSET 'Status - Running' PROPERTY VALUES { “range”: “24 hours”, “method”: “raw” } GETHISTORY [ 1 EQUAL ] WHERE
Our final query can and these two together…
'Door' ASSET 'Status - Door' PROPERTY VALUES { “range”: “24 hours”, “method”: “raw” } GETHISTORY [ 0 EQUAL ] WHERE 'ACUnit' ASSET 'Status - Running' PROPERTY VALUES { “range”: “24 hours”, “method”: “raw” } GETHISTORY [ 1 EQUAL ] WHERE AND HOURS
This translates to “Show me the total number of hours where the AC unit was on (1) and the door was open (0) in the last 24 hours”
You can perform the opposite function - adding the two time frames together - with the OR function.