このページはまだ日本語に翻訳されていないため、英語で表示しています。
Creating an alert rule
A rule watches a reading and tells you when it goes outside the range you are happy with. This guide makes one from start to finish, in the order the screen asks for it.
このページの内容
- What a rule does
- Before you start
- Open the Rules page
- Step 1: Name the rule
- Step 2: Choose the devices
- Step 3: Say when it should alert
- Trigger value and reset value
- Using more than one condition
- Step 4: Choose who is told
- Check the summary, then create the rule
- What happens next
- Changing, pausing or removing a rule
- Things that catch people out
- 関連リンク
A rule watches one reading from one or more of your sensors and tells you when it goes outside the range you are happy with.
Here is the example used all the way through this guide. A greenhouse must not get colder than 5 °C at night. A rule can watch the air sensor in that greenhouse and send a message the moment the temperature drops below 5 °C, so somebody can do something about it before the plants are damaged.
Until you create a rule, CropWatch records readings but never contacts you. Rules are the part that reaches out.
You need:
- A sensor that is already sending readings. If it is not, start with Installing a gateway.
- Your CropWatch sign-in.
- An answer to four questions: which sensor, which reading, at what number, and who should be told.
Making a rule takes about five minutes. Nothing you do here can harm the sensor.
- Sign in to CropWatch.
- Go to Rules in the menu. You will see a list headed Rule Templates, with any rules you already have.
- Press the + button above the list, on the right.
CropWatch calls a rule a “rule template” because one rule can watch several sensors at once. It is the same thing.
The first card is headed “1. Template”. Two boxes and a switch:
- Rule Name — what you want to read in a message at two in the morning. “Greenhouse too cold” tells you more than “Temp rule 3”. This name appears in the alert you receive.
- Description — optional. A note for whoever looks at this rule next, which might be you in six months.
- Active rule — leave this switched on. Switched off, the rule is kept but never checked. That is how you pause a rule without losing it.
The second card is headed “2. Device Assignments”. Open the “Device” box and tick the sensors this rule should watch. They are grouped by location, and you can type in the box to filter the list.
You can tick more than one. Each sensor is then watched on its own: if two greenhouses both get too cold, you are told about each of them separately.
The long code in brackets after each name is the sensor's serial number. It is there so you can tell apart two sensors with the same name.
The third card is headed “3. Alert Criteria”. This is where you set the limit, and it has four parts:
- Data Field — which reading to watch: Temperature (°C), Humidity (%), CO₂ (ppm), Soil Moisture, Water Depth (cm) and others. Pick one your sensor actually measures.
- Operator — how to compare it: “Less than (<)”, “Greater than (>)”, “Less than or equal (<=)”, “Greater than or equal (>=)” or “Equals (=)”.
- Trigger Value — the number that sets the alert off.
- Reset Value — the number the reading must come back to before the alert can happen again. The next section explains this one properly.
For the cold greenhouse: Data Field “Temperature (°C)”, Operator “Less than (<)”, Trigger Value 5, Reset Value 7.
The “Range” choice in the Operator list cannot be saved. If you pick it, the form says “Unsupported operator.” and the save button stays greyed out. To watch a band of values, use two conditions instead — see below.
This is the part people find confusing, and it is worth two minutes because it decides whether you get one useful message or forty useless ones.
A sensor might send a reading every ten minutes. On a cold night the temperature could sit below 5 °C for six hours. You do not want thirty-six messages.
So CropWatch does this:
- The temperature drops below 5 °C. You get one message.
- It stays below 5 °C. Nothing more is sent. The rule is holding.
- It climbs back to 7 °C. The rule resets, and you get a message saying it is back to normal.
- If it drops below 5 °C again after that, you get a new message.
The reset value is what re-arms the rule. Put it on the safe side of the trigger, with a gap:
- Watching for too low (Less than 5), the reset must be higher — 7, say.
- Watching for too high (Greater than 30), the reset must be lower — 28, say.
Put the reset on the wrong side — Greater than 30 resetting at 35 — and the rule alerts and resets on every single reading. That is the flood of messages everyone wants to avoid.
How big a gap? Enough that normal wobble does not cross it. A degree or two for temperature is usually right.
“+ Add Another Condition” adds a second test. Everything you add must be true at the same moment for the alert to happen.
That makes some things easy and one thing impossible, so it is worth knowing which is which.
- Both at once — “CO₂ above 1000 and humidity above 80%” is one rule with two conditions.
- A band of values — “between 20 °C and 30 °C” is one rule with two conditions: Greater than 20, and Less than 30.
- Either one or the other — “colder than 5 °C or hotter than 35 °C” cannot be one rule, because the two can never both be true. Make two rules.
The fourth card is headed “4. Alert Actions”. CropWatch has already added one for you: a push notification to yourself. Change it or add more.
Open “Action Type” and pick one:
- Push — a notification on the phone or computer of the people you choose. Anyone who has not set up notifications is shown as “Push not set up” and will not get anything.
- EMail — type one address in the “Recipient” box. For a second address, add a second action rather than typing two addresses in one box.
- LINE — pick people from the list. Anyone shown as “LINE not linked” has not connected LINE to CropWatch yet and will not receive the message.
- LoRaWAN — switches a relay instead of telling a person: turn on a heater, open a vent. It asks which device to switch and for how long. Ask us before using this one.
Use “Add Action” for as many as you need. A rule can email one person, push to another and switch a heater, all at once.
The last card shows “Rule Summary”: the name, whether it is active, the sensors it watches and the conditions. Read it once. It is written the way the rule will actually behave, which is the best chance to catch a slip.
If you see “Complete all required fields above to see a preview of your rule.” instead, something is still missing. It is almost always one of these:
- No name.
- No sensor ticked.
- A trigger or reset value left empty.
- An action with nobody to send to.
- The “Range” operator, which cannot be saved.
Then press “Create Rule”. A green message confirms it and you are taken back to the list, where your rule now appears.
The rule starts working straight away, but nothing happens until a sensor sends a reading that crosses your limit. Readings from before you made the rule are not looked at.
When it does fire, everyone on the action list is told, with the rule's name and which sensor it was. When the reading comes back past the reset value, a second message says it is back to normal.
A rule can only see readings that arrive. If a sensor stops reporting — flat battery, gateway offline — a “too cold” rule stays silent, because nothing is coming in to be too cold. Check the dashboard for sensors that have gone quiet.
Each row on the Rules page has three small buttons on the right:
- The pencil opens the rule so you can change it. It is the same form; the last button now says “Save Changes”.
- The clock shows the history: when this rule fired, and for which sensor.
- The bin deletes the rule. It asks first, and it cannot be undone.
To stop a rule for a while without losing it — you are working in the greenhouse and the door is open — open it with the pencil and switch “Active rule” off. Switch it back on when you are done.
- The reset value on the wrong side. The commonest mistake, and it produces a stream of messages. See Trigger value and reset value.
- Expecting “or”. Conditions in one rule must all be true together. Too cold or too hot needs two rules.
- A rule left switched off. If a rule never fires, check “Active rule” first.
- A mistyped email address. Nothing warns you. The message is simply sent into nowhere.
- Someone who has not linked LINE. They appear in the list, they can be selected, and they receive nothing.
- Too tight a limit. A limit set where the reading normally sits means constant messages, and messages people ignore are worse than none.