SUPLA / supla-cloud

https://www.supla.org
GNU General Public License v2.0
71 stars 46 forks source link

Add pairing status display in UI #836

Closed przemyslawzygmunt closed 2 months ago

przemyslawzygmunt commented 3 months ago

The device's response to the pairing request is saved in the database in the supla device.pairing result field. Each time PAIR-SUBDEVICE is sent, it sets this field to NULL before sending the request to the device.

json format:

{ "time": "2024-07-02T12:34:56Z", "startedAt": "2024-07-02T12:34:50Z", "timeoutAt": "2024-07-02T12:35:50Z", "name": "ABCD", "result": "SUCCESS" }

"time" - Date and time the report was received from the device. "startedAt" - Date and time when the device started pairing. This key may not be present, e.g. in the case of the "UNAUTHORIZED" status. "timeoutAt" - Date and time when we can consider that pairing has reached timeout if the status is other than "SUCCESS". This key may not be present, e.g. in the case of the "UNAUTHORIZED" status. "name" - The name of the paired device. This key does not always need to be set. "result" - Pairing status/result

Possible results:

NOT_SUPPORTED UNAUTHORIZED CMD_RESULT_NUM (Instead of NUM there is a number. This applies to the case when the device responded with a number that we do not know.)

In the above cases stertedAt, name and timeoutAt are not set.

PROCEDURE_STARTED ONGOING NO_NEW_DEVICE_FOUND SUCCESS NOT_SUPPORTED RESOURCES_LIMIT_EXCEEDED NOT_STARTED_NOT_READY NOT_STARTED_BUSY RAIRING_RESULT_NUM (Instead of NUM there is a number. This applies to the case when the device responded with a number that we do not know.)

fracz commented 2 months ago

image image image

fracz commented 2 months ago
subdevicePairingResult_NOT_SUPPORTED: Pairing not supported on the device.
subdevicePairingResult_UNAUTHORIZED: Pairing unauthorized.
subdevicePairingResult_ONGOING: Pairing in progress.
subdevicePairingResult_CMD_RESULT_UNKNOWN: Unknown command result ({resultNum}).
subdevicePairingResult_PROCEDURE_STARTED: Pairing procedure started.
subdevicePairingResult_NO_NEW_DEVICE_FOUND: No new device found.
subdevicePairingResult_SUCCESS: Pairing successful.
subdevicePairingResult_RESOURCES_LIMIT_EXCEEDED: Pairing resources limit exceeded.
subdevicePairingResult_NOT_STARTED_BUSY: Pairing not started because the device is busy.
subdevicePairingResult_PAIRING_RESULT_UNKNOWN: Unknown pairing result ({resultNum}).