Dise provides the option to run a script to set status for connected screens instead of relying on an RS-232 or network protocol. It is applicable to screens that does not have a standard protocol but instead write status to a file, for example.

The script is run once a minute and is a Javascript or Python script. 



TABLE OF CONTENTS



Screen library

The Screen library provides access to methods to interface with Dise. The available methods are:

  • Screen.Log( [string, optional]loglevel, [string]message)
    Logs a message to Dise portal.
    If loglevel is specified and one of debug, info, notice, warning, error, critical, alert or emergency, will log using that level. 
  • Screen.AddStatus([string]statusType, [string]value)
    Sets the status of the given statusType in the portal, to value.
    Please note: value is sent with type string! but contain underlying datatype seen below
    Available statuses are:
    Status nameValue typeDescriptionExample
    DisplayUnitstringStatus for the entire screen.Screen.AddStatus("DisplayUnit", "ok");
    DisplayUnitPower stringPower status for the screen
    off = red, on = green 
    Screen.AddStatus("DisplayUnitPower", "off");
    TemperatureintegerA reading from a temperature sensorScreen.AddStatus("Temperature", "46");
    TemperatureError boolSet if the temperature is too high
    true = temp ok
    false
     = temp warning
    Screen.AddStatus("TemperatureError", "true");
    FanError boolSet if the fan has a problem

    true = fan ok
    false = fan warning

    Screen.AddStatus("FanError", "true");
    InputboolSet if the screen has inputScreen.AddStatus("Input", "false");
    CurrentfloatValue in amps (A)Screen.AddStatus("Current", "0.9");
    VoltagefloatValue in volts (V)Screen.AddStatus("Voltage", "229.4");
    ExternalTemperatureintegerSet if the external temperature reading is too high

    true = temp ok
    false = temp warning


    Screen.AddStatus("ExternalTemperature", "22");
    ExternalTemperatureErrorboolSet if the external temperature reading is too highScreen.AddStatus("ExternalTemperatureError", "true");
    BrightnessintegerBrightness value (percent)Screen.AddStatus("Brightness", "70");
    ContrastintegerContrast valueScreen.AddStatus("Contrast", "70");
    ColorintegerColor valueScreen.AddStatus("Color", "70");
    SharpnessintegerSharpness valueScreen.AddStatus("Sharpness", "70");


PowerState

string Screen.PowerState()

Get the powerstate as decided by power override or schedule.

Returns a string that is either "on" or "off"

GetVariable

string Screen.GetVariable(string name)

Get string from an variable, all variables from the portal should be available. But variables in the playback are not available.

SetVariable

Screen.SetVariable(string name, string value)

Set string to an variable. This variable can only be read from the same screen. It is not possible to read this variable from another screen script running or from the playback.


Script example

#pragma language JScript

// If temperature is above this value, set error status
var TMP_THRESHOLD = 75; 

// Temperature is written to a text file, open file and read it
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile("C:\\screen\\temperature.txt", 1, true);
state = JSON.parse(f.ReadAll());
f.Close();

var temperature = f.ReadAll();

// Set temperature value and error status
Screen.AddStatus("Temperature", temperature);
Screen.AddStatus("TemperatureError", (parseInt(temperature, 10) > TMP_THRESHOLD).toString());



Setting the screen script

  1. Encode the script text as Base64. Use for example this page: https://www.base64encode.org/
  2. Go into a player's custom settings (see this article: Custom settings
  3. Add the Screen.script setting. 
  4. As value, paste the base64 encoded text from step 1. 
  5. Click Save
  6. Publish the player.