Skip to content

Insights Hub Monitor Plugin SDK – Getting started

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

Installation Instructions

Download the Insights Hub Monitor 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 ihmPluginBootstrapper in order to connect to the Operations Insight as shown below:

import {ihmPluginBootstrapper} from "@insights-hub/ihm-plugin-sdk";

ihmPluginBootstrapper.boot();

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

import {ihmPluginBootstrapper, DateRange, TimeZone} from "@insights-hub/ihm-plugin-sdk";

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

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

  // apply a date time range
  dateRange: new DateRange({
    start: new Date(2023,3,1),
    end: new Date(2023,3,30),
    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 Insights Hub Monitor Plugin',
      appCopyright: 'Copyright (C) 2023, Acme Inc.',
      appVersion: '3.0.1',
      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 {ihmProxy} from "@insights-hub/ihm-plugin-sdk";

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

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

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

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

Sending Output Parameters

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

import {ihmProxy, DateRange, TimeZone} from "@insights-hub/ihm-plugin-sdk";

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

// apply a date time range
ihmProxy.setDateRange(new DateRange({
  start: new Date(2023,3,1),
  end: new Date(2023,3,30),
  timeZone: TimeZone.Local
}));

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

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

// provide an i18n map for the app's legal information
ihmProxy.setAppInfoI18n({
  appInfoI18n: {
    en: {
      displayName: 'My Fancy Insights Hub Monitor Plugin',
      appCopyright: 'Copyright (C) 2023, Acme Inc.',
      appVersion: '3.0.1',
      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 {ihmProxy, DateRange, TimeZone} from "@insights-hub/ihm-plugin-sdk";

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

Last update: April 13, 2023

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