Events and rules
Event: Text read
Section titled “Event: Text read”Each reader has its own event Text read, in the event tree under Text recognition > reader name. There is one event per area and read.
| Value | What it holds | Placeholder |
|---|---|---|
| Area | The area’s name, a choice of the reader’s areas | {area} |
| Text | With a format: the match. Without: all lines, joined on one line | {text} |
| Text read | Everything in the area as read, without the format: one line per row | {textRead} |
| All matches | Every different match of the format, separated by a space, at most 10. Empty without a format | {allMatches} |
| Number | The value as a number when it is one, . or , as the decimal sign. Empty otherwise |
{number} |
| Confidence | 0 to 100, from the value’s least sure character | {confidence} |
| Matches format | Yes when the value matches the area’s format. Always no for Any text | {matchesFormat} |
1234,5 gives the Number 1234.5 and 00815 gives 815.
Text never holds a line break, so use it for checks. Text read holds one for each row: a check with equals, or
with contains across two rows, does not match it, and a message with {textRead} has several lines.
The placeholders work in every text of an action, next to OADM’s own such as {time} and {device}. See
Placeholders.
When it fires
Section titled “When it fires”| Reader | Fires |
|---|---|
| Watching | When an area’s text changes and holds: the reader compares the last 5 pictures and sends the new text once 2 pictures in a row agree. A single bad picture changes nothing |
| Watching with Moving objects | Once a value was read in 2 pictures in a row |
| On action | For every area with text, every time Read text runs, changed or not |
| No text in an area | Never. That is No text read |
| Live results on the page, also while paused | Never |
To test a rule, select the lightning icon right of Mode on a saved On action reader. It reads one picture and fires the real event, so the rule runs its actions.
Typical checks
Section titled “Typical checks”| Check | Fires when |
|---|---|
| Matches format is yes | A format matched |
| Confidence > 90 | The read is sure |
| Number > 5000 | A meter passes a value |
Text contains LOADING |
A sign shows a word |
Area equals Container number |
One area of the reader |
Reads close together
Section titled “Reads close together”A rule’s Dead time (default 10 s) counts per camera: after a run the rule skips every further read of that camera for that time, from any area and with any text.
For two areas that read at the same moment, or for containers and vehicles passing one after the other, set Dead time to 0:
- A watching reader fires only when the text changes, so the same text does not repeat.
- Max per minute still limits the rule. Raise it for a busy gate.
- Add a check such as Matches format is yes, so that other text in the area runs nothing.
- A rule that runs Read text with its own reader is then limited by Max per minute alone.
Event: No text read
Section titled “Event: No text read”Each reader also has the event No text read, next to Text read, with the value Area ({area}). Use it in its own
rule, so it never uses up the dead time of a rule on real reads.
| Reader | Fires |
|---|---|
| Watching | Once when an area’s value is gone, after the same vote as Text read, also while other text is in the area |
| Read text | For every area with no text, each time it runs, on any reader |
With Read text, text that does not match the format is not No text read: it fires Text read with Matches format no. A watching reader sends nothing for such text.
Event: Reader problem
Section titled “Event: Reader problem”Each reader also has the event Reader problem, next to Text read. It is on while the reader’s chip on the page is red and off when the reader reads again, so a rule can tell a broken reader from a quiet gate.
| Event | On while | Values |
|---|---|---|
| Reader problem | This reader has a problem | Reader, Problem ({reader}, {problem}) |
| Any reader problem | At least one reader has a problem, new readers included | {count}, {reader} with the names |
| Optional plugin not loaded, folder Optional plugins | Text recognition must be installed again after an update | {count}, {plugin} |
An On action reader has no stream that could fail: Reader problem also turns on when Read text fails, and off with the next good read.
Any reader problem runs a rule once, when the first reader fails. A second reader failing while it is on runs nothing new. Use Reader problem to hear of each reader.
Action: Read text
Section titled “Action: Read text”Read text, in the group Text recognition, reads one picture of the chosen Reader now and sends Text read or No text read for each area. The event log lists what each area read.
| Reader | Result |
|---|---|
| On action | Reads one picture |
| On action, still reading | Skipped with Already reading. Nothing is queued |
| Watching | Answers with what it read in the last second, or with the picture it is reading |
| Without an area | The log says The reader has no area. Draw one on the Text recognition page. |
Example rules
Section titled “Example rules”Each rule starts with New rule in Event rules. When is Text read of the reader.
| Goal | Reader | Checks | Then |
|---|---|---|---|
| Email for a container at the gate | Watching, 2 frames per second, @@@U ###### # |
Matches format is yes, Confidence > 90 | Send email, subject Container {text} at gate 2 |
| Alert above a meter value | Watching, 1 frame per second, small area, ##### |
Number > 5000 | Send email or Send HTTP request with {number} |
| Order code on a counter | Watching, 1 frame per second, highest resolution, one large area, ##@#@ |
Matches format is yes | Send HTTP request with {text}, or {allMatches} for several receipts |
| A sign shows LOADING | Watching, 1 frame per second, Any text | Text contains LOADING |
Set output to switch a lamp on, or Send email |
Read a number when a truck stops at the scale
Section titled “Read a number when a truck stops at the scale”- On the camera, set up an AXIS Object Analytics scenario Object in area for vehicles over the scale.
- Add the scenario’s event as a Device trigger.
- Create a reader on the camera, On action, with an area where the number is when a truck stands on the scale,
format
@@@U ###### #. Click Save. - Rule 1: When the scenario’s event, Then Read text with the reader.
- Rule 2: When Text read of the reader, Add check Matches format is yes, Then Send HTTP request to
your weighing system with
{text}.
On a dashboard
Section titled “On a dashboard”- In the dashboard’s Events, click Text read under Text recognition / reader name. The widget uses the reader’s camera.
- Choose the Area.
- Choose the Value, such as Text, Number or Confidence.
Each widget shows one area and goes blank when its text is gone, and a table lists only that area’s reads. A widget whose area was renamed or deleted says Area no longer exists: choose the area again in its settings.
To read on demand, put a button on a dashboard whose rule runs Read text.