> Is there a way to detect a PV connect and disconnect events in the CSS/Phoebus/DisplayBuilder?
Yes, it's built-in. Alarm-sensitive widgets indicate alarms, and that includes INVALID/Disconnected, via a border around the widget.
The border color defaults to yellow/orange for MINOR, red for MAJOR, and purple for INVALID/disconnected. In addition to the color, the minor alarm is a single line, the major alarm a double line, and the disconnected a type of dashed line (subtle difference
for never connected and later disconnected after having initially been connected).
To see this, open the "Text Update" page from the example displays, it includes simulated PVs that cycle through alarms, including
one that keeps disconnecting.
> If
there are multiple options what would be the "cleanest" way to do it?
> The use case for which I would like to use this is to set the
display background color based on the PV state: connected->green, disconnected->red.
There are on purpose not multiple options because we aim for consistent displays.
In the display builder, alarms are indicated via the border. There is no mechanism to instead indicate them via the foreground
color or background color or icons that would pop up at the edge or blinking or ... because if we offered these options, each display would likely look different and end users then have a hard time figuring it out.
|