CropWatch Knowledge Base
EN English

Switching relays

A relay is a switch that CropWatch can turn on and off from your phone or computer. This guide covers how relays look on the dashboard, how to switch one and know that it worked, the timed pulse, the history of every change, who is allowed to switch, and alert rules that switch relays for you.

On this page

What a relay is

A relay board has two outputs, Relay 1 and Relay 2. Each one is a switch that can be wired to something you want to control from a distance: a pump, a heater, a fan, a vent motor.

CropWatch sends the board a command over the same radio network your sensors use, and the board answers with its new state. A relay board listens all the time, so a command usually reaches it and gets an answer within a few seconds. Between commands the board also reports its state on its own schedule.

The dashboard and the Relay History show what the board reported. Pressing a button sends a request; the board's answer is what confirms it.

Relays on the dashboard

The Greenhouse 1 column of the dashboard in card view. The GH1 Irrigation Relay card shows a green dot with On and a red dot with Off, and its open details list Relay 1 On, Relay 2 Off, Last Seen 6m 32s and a Details button

The first reading is Relay 1, the second Relay 2.

The first reading is Relay 1, the second Relay 2.

A relay board appears on the dashboard like any sensor. Its card shows two readings: the first is Relay 1, the second Relay 2. Each reads On or Off with a coloured dot in front, 🟢 On or 🔴 Off. The word always sits next to the dot, so the state can be read without relying on colour.

Open Details on the card to see the two relays by name, “Relay 1” and “Relay 2”, and how long ago the board last reported. In the table view the states appear as text in the Primary and Secondary columns, for example “Relay 1: 🟢 On” and “Relay 2: 🔴 Off”.

The dashboard shows the board's latest report. A command that is still waiting for an answer does not appear there; open the relay's page to follow it.

The relay's page

The top of the relay's page: the header with the period buttons and the Signal button, the Relay 1 card showing ON with Turn On greyed out, the Relay 2 card showing OFF with Turn Off greyed out, the closed Timed pulse control panel and the Last updated time

Below the header: the two relay cards, the pulse panel and the time of the latest report.

Below the header: the two relay cards, the pulse panel and the time of the latest report.

Open the relay with the Details button on its card, or from the list of sensors at its location. Below the header that every sensor page has, the page holds, from top to bottom:

  • Two cards, “Relay 1” and “Relay 2”: each headed “Current state”, with a switch picture, a label such as “🟢 ON” or “🔴 OFF”, and the buttons “Turn On” and “Turn Off”. The switch picture only shows the state; you cannot flip it.
  • “Timed pulse control”: a panel that opens when you press it, for switching a relay on for a set number of seconds.
  • “Last updated”: the date and time of the board's latest report.
  • “Relay History”: every state change and every command in the chosen period.

While the page is open, CropWatch fetches the board's state every 30 seconds, so a change made by a colleague or by an alert rule shows up without reloading.

A card that reads “Unknown”, with “No confirmed relay telemetry yet.” under it, means CropWatch has no report of that relay's state yet. Its buttons still work for anyone allowed to switch, so a command can still be sent.

Turning a relay on or off

The relay's page right after the board answered: the green message Relay 2 verified ON at the top right, and both relay cards showing ON

The green message confirms that the relay switched.

The green message confirms that the relay switched.
  1. Open the relay's page.
  2. On the card for the relay you want, press “Turn On” or “Turn Off”. The button that matches the current state is highlighted and greyed out: a relay that is already on cannot be turned on again.
  3. The button shows a spinner while the command goes out. Then a message appears: “Relay 1 command sent. Waiting for the device to confirm.”
  4. Wait. The board usually answers within seconds, and a green message confirms it: “Relay 1 verified 🟢 ON.”

That green message is the confirmation. Until you see it, the relay has been asked to switch, and that is all you know.

There is no “are you sure?” step. The command goes the moment you press the button, so check that you are on the right relay's page and the right card first.

While CropWatch waits for an answer

Both relay cards while CropWatch waits for an answer. The Relay 2 card already shows ON, with an amber Pending confirmation label and the line Command sent. Waiting for the device to confirm. All four buttons are greyed out

Until the board answers, the card shows the state you asked for and every button is grey.

Until the board answers, the card shows the state you asked for and every button is grey.

As soon as the command is sent, the card shows the state you asked for, with an amber “Pending confirmation” label and the line “Command sent. Waiting for the device to confirm.” What happens next depends on the board:

While CropWatch is waiting, every relay button on the page is greyed out, on both cards, for up to 60 seconds. You cannot send a second command to the board until the first one is settled or the 60 seconds are up.

What the relay card shows after you press a button
WhenWhat you seeWhat it means
Straight away“Pending confirmation” on the card.CropWatch looks for the board's answer after 5 seconds, then every 4 seconds.
After 20 seconds with no answer“No reply yet, so the device was asked to report its current state.”The answer was probably lost on the way. CropWatch asks the board to report again.
The board answers with the new stateA green message, “Relay 1 verified 🟢 ON.”, and the amber label goes away.The relay switched.
After 60 seconds, the board answered but still shows the old stateAn amber message, “Relay 1 still reports 🔴 OFF after the command.” The card shows the state the board reported.The relay did not switch.
After 60 seconds with no answer at allAn amber message, “Relay 1 hasn't confirmed yet. It will update when the device next reports.” The label changes to “Not confirmed yet” and the buttons work again.CropWatch has stopped waiting actively. The board's next report settles it.

When the relay does not answer

“Not confirmed yet” does not mean the relay failed. Either the command did not arrive, or it worked and only the answer was lost; at this point CropWatch cannot tell which. The card keeps showing the state you asked for, labelled “Not confirmed yet”, with the line “The device hasn't confirmed this yet. It will update automatically when the device next reports.” When the next report arrives, the card shows what the board says, with the green or amber message described above. You can leave the page in the meantime: Relay History records the result either way.

If the relay stays unconfirmed, or you get “still reports … after the command”:

  1. Check that the relay board has power.
  2. Press “Signal” on the relay's page and check that a gateway has heard it recently; see Gateways in the app.
  3. Look at Relay History. A result of “Didn't switch” means the board answered and kept its old state.
  4. Try the command once more. If it fails again, contact support.

Avoid pressing the buttons over and over. Each press is a separate command, and the history records every one.

Switching on for a set time

The Timed pulse control panel opened, with 300 typed in Pulse duration (seconds). Pulse Relay 1 is greyed out because Relay 1 is on, and Pulse Relay 2 can be pressed

300 seconds is five minutes. A relay that is on cannot be pulsed.

300 seconds is five minutes. A relay that is on cannot be pulsed.

“Timed pulse control” turns a relay on for the number of seconds you choose, and the board turns it off again by itself. Use it to run a pump for five minutes without having to come back and switch it off.

  1. On the relay's page, press “Timed pulse control” to open the panel.
  2. Type the length in “Pulse duration (seconds)”. It starts at 60; five minutes is 300.
  3. Press “Pulse Relay 1” or “Pulse Relay 2”.

The duration and the buttons follow these rules:

  • Whole seconds from 15 to 4294967: the upper limit is about 49 days. Anything else shows “Enter a whole number of seconds between 15 and 4294967.” and both pulse buttons stay grey.
  • The relay must be off: a pulse button is greyed out while its relay shows ON. Turn the relay off first.
  • Both relays' states must be known: if CropWatch has no report of a relay's state yet, the pulse is refused with “Timed relay pulse requires a confirmed current state for both relays”. Wait for the board's next report and try again.
  • The other relay is left alone: pulsing Relay 1 does not change Relay 2.

CropWatch waits for an answer as it does for an ordinary command, but it stops waiting when the pulse ends. For a short pulse, the amber label can simply disappear when the time is up, with no green message. The board reports a few seconds after a pulse finishes, and the result then appears in Relay History.

Relay History

The Relay History card, newest first: a Device reported a change row, the command Relay 2 to ON requested by Emma Hayes and Confirmed, an earlier Relay 1 to ON command, a Relay 2 to OFF command requested by Liam Chen, and a Status report requested row marked Answered

Each command shows who sent it and how the board answered. The board's own reports read Device reported a change.

Each command shows who sent it and how the board answered. The board's own reports read Device reported a change.

The “Relay History” card lists what happened to the relay, newest first, with the time to the second. The buttons at the top of the page choose the period: “Today Only” (selected when the page opens), “Last 24 Hours”, “Last 48 Hours” and “Last 72 Hours”. The longest you can look back is 72 hours.

The “Event” column has three kinds of row:

  • “Device reported a change”: the board reported that a relay changed state. The Relay 1 and Relay 2 columns show both states after the change, and the relay that changed has a filled label.
  • “Relay 1 → 🟢 ON”: a command sent from the relay's page; a pulse reads “Relay 1 → 🟢 ON for 300 s”. Under it are “Requested by” and the person's name. That relay's column shows the state the board reported in answer; the other relay's column shows a dash.
  • “Status report requested”: CropWatch asked the board to report because an answer was late. These rows appear by themselves while a command is waiting.

“No relay changes or commands in this period.” means nothing happened in the chosen period; pick a longer one to look further back. If the history cannot be fetched, a red message says “Unable to load relay history for the selected range.”

Commands sent by alert rules are not listed as commands. When a rule switches a relay, the history shows the board's report of it as “Device reported a change”, with no name.

The Result column, for commands and status requests
ResultWhat it means
ConfirmedThe board reported the state that was asked for.
AnsweredThe board replied to a status request.
Didn't switchThe board reported after the command and still showed the old state.
Not confirmedNo report settled it: the board stayed silent, a pulse ended unseen, or a newer command replaced it.
WaitingThe command is still within its waiting time, usually the first minute.

Who can switch a relay

Your permission level on the relay board decides what you can do. The levels are explained in The six levels.

  • Owner, Admin and Manager: see everything on the relay's page and use every button.
  • User and Viewer: see the same states and history, but the buttons and the duration box are greyed out, and a note reads “You need manager access or higher to queue relay commands.”
  • Disabled: cannot see the relay board at all.

CropWatch checks the level again when each command arrives. If someone lowers your level while you have the page open, pressing a button answers “You do not have permission to control this relay” and nothing is sent.

Alert rules that switch a relay

An alert rule can switch a relay as well as, or instead of, telling a person: start a fan when the temperature passes 30 °C, for example. In the rule's “4. Alert Actions” card, set “Action Type” to “LoRaWAN”. The rest of the rule is set up as described in Creating an alert rule.

The action then asks for:

  • “Device”: the relay board to switch. The list holds every sensor you have access to, each shown as its name and DevEUI, so pick the relay board by name.
  • “Action”: “Relay 1 ON for 5 seconds”, “Relay 2 ON for 5 seconds” or “Both relays ON for 5 seconds” (the number follows the box below), or “Relay 1 permanently ON”, “Relay 1 permanently OFF”, “Relay 2 permanently ON” or “Relay 2 permanently OFF”.
  • “On time in seconds”: shown for the timed actions only, from 1 to 86400 (24 hours).

The tick box “Revert relay state when the rule resets” can only be ticked with the four permanently ON or OFF actions. When the rule resets with the box ticked, CropWatch sends the board one command that switches both relays off. It does not put each relay back the way it was:

  • With “Relay 1 permanently ON”, Relay 1 goes off at reset, and so does Relay 2 if it was on.
  • With a permanently OFF action, the reset does not turn the relay back on; it switches both relays off.

If the other relay on the same board runs equipment that must stay on, leave the box unticked.

While a timed switch-on sent by a rule is still running, CropWatch sends that board no other rule command. It waits until the time is up, plus a few seconds.

Messages and what to do

Some of these messages come from CropWatch's server and are always in English, whatever language you use the app in.

About “Device is missing a valid TTI device id”: a relay board added with the guided steps in Adding a sensor is given its radio network name automatically. For any other board, ask support to set it.

Messages on the relay page
MessageWhat it meansWhat to do
You need manager access or higher to queue relay commands.Your level on this relay board is below Manager.Ask an Admin at the location to raise your level.
You do not have permission to control this relayThe same, found when the command arrived.Ask an Admin at the location to raise your level.
A relay command is already in progress for device, followed by the DevEUISomeone sent a command to this board at the same moment.Wait a few seconds, look at the card, then decide whether to try again.
Timed relay pulse requires the target relay to currently be offCropWatch's latest report says the relay is on.Turn it off first, or wait for the next report.
Timed relay pulse requires a confirmed current state for both relaysCropWatch has no report of one relay's state.Wait for the board's next report.
Device is missing a valid TTI device idThe board is missing the name that addresses it on the radio network, so CropWatch cannot send it anything.Contact support. This cannot be fixed from the app.
TTI relay request failedThe radio network did not accept the command.Try again in a minute. If it keeps happening, contact support.
Unable to update the relay right now.The command could not be sent, for example because your connection dropped.Check your internet connection and try again.
Unable to load relay history for the selected range.The history could not be fetched.Press the period button again, or reload the page.

Quick answers

  • I pressed Turn On and nothing seems to have happened. Look at the card. “Pending confirmation” means CropWatch is waiting for the board; give it up to a minute.
  • All the buttons are grey. Either a command is still waiting for an answer (up to 60 seconds), or your level is below Manager, in which case a note under the controls says so.
  • Turn On is grey, but I know the relay is off. CropWatch's latest report says it is on. Wait for the board's next report, or check Relay History for the last change.
  • The dashboard still says Off after I turned the relay on. The dashboard follows the board's reports. Open the relay's page to see whether the command has been confirmed.
  • Who switched this relay? Relay History shows “Requested by” and a name under each command sent from the relay's page. Changes made by alert rules show as “Device reported a change”.
  • Why will the pulse not accept 10 seconds? The shortest pulse is 15 seconds.
  • Can I see what happened last week? Not on this page. Relay History goes back at most 72 hours.