WorkSys

WorkSys

Did You Know?

Worksys je navrhnutý pre používateľov tak, aby používateľ klikal čo najmenej.

leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

Digital Entity Attribute Types

Estimated reading: 5 minutes 89 views

There are situations when it is necessary to bring the visual attribute even closer to the object of its use. For example, if you want a switch, you don’t want an Attribute where you change the value to 0 or 1. You want a switch (graphical component). This is always a challenge with such a generically designed system as WorkSys. In this section, we will show how WorkSys can easily solve these needs.

Precisely for this purpose, the rich_type Attribute Parameter was created, which in this way gives information to the developer, how to visualize the given Attribute on the web user interface.

As we already wrote in the previous chapter, expanding the value_type parameter by another rich_type parameter allows displaying a special element of the user interface or formatting. The rich_type parameter is optional and is added only if necessary.

The list of options is as follows:

color

This parameter is defined if value_type is “string”. The value of the Attribute is then the hexadecimal representation of the color (see Color HEX

				
					...
  "fill_color": {
    "type": "static",
    "unit": null,
    "trans": {
      "cs": "Barva výplně",
      "de": "Füllfarbe",
      "en": "Fill color",
      "sk": "Farba vyplnenia"
    },
    "rich_type": "color",
    "value_type": "string",
    "value_default": "#ff2a00"
  },
  ...
				
			

url

 

This parameter is defined if value_type is “string”. The Attribute value is then a URL link that is clickable as a hyperlink from the Entity detail.

				
					...
  "atribute_url": {
    "type": "static",
    "unit": " ",
    "trans": {
      "cs": "Popis attribute_url v cs jazyku",
      "de": "Popis attribute_url v de jazyku",
      "en": "Popis attribute_url v en jazyku",
      "sk": "Popis attribute_url v sk jazyku"
    },
    "rich_type": "url",
    "value_type": "string",
    "value_default": "https://online.worksys.space/worksys/"
  }
...
				
			

switcher

 

This parameter is defined if value_type is “bool“. The value of the Attribute is then a visual toggle.

				
					...
  "state_of_contactor": {
    "type": "telemetry",
    "unit": "",
    "trans": {
      "cz": "Stav stykače",
      "de": "Zustand des Schützes",
      "en": "State of contactor",
      "sk": "Stav stýkača"
    },
    "rich_type": "switcher",
    "value_type": "bool",
    "controllable": {
      "method": "set_command",
      "command": "switch",
      "maintenance_by": "local_energy"
    },
    "value_default": false
  },
  ...
				
			

datetime

This parameter is defined if value_type is “number“. Transforms the timestamp from the UNIX format ( Epoch format ) to the format required by the user. The output is formatted to e.g.: “YYYY-MM-DDTHH:mm:ssZ”, uses the formatting method from moment.js

				
					...
  "maintenance_date": {
    "type": "static",
    "unit": null,
    "trans": {
      "cz": "Datum údržby",
      "de": "Wartungsdatum",
      "en": "Maintenance date",
      "sk": "Dátum údržby"
    },
    "rich_type": "datetime",
    "value_type": "number",
    "value_default": 0
  },
  ...
				
			

duration

This parameter is defined if value_type is “number”. It transforms the result of the time difference in UNIX format (Epoch format) into an understandable expression of the time difference, e.g. 12:43:18.

The output is formatted to e.g.: “YYYY-MM-DDTHH:mm:ssZ”, it uses the method moment.js duration extension)

				
					...
  "duration": {
    "type": "telemetry",
    "unit": null,
    "trans": {
      "cz": "Doba trvání",
      "de": "Dauer",
      "en": "Duration",
      "sk": "Trvanie"
    },
    "format": "HH:mm:ss",
    "rich_type": "duration",
    "value_type": "number",
    "value_default": 0
  },
...
				
			

Dalším parametrom format môžete nastaviť očakávaný formát výstupu.

switch_profile_select

This parameter is defined if value_type is “string“. Shows selection to change switch profiles. A component without permissions is not active and cannot be controlled by the user.

				
					...
  "profile_line": {
    "type": "telemetry",
    "unit": null,
    "rich_type": "switch_profile_select",
    "value_type": "number",
    "controllable": {
      "method": "set_profile",
      "maintenance_by": "local_setup"
    },
    "value_default": null
  },
...
				
			

dimming_profile_select

 

This parameter is defined if value_type is “string“. Shows selection to change switch profiles. A component without permissions is not active and cannot be controlled by the user.

				
					...
  "dimming_profile": {
    "type": "telemetry",
    "unit": null,
    "rich_type": "dimming_profile_select",
    "value_type": "string",
    "controllable": {
      "method": "set_profile",
      "maintenance_by": "local_setup"
    },
    "value_default": ""
  },
...
				
			

attribute_rules

This parameter contains the conditions for the rules module. See: RuleEngine . It is most often used when setting the color visualization depending on the value of the Attribute.

				
					...
  "status": {
    "type": "telemetry",
    "unit": null,
    "trans": {
      "en": "Status",
      "sk": "Stav",
      "de": "Status",
      "cz": "Stav"
    },
    "value_type": "string",
    "value_default": "virtual",
    "attribute_rules": {
      "fill_color": [
        {
          "value": "#adadad",
          "condition": "virtual"
        },
        {
          "value": "#1eff00",
          "condition": "OK"
        },
        {
          "value": "#ff2a00",
          "condition": "NOK"
        }
      ]
    }
...
				
			

Or, for example, when interpreting the level of illumination, where the color is determined by an interval of values.

				
					...
"dimming": {
    ...
    "attribute_rules": {
        "fill_color": [
            {
              "condition": "(,50]",
              "value": "#fcfeff"
            },
            {
              "condition": "(50,80]",
              "value": "#f0f7ff"
            },
            {
              "condition": "(80,)",
              "value": "#deebf7"
            }
        ]
    }
    ...
}
...
				
			

controllable

This parameter enables the active authorization elements to insert conditions of additional authorization required directly in the user profile definition for active use of the given graphic element.

				
					...
    "controllable": {
      "maintenance_by": "lighting",
      "method": "set_command",
      "command": "dimming"
    },
...
				
			

With the other Parameters “method” and “command” we set the graphic element to be affected. Supported “command” values are:

  • dimming
  • switch
				
					...
    "controllable": {
      "maintenance_by": "lighting",
      "method": "set_command",
      "command": "switch"
    },
...
				
			

Rule Engine

Rule Engine sets entity attribute based on defined condition rules. The condition can be an interval rule (eg: (50,80]) or any valid JSON value to compare (eg: true, “notokstring”, 12, …)

  • ( <value> , <value> ) – open interval
  • [ <value> , <value> ] – closed interval (including endpoint)

Leave a Comment

CONTENTS