Creates an instance of the SwitchBot OpenAPI client.
The API token used for authentication.
The secret key used for signing requests.
Optional
webhookControls a device by sending a command to the SwitchBot API.
The unique identifier of the device to control.
The command to send to the device.
The parameter for the command.
The type of the command, defaults to 'command'.
A promise that resolves to an object containing the API response.
Retrieves the status of a specific device.
The unique identifier of the device.
A promise that resolves to the device status.
Sets up a webhook listener and configures the webhook on the server.
This method performs the following steps:
The URL to which the webhook events will be sent.
A promise that resolves when the webhook setup is complete.
The
SwitchBotOpenAPI
class provides methods to interact with the SwitchBot OpenAPI. It allows you to retrieve device information, control devices, and manage webhooks.Example
Param: token
The API token used for authentication.
Param: secret
The secret key used for signing requests.