When the command endpoints, such as Submit Command for Vehicle is called, the sending application will be informed that the command is in a PENDING state, indicating that it is being processed for submission to the vendor and execution by the target device. Additionally, the Energy Hub will send a notification at this stage.

The command submission to the vendor system is handled asynchronously, meaning the caller of the command endpoint does not wait for the command to be submitted to the vendor system. The Energy Hub will provide updates on the command state change via a notification message sent through the appropriate Streaming topic.

States of commands

  • PENDING: Represents that command is registered and maybe submitted to Vendor system for execution before target device has executed it.

  • FAILED: Represents unsuccessful execution of command. Command did not reach Vendor system or it has been rejected by it.

  • EXECUTED: Represents successful execution of command.

Command state change

Not all devices have the same command capabilities. For example, vehicles may support remote start charging, while this is not possible for HVAC devices.

When the submit command endpoint is called in one of the service APIs provided by the Energy Hub, the first check performed is to verify the existence of the target device. If the device does not exist, an appropriate error message is returned.

Data model

After command is created, it is provided as a command object in the REST API with the following data model:

{
  "id": "f6e5bbbc-bfd1-4856-a4bf-9b0d2a1adcce",
  "userId": "user123",
  "type": "CHARGING_START",
  "state": "PENDING",
  "failedReason": null,
  "createdAt": "2024-09-04T14:08:11.995Z",
  "lastUpdated": null,
  "deviceId": "e110ed44-69e6-4fbd-bcc9-95901e17ad62"
}