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 name Value type Description Example DisplayUnit string Status for the entire screen. Screen.AddStatus("DisplayUnit", "ok"); DisplayUnitPower string Power status for the screen
off = red, on = greenScreen.AddStatus("DisplayUnitPower", "off"); Temperature integer A reading from a temperature sensor Screen.AddStatus("Temperature", "46"); TemperatureError bool Set if the temperature is too high true
= temp okfalse
= temp warningScreen.AddStatus("TemperatureError", "true"); FanError bool Set if the fan has a problem true
= fan okfalse
= fan warningScreen.AddStatus("FanError", "true"); Input bool Set if the screen has input Screen.AddStatus("Input", "false"); Current float Value in amps (A) Screen.AddStatus("Current", "0.9"); Voltage float Value in volts (V) Screen.AddStatus("Voltage", "229.4"); ExternalTemperature integer Set if the external temperature reading is too high true = temp ok
false = temp warning
Screen.AddStatus("ExternalTemperature", "22"); ExternalTemperatureError bool Set if the external temperature reading is too high Screen.AddStatus("ExternalTemperatureError", "true"); Brightness integer Brightness value (percent) Screen.AddStatus("Brightness", "70"); Contrast integer Contrast value Screen.AddStatus("Contrast", "70"); Color integer Color value Screen.AddStatus("Color", "70"); Sharpness integer Sharpness value Screen.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
- Encode the script text as Base64. Use for example this page: https://www.base64encode.org/
- Go into a player's custom settings (see this article: Custom settings )
- Add the Screen.script setting.
- As value, paste the base64 encoded text from step 1.
- Click Save
- Publish the player.