Hub Events

These events are common for both the LIVISI Home Hub and the LIVISI Virtual Hub

Event: StateChanged

The hubs implement the global StageChanged event to announce changes of its device and capability states.

{
  "sequenceNumber": 693,
  "type": "StateChanged",
  "desc": "/desc/device/SHCA.RWE/1.0/event/StateChanged",
  "namespace": "core.RWE",
  "timestamp": "2020-02-07T21:14:54.2093780Z",
  "source": "/device/00000000000000000000000000000000",
  "properties": {
    "cpuUsage": 4,
    "diskUsage": 57,
    "memoryUsage": 43
  }
}

In this example the device states for cpuUsage, diskUsage and memoryUsage of the hub changed.

Event: DeviceFound

Whenever the Device Discovery is being activated, new devices found are announced via this event.

{
  "sequenceNumber": 688,
  "type": "DeviceFound",
  "desc": "/desc/device/SHCA.RWE/1.0/event/DeviceFound",
  "namespace": "core.RWE",
  "timestamp": "2020-02-07T21:14:39.8012790Z",
  "source": "/device/00000000000000000000000000000000",
  "properties": {},
  "data": {
    "id": "36e3701a37cd4394a1e72c38cfe81138",
    "config": {
      "name": "State Variable",
      "protocolId": "Virtual",
      "timeOfAcceptance": null
    },
    "manufacturer": "RWE",
    "type": "VariableActuator",
    "version": "2.0",
    "desc": "/desc/device/VariableActuator.RWE/2.0",
    "product": "VariableActuator.RWE",
    "serialNumber": "36e3701a37cd4394a1e72c38cfe81138",
    "location": null,
    "capabilities": ["/capability/2570e2f225da4382bb841cae416a31a1"]
  }
}

In this example the virtual device VariableActuator is announced. It can be added to the system by using the payload of data (which holds a full Device entity) in the POST Device request .

Message Events

The Message Events purpose is to notify a client that a new message has been created or an existing message was updated/deleted.

MessageCreated

The data container of the MessageCreated event holds a full Message entity. This can be fully processed by the client without calling the /message endpoint.

{
  "id": "4e811d4134324ed4aa74914e250e9d60",
  "namespace": "CosipDevices.RWE",
  "class": "alert",
  "type": "DeviceLowBattery",
  "read": true,
  "timestamp": "2020-02-08T10:02:27.951955Z",
  "devices": [
      "/device/24d04e24996147c9bfb042f9ebd5d82c"
  ],
  "capabilities": [],
  "properties": {
      "deviceLocation": "Bathroom",
      "deviceName": "Radiator Thermostat",
      "deviceSerial": "975091006085",
      "locationName": "",
      "serialNumber": "975091006085"
  }  
}

In this example a message was created since the device Radiator Thermostat in the location Bathroom is low on battery.

MessageDeleted

The MessageDeleted event simply notifies the client that the message with the id in the data container was removed.

{
  "sequenceNumber": 96,
  "type": "MessageDeleted",
  "desc": "/desc/device/SHCA.RWE/1.0/event/MessageDeleted",
  "namespace": "core.RWE",
  "timestamp": "2020-02-07T20:41:45.5072330Z",
  "source": "/device/00000000000000000000000000000000",
  "data": {
    "id": "62e2639619374dcda26fe45357978da1"
  }
}

MessageUpdated

The MessageUpdated events purpose is to notify the client if a message was updated. The most common case for an MessageUpdated event is when the read state changes from false to true.

{
  "sequenceNumber": 23830,
  "type": "MessageUpdated",
  "desc": "/desc/device/SHCA.RWE/1.0/event/MessageUpdated",
  "namespace": "core.RWE",
  "timestamp": "2020-02-13T11:43:40.0242030Z",
  "source": "/device/00000000000000000000000000000000",
  "data": {
    "id": "1acb7c63b08a4059a704bd7a85c50c87",
    "class": "alert",
    "type": "ShcOptionalUpdate",
    "namespace": "core.RWE",
    "desc": "/desc/device/SHCA.RWE/1.0/message/ShcOptionalUpdate",
    "source": "/device/00000000000000000000000000000000",
    "timestamp": "2020-02-13T07:35:00Z",
    "devices": [],
    "capabilities": [],
    "read": true,
    "state": true,
    "properties": {}
  }
}

Event: ConfigurationChanged Event

This is an example of a ConfigurationChanged event. It was generated because the name of the device with id:331c275b5fb44a61bd0096f0f98b75bdwas changed to Spotlights. However, the full device entity was send. The client has to dissect and look for changes. It also led to the global configVersion to increase to 780.

{
  "sequenceNumber": 81261,
  "type": "ConfigurationChanged",
  "desc": "/desc/device/SHCA.RWE/1.0/event/ConfigurationChanged",
  "namespace": "core.RWE",
  "timestamp": "2020-01-31T23:05:53.3965660Z",
  "source": "/device/00000000000000000000000000000000",
  "data": {
    "configVersion": 780,
    "devices": [{
      "id": "331c275b5fb44a61bd0096f0f98b75bd",
      "tags": {
        "type": "TInwallSpotId",
        "typeCategory": "TCLightId"
      },
      "config": {
        "name": "Spotlights",
        "protocolId": "Cosip",
        "timeOfAcceptance": "2019-03-01T19:15:33Z",
        "timeOfDiscovery": "2019-03-01T19:15:10Z"
      },
      "manufacturer": "RWE",
      "type": "ISS2",
      "version": "1.1",
      "desc": "/desc/device/ISS2.RWE/1.1",
      "product": "CosipDevices.RWE",
      "serialNumber": "914210010851",
      "location": "/location/299ec26b09b0448fa2b1478d2074e95b",
      "capabilities": ["/capability/82de70d7340e4761a421707b72fc253c", "/capability/9c8d7320c7014555a3967b3f151c9e80"]
    }]
  }
}