Statuses
Create, set, find, and delete statuses, and read their notifications.
A status is a named record of the current condition of one thing, such as “Tank pressure”. Arc automations, scripts, tasks, and people set statuses, and the Synnax Console shows each change as a notification. Statuses are the base of alarms in Synnax.
Set a status
Setting a status with a key that already exists replaces every field except its labels. Give every other field each time, or the fields that you leave out become empty.
Console
Python
TypeScript
Arc
- Run the “Create status” command from the command palette, or click in the statuses toolbar or the status explorer.
- Enter a name, then select a Variant and enter a Message.
- Optional: select labels.
- Click Create.
import synnax as sy
client.statuses.set(
sy.Status(
key="tank-pressure",
name="Tank pressure",
variant="warning",
message="Above 600 psi",
description="Vent the tank before you continue.",
)
)await client.statuses.set({
key: "tank-pressure",
name: "Tank pressure",
variant: "warning",
message: "Above 600 psi",
description: "Vent the tank before you continue.",
});An Arc automation sets a status when a condition is true.
status.set finds the status by its key or its name, and creates it when none matches:
import status
tank_pressure > 600.0 => status.set(
key_or_name="tank-pressure",
variant="warning",
message="Tank pressure is above 600 psi",
)To set the status once for each change, and to clear it, see Arc alarms.
Find statuses
Console
Python
TypeScript
Press S or click on the left side of the Console to open the statuses toolbar. It shows your favorite statuses with their variant, name, message, labels, and the time since their last change.
To see every status, run the “Open status explorer” command, or click the explore button in the statuses toolbar. In the explorer, search by name and filter by label and by variant.
status = client.statuses.retrieve(key="tank-pressure")
errors = client.statuses.retrieve(variant="error")
tank = client.statuses.retrieve(search_term="tank", limit=10)const status = await client.statuses.retrieve("tank-pressure");
const errors = await client.statuses.retrieve({ variant: "error" });
const tank = await client.statuses.retrieve({ searchTerm: "tank", limit: 10 });Rename, favorite, or delete statuses
Console
Python
TypeScript
In the status explorer, right-click one or more statuses and select:
- Rename -> change the name of one status.
- Favorite or Unfavorite -> add them to the statuses toolbar or remove them.
- Copy diagnostics -> copy the details to the clipboard.
- Delete -> delete them, after you confirm.
client.statuses.rename("tank-pressure", "Main tank pressure")
client.statuses.delete("tank-pressure")await client.statuses.rename("tank-pressure", "Main tank pressure");
await client.statuses.delete("tank-pressure");Notifications
When a status changes, the Console shows a notification in the corner of the window.
- The Console shows notifications only while it is connected to the Core.
- A notification closes 7 seconds after the Console gets the status.
- The Console shows one notification for each status key. A new change replaces it.
- Different statuses with the same name, variant, message, and description merge into one notification with a count.
- The Console shows up to four notifications. Click +N more to see the rest, and Clear all to close them.
- When you close a notification, the Console does not show that status again until you restart it.
Tasks, Drivers, devices, and calculated channels set statuses too. The Console shows only their warnings and errors, and only for things that are in use:
- A device is in use when it is configured.
- A Driver scanner, which looks for one kind of device, is in use when its Driver has a configured device of that kind.
- Every other task, each Driver, and each calculated channel is always in use.
A warning from a task, device, or Driver shows only if it does not clear within 5 seconds.
When you send a command to a task, such as start or stop, the Console shows the answer unless it is a success, loading, or disabled status.
Reference
Fields
Labels
Labels group related statuses. Give a status its labels when you create it: select them
in the Console, or set labels in code. A later set keeps the stored labels. To change
the labels of a status that exists, use the label client:
Python
TypeScript
client.labels.label(sy.status.resource_id("tank-pressure"), label.key)await client.labels.label(status.resourceID("tank-pressure"), [label.key]);