Build a dashboard for one device model
A dashboard for one device model combines the same parts every time: pages under one header with live controls, two polling cohorts, a banner when the device connection is down, and trends of the main readings. This guide puts them together. Each component is described in Device dashboard components.
Lay out the pages
Section titled “Lay out the pages”-
Wrap the dashboard in
DevicePresetLayout. Give each page anid, apath, alabel, the readings it polls (fastIds), and the settings it polls (slowIds):<DevicePresetLayoutid="pump-controller-dashboard"title={copy.title}subtitle={copy.subtitle}image={{ src: photoUrl, alt: copy.frontPanel }}workspaceId={props.workspaceId}dashboardId={props.dashboardId}pages={[{ id: "overview", path: "/", label: copy.overview, fastIds: readingIds, slowIds: [] },{id: "settings",path: "/settings",label: copy.settings,fastIds: [],slowIds: settingIds,},]}>{({ page, connected, readAgain }) =>page === "overview" ? (<Overview connected={connected} />) : (<Settings connected={connected} onReadAgain={readAgain} />)}</DevicePresetLayout> -
Put registers that some firmware versions lack in
optionalIds. Where such a reading appears, show it as not supported whenisUnsupportedParameterValue(state)is true. -
For a banner that applies on every page, such as a device mode the operator should end, use
notices. Add the values the notice reads to every page’sfastIdsorslowIds. -
If the dashboard needs another frame, build it from
useDevicePresetValues,DevicePresetHeaderwith the compactParameterLiveControls,DashboardPageTabs,DeviceEndpointUnavailable, andParameterDiagnostics. For several devices, calluseDevicePresetValuesonce per device.
Show readings
Section titled “Show readings”- Show each reading as its parameter formats it, with
ParameterValueDisplaywithout children, and take its unit fromuseParameterUnit(parameterId, locale). The dashboard then follows the scaling and units configured on the parameters instead of repeating them. - For a trend, pass the series to
ParameterTrendChart. SetfollowClockto true when the reading is not fresh, so a stalled reading shows as a trailing gap. - When the operator can hide series, pass each series’
colorIndex, so it keeps its color.
Build the overview page
Section titled “Build the overview page”- Put a
DeviceStatusBarofDeviceStatusBadges at the top, then a column of cards. - Show headline values with
DeviceKeyFigure, and frame everything else inDevicePanels. - Show phase readings in
DevicePhaseTableand other readings inDeviceReadingList; tables with the same columns line up. - Order the page for a phone user: put active faults and commands before the long tables.
- Place the cards in columns on wide screens with container queries.
Edit device settings
Section titled “Edit device settings”-
Poll the settings in the slow cohort of the page that shows them.
DeviceSettingsSectionshows only values that the page already polls. -
Add one
DeviceSettingsSectionper group of settings, withkeys,bindings,labels, and aspecsentry for each key:<DeviceSettingsSectionid="power-limit"icon={<GaugeIcon />}title={copy.powerLimit}description={copy.powerLimitDescription}keys={["ratedPower", "tripDelay", "overcurrent", "overcurrentDelay"]}bindings={bindings.powerLimit}specs={{ratedPower: deviceSettingNumber(3, 450),tripDelay: deviceSettingNumber(0, 300),overcurrent: deviceSettingChoice(0, 1),overcurrentDelay: deviceSettingNumber(0.3, 600, 1),}}labels={labels}locale={locale}canWrite={canWrite && connected}optionLabel={(key, value) => (key === "overcurrent" ? onOffLabel(value) : null)}>{(section) => (<>{section.number("ratedPower")}{section.number("tripDelay", { hint: copy.tripDelayHint })}{section.switched("overcurrent", { title: copy.overcurrent, options: onOff }, () =>section.number("overcurrentDelay"),)}</>)}</DeviceSettingsSection> -
Build every row while the
childrenfunction runs, by calling the section’s row helpers andkeepthere or in plain helper functions. Do not render components that build rows later: the section resets the edits of rows it did not see, so their drafts are lost. -
For rules between settings, such as a lower limit below an upper one, pass
validate. Return messages only for settings the layout shows. -
When the drafts depend on another value that is being read, such as a mode, pass
pendingRead. -
When a helper proposes drafts with
setDraft, offer it only whileeditableis true. -
When a write changes other settings on the device, such as a mode that resets them, read those settings again in
onWritten. -
When the device needs its writes in order, pass a
plan. Give each step that writes none of the changes, such as an unlock or a save to device memory, alabel:plan={(changes) => [{ label: copy.unlock, items: [{ paramId: bindings.password, value: password }] },...defaultDeviceSettingsWritePlan(changes),{ label: copy.saveToMemory, items: [{ paramId: bindings.command, value: SAVE_COMMAND }] }, // from the device manual]} -
When the device needs a password, pass
unlock; see Ask for a device password. -
To say how to unlock a device that acknowledged a write but did not keep it, set
notKeptMessage. UseonVerifiedfor follow-ups, such as a banner that asks for a restart. -
Put the sections in a
DeviceSettingsPageinside an@container, with anintroandonReadAgain. -
Next to the settings, state what the drafts do with
DeviceSettingOutcome. For a gauge, read the values withuseDeviceReadings(parameterIds)and pass itsstaleSinceto the gauge.
Add commands
Section titled “Add commands”- Add a
DeviceCommandButtonwith alabel, thelocale, andsteps. - To explain the command in the confirmation, pass
children. To mask a password in the list of steps, passsecretParameterIds. - Offer the command only while the device will act on it. Otherwise pass
disabledand keep the button mounted, so a command already being sent still reports its result.
Add a relay test
Section titled “Add a relay test”- Add
DeviceRelayTestwith therelays, theremotesetting that hands the relays over, atitle, adescription, the device’swarning, and astorageKeythat is unique per dashboard and workspace. - Poll the remote setting and every relay’s state and command register while the test view is open.
- When
DevicePresetLayoutshows a page-wide remote-control notice, hide it whileuseDeviceRelayTestActive(storageKey)is true, so it does not cover the dashboard’s own test.
Show a cold room
Section titled “Show a cold room”-
Bind the room’s parameters in configuration validated by
coldRoomBindingsType. -
Poll them and show the card:
const { fastIds, slowIds } = coldRoomParameterIds(bindings);useDevicePresetValues({ fastIds, slowIds, live });return <ColdRoomCard name="Freezer room 2" bindings={bindings} locale={props.locale} />;Pass the dashboard’s pause state as
live, ortruewhen the dashboard has no pause control. -
For a controller with an unlock or a command timer, list that write as the first step of each command.
-
To lay a controller out yourself, such as a row per unit, use the card’s parts:
coldRoomStatus,coldRoomStatusLabel,coldRoomActiveAlarms,coldRoomAlarmLimitsFromStates, andColdRoomCommands.
Publish a page summary
Section titled “Publish a page summary”The assistant reads what an open dashboard shows through its page summary. To let it answer about the device from every page:
- List the device’s fault flags as
SiteAlarmBindings: a condition, an equipment name, a name, and a severity. - Call
usePublishDashboardSummary(getSummary), and build asitesummary ingetSummarywithbuildSiteSummary. - Get a reader from
useReadParameterValuesOnce(), and read the flags with it ingetSummary, so pages that do not poll them can answer too. - Pass the flags as the alarms of
evaluateSiteStatusfor the status, and toactiveSiteAlarmsfor the active alarms.
The summary contract is in Page summary.
Translate the copy
Section titled “Translate the copy”- The components bring their generic editor and command copy from the host catalogs
(
device_preset_*andcold_room_*keys). To use the same texts in your own controls, read them withtfrom@overvis/hmi-workspace-ui/i18n. - Keep device names, reading labels, and mode names in the dashboard’s own typed catalogs; see Localize a dashboard.