Skip to content

MindSphere Operations Insight Plugin SDK – Getting started

An Operations Insight Plugin is developed as a web application and may use any framework and library. Every plugin must implement the Operations Insight Plugin SDK for communicating with Operations Insight.

Installation Instructions

Download the Operations Insight Plugin SDK from the Siemens Industry Online Support (SIOS) Portal. Install it using the following command, replacing {version} by the respective version number:

npm i mindsphere-operationsinsight-plugin-sdk-{version}.tgz

Booting the Plugin

When booting a plugin, it must first boot the oiPluginBootstrapper in order to connect to the Operations Insight as shown below:

import {oiPluginBootstrapper} from "@mindsphere/operationsinsight-plugin-sdk";

oiPluginBootstrapper.boot();

The boot function optionally takes some startup options to initially apply:

import {oiPluginBootstrapper, DateRange, TimeZone} from "@mindsphere/operationsinsight-plugin-sdk";

oiPluginBootstrapper.boot({
  // selects a specific asset
  assetId: 'f9f1ff3ccaa1401a98cf37d0c9144c7e',

  // navigate to another plugin
  pluginId: 'Aspects',

  // apply a date time range
  dateRange: new DateRange({
    start: new Date(2021,5,15),
    end: new Date(2021,6,15),
    timeZone: TimeZone.Local,
    isAllDay: true
  }),

  // enable the date time range picker in the plugin header
  enableDateTimeRangePicker: true,

  // provide an i18n map for the app's legal information
  appInfoI18n: {
    en: {
      displayName: 'My Fancy Operations Insight Plugin',
      appCopyright: 'Copyright (C) 2021, Acme Inc.',
      appVersion: '1.3.2',
      links: {
        default: [
          {
            'type': AppInfoLinkType.WWW,
            'name': 'Third-Party Software',
            'value': 'https://acme.inc/assets/ossReadme.html'
          },
          {
            'type': AppInfoLinkType.WWW,
            'name': 'Documentation',
            'value': 'https://acme.inc/assets/documentation.html'
          },
        ],
      },
    }
  },
});

The boot function returns a promise, but it is not necessary to wait for the connection to be established. The SDK retains any emitted output parameters and emits the latest parameters once the connection is available.

Receiving Input Parameters

Input parameters are provided to plugins as RxJS Observables. Plugins must subscribe to the respective proxy property as shown below for receiving the latest value and getting notifications on updates:

import {oiProxy} from "@mindsphere/operationsinsight-plugin-sdk";

// if true, the plugin tab is currently active
oiProxy.active.subscribe(active =>
  console.log(`component is ${active ? 'active' : 'inactive'}`
));

// the ID of the currently selected asset
oiProxy.assetId.subscribe(assetId => console.log(assetId));

// the currently chosen date time range
oiProxy.dateRange.subscribe(({start, end, timeZone} = {}) => {
  console.log(`from ${start} to ${end}`);
  console.log(`preferred time zone is ${timeZone}`);
});

// the current language selection ('en'|'de')
oiProxy.language.subscribe(language => console.log(language));

Sending Output Parameters

Plugins can send output parameters to Operations Insight as shown below:

import {oiProxy, DateRange, TimeZone} from "@mindsphere/operationsinsight-plugin-sdk";

// select an asset
oiProxy.setAssetId('f9f1ff3ccaa1401a98cf37d0c9144c7e');

// apply a date time range
oiProxy.setDateRange(new DateRange({
  start: new Date(2018,5,15),
  end: new Date(2018,6,15),
  timeZone: TimeZone.Local
}));

// navigate to another plugin, select an asset and/or apply a date time range
// (all properties are optional)
oiProxy.navigate({
  pluginId: 'Aspects',
  assetId: 'f9f1ff3ccaa1401a98cf37d0c9144c7e',
  dateRange: new DateRange({
    start: new Date(2018,5,15),
    end: new Date(2018,6,15),
    timeZone: TimeZone.Local // optional
  })
});

// en- or disable the date time range picker in the plugin header
oiProxy.enableDateTimeRangePicker();
oiProxy.disableDateTimeRangePicker();

// provide an i18n map for the app's legal information
oiProxy.setAppInfoI18n({
  appInfoI18n: {
    en: {
      displayName: 'My Fancy Operations Insight Plugin',
      appCopyright: 'Copyright (C) 2021, Acme Inc.',
      appVersion: '1.3.2',
      links: {
        default: [
          {
            'type': AppInfoLinkType.WWW,
            'name': 'Third-Party Software',
            'value': '/assets/ossReadme.html'
          },
          {
            'type': AppInfoLinkType.WWW,
            'name': 'Documentation',
            'value': '/assets/documentation.html'
          },
        ],
      },
    },
    de: {/* ... */},
  },
})

If a plugin only outputs Observables, it is sufficient to subscribe to the provided Observers:

import {oiProxy, DateRange, TimeZone} from "@mindsphere/operationsinsight-plugin-sdk";

myAssetIdObservable.subscribe(oiProxy.assetIdObserver);
myDateRangeObservable.subscribe(oiProxy.dateRangeObserver);
myNavigationObservable.subscribe(oiProxy.navigationObserver);
myDateTimeRangePickerOptionsObservable.subscribe(oiProxy.dateTimeRangePickerOptionsObserver);

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.


Last update: November 18, 2021