Toggle the Live Mode on the Trend Widget with an OPC Variable

Hello,

i want to ask, if there is a way to start and stop the Live Mode of the Trend Widget with a Variable from an OPC UA Server. I have a boolean Variable in my plc project, that should stop the Live Mode when it is true.

Thanks for the answers

Best reply by webiq-sk

You can do this in this way:

1. You retrieve an instance of your IQ Trend widget, preferably using shmi.onReady (instead of shmi.ctrl below)
2. You subscribe to an item using the IO Manager (check our scripting demo for examples)
3. You do all of this in a LocalScript that you add to your HMI

const trendWidget = shmi.ctrl(".iq-trend");
if (trendWidget) {
    if (trendWidget.isLive()) {
        trendWidget.setLive(false);
    } else {
        trendWidget.setLive(true);
    }
}

ย 

View original
1 reply