EcoWatt Technologies Logo

General Specification

1.Topic

1.1 Topic Hierarchy

                       |Secondary classfication|
                       └───────────────────────┘
      |Unique ID for each EMS| |
      └──────────────────────┘ |
              |                |
          ---------          -----
${PREFIX}/${DEVICE}/ems_mode/sync/command
--------            --------      -------
   |                   |             |
┌─────────────────┐    |         ┌──────┐
|Prefix set on EMS|    |         |Suffix|
             ┌───────────────────┐
             |Major classfication|

1.2 Topic Suffix

  • Note: Different payloads apply according to the topic suffix.

  • Suffix and Function Description

    • [cloud send] Topics actively sent by the cloud that require EMS response

      • The suffix sent from the cloud is command

      • The suffix of EMS response is result

    • [ems send] EMS active request, topic that requires cloud response

      • The suffix of the EMS request is request

      • The suffix of the cloud response is response

    • [ems send (no reply)] EMS active reporting topic that does not require cloud response

      • The suffix sent by EMS is post
    • [cloud send (no reply)] Topic for cloud to actively send without EMS response

      • The suffix sent from the cloud is set

2. Payload

All keys follow the snake_case naming convention

2.1 Request (command, request)

{
  "trace_id": "577f5df0-65d6-432d-8aac-0116e9530152",
        // (Required, string) Trace ID, used for tracking information
  "mid": "ee2e8f09-b280-4e4d-bcb9-1529b703cfed",
        // (Required, string) Message ID, randomly generated, used for message deduplication
  "type": "charge_list",
        // (Required, string) Message type, used to verify consistency with the topic (formed by combining first-level and second-level categories with "_")
  "data": {},
        // (Required, object) Request content
  "device_uid": "${DEVICE}",
        // (Required, string) Device UID, same as the EMS UID in the topic
  "sub_device_id": "${SUB_DEVICE_ID}",
        // (Optional, string) Sub-device ID (only required when HEMS communicates on behalf of a sub-device
  "timestamp": 1695265371000
        // (Required, integer) Timestamp in milliseconds
}

2.2 Response (result, response)

{
  "trace_id": "577f5df0-65d6-432d-8aac-0116e9530152",
        // (Required, string) Trace ID, used for tracking information
  "mid": "ee2e8f09-b280-4e4d-bcb9-1529b703cfed",
        // (Required, string) Message ID, randomly generated, used for message deduplication
  "reply": "ee2e8f09-b280-4e4d-bcb9-1529b703cfed",
        // (Required, string) Message ID of the original request being responded to
  "type": "charge_list",
        // (Required, string) Message type, used to verify consistency with the topic (formed by combining first-level and second-level categories with "_")
  "code": 400,
        // (Required, integer) Response status code (see specification below)
  "msg": "xxxxxxx",
        // (Optional, string) Error message returned when the request fails; omitted on success
  "data": {},
        // (Required, object) Response content
  "device_uid": "${DEVICE}",
        // (Required, string) Device UID, same as the EMS UID in the topic
  "sub_device_id": "${SUB_DEVICE_ID}",
        // (Optional, string) Sub-device ID (only required when HEMS communicates on behalf of a sub-device
  "timestamp": 1695265371000
        // (Required, integer) Timestamp in milliseconds
}

2.3 Report/Set (post/set)

{
  "mid": "ee2e8f09-b280-4e4d-bcb9-1529b703cfed",
        // (Required, string) Message ID, randomly generated, used for message deduplication
  "type": "charge_list",
        // (Required, string) Message type, used to verify consistency with the topic (formed by combining first-level and second-level categories with "_")
  "data": {},
        // (Required, object) Content
  "device_uid": "${DEVICE}",
        // (Required, string) Device UID, same as the EMS UID in the topic
  "sub_device_id": "${SUB_DEVICE_ID}",
        // (Optional, string) Sub-device ID (only required when HEMS communicates on behalf of a sub-device
  "timestamp": 1695265371000
        // (Required, integer) Timestamp in milliseconds
}

3. Response Code

codeDescription
200Request successful.
400Request message error, such as message format error, etc.
500Server internal error.
  • Instructions:

    • When batch processing requests, if all processing is successful, return 200; if there are partial failures, return 400.

4. Data Type

NameDescriptionSample
intInteger10
floatFloat10.1
boolBoolean valuetrue
strStringhello
[]xList of type x[]int: [1,2,3][]float: [10.1,10.2,10.3]