Event messages

Event messages can be used to write events or alarms to a tag/variable/item in the APIS environment.

An event message is a JSON object that contains the following keys:

  • Message type
  • Payload

Payload is the content of the message. It is an array of JSON objects for events which need to be written to the items and can have the following attributes per event:

  • source
  • type
  • timestamp
  • severity
  • state
  • current value

Source is the location of the item (that you want to write an event to) inside the apis event server.

States of Alarms/Events:

Possible states of alarms can be:

  • None
  • Enabled
  • Active
  • AckRequired
  • Acked
  • Confirmed
  • Suppressed
  • Shelved
  • Substates

Event Example

			{		
				'messagetype': 'event', 
				'version': 1,
                                'payload':
                                    [
                                        {
                                            'type': 'LevelAlarm',
                                            'source': 'ApisHive/Areas/TestArea/TestWorker.Variable1',
                                            'time': '2022-09-22T11:52:02.438+00:00',
                                            'severity': 780,
                                            'state': 'Enabled,Acked',
                                            'currentvalue': 300,
                                        },
                                        {
                                            'type': 'OffNormalAlarm',
                                            'source': 'ApisHive/Areas/TestArea/TestWorker.Variable2',
                                            'time': '2022-09-22T11:52:02.438+00:00',
                                            'activetime': '2022-09-22T11:50:00.000+00:00',
                                            'severity': 780,
                                            'state': 'Enabled,Active,AckRequired',
                                            'currentvalue': 0,
                                            'message': 'Alarm on'
                                        },
                                        {
                                            'type': 'WatchdogAlarm',
                                            'time': '2022-09-22T11:52:02.438+00:00',
                                            'activetime': '2022-09-22T11:50:00.000+00:00',
                                            'source': 'ApisHive/Areas/TestArea/TestWorker.Variable3',
                                            'severity': 780,
                                            'state': 'Enabled,Active,Suppressed',
                                            'currentvalue': 150,
                                            'message': 'Value frozen'
                                        },
                                        {
                                            'type': 'WatchdogAlarm',
                                            'time': '2022-09-22T11:52:02.438+00:00',
                                            'activetime': '2022-09-22T11:50:00.000+00:00',
                                            'source': 'ApisHive/Areas/TestArea/TestWorker.Variable4',
                                            'severity': 835,
                                            'state': 'Enabled,Confirmed',
                                            'currentvalue': 100,
                                            'message': 'Value frozen for the last 10 seconds'
                                        },
                                        {
                                            'type': 'WatchdogAlarm',
                                            'time': '2022-09-22T11:52:02.438+00:00',
                                            'source': 'ApisHive/Areas/TestArea/TestWorker.Variable5',
                                            'severity': 780,
                                            'state': 'Enabled,Active,Shelved',
                                            'currentvalue': 100,
                                            'activetime': '2022-09-22T11:50:00.000+00:00',
                                            'message': 'Bad quality'
                                        },
                                    ]
                     }


Mandatory Fields in message:

  • message type
  • payload
  • type
  • source
  • time
  • severity
  • state
  • currentvalue