Remote Restart

Last Updated on : 2025-04-17 02:39:48download

Purpose

Restart a device remotely.

Integration

The UI BizBundle must be v6.2.0 or later.

source 'https://github.com/tuya/tuya-pod-specs.git'
platform :ios, '11.0'

target 'Your_Project_Name' do
    pod "ThingSmartBusinessExtensionKit"
end

API description

Model

Management class of remote restart

open class ThingDeviceRebootManager : NSObject {
    ...
}

Schedule model of remote restart

open class ThingDeviceRebootTimer : NSObject {
    /// timer id
    open var tid: String

    /// time to reboot, format: HH:mm
    open var time: String

    /// days to repeat,  0000000, from Sunday to Saturday, 1 means repeat, 0 means not repeat
    /// e.g. 1000000 means repeat on Sunday, 1100000 means repeat on Sunday and Monday, 1111111 means repeat every day, 0000000 means not repeat
    open var loops: String

    /// status of the timer, true means enable, false means disable
    open var status: Bool
}

APIs of remote restart management

  • Check whether the device supports remote restart.

    open func supportRebootSuccess(_ success: ((Bool) -> Void)?, failure: ((any Error) -> Void)? = nil)
    
    Request parameter Type Description
    success Boolean The success callback. true: supported. false: not supported.
    failure error The error message.
  • Restart the specified device immediately.

    open func rebootImmediatelySuccess(_ success: (() -> Void)?, failure: ((any Error) -> Void)? = nil)
    
    Request parameter Type Description
    success void The success callback. It will be triggered immediately after the message is sent successfully.
    failure error The error message.
  • Add a scheduled task for restart.

    open func add(_ timer: ThingDeviceRebootTimer, success: ((String) -> Void)?, failure: ((any Error) -> Void)? = nil)
    

    The device can only have one scheduled task at a time. Newly added scheduled tasks will override old ones.

    Request parameter Type Description
    timer ThingDeviceRebootTimer The information about a scheduled task.
    success string The ID of a specified scheduled task.
    failure error The error message.
  • Update the information about a scheduled task for restart.

    open func update(_ timer: ThingDeviceRebootTimer, success: (() -> Void)?, failure: ((any Error) -> Void)? = nil)
    
    Request parameter Type Description
    timer ThingDeviceRebootTimer The information about a scheduled task.
    success void The success callback.
    failure error The error message.
  • Get the information about a scheduled task for restart.

    open func getTimerSuccess(_ success: ((ThingDeviceRebootTimer?) -> Void)?, failure: ((any Error) -> Void)? = nil)
    

    In case of a non-repeating scheduled task, the device will delete the relevant information after running the scheduled task.

    Request parameter Type Description
    success ThingDeviceRebootTimer The information about a scheduled task.
    failure error The error message.

Example

Service LayerSDKCheck support for remote restartSupported or notShow an entry of immediate restartTrigger an immediate restartThe callback resultpar[Logic of immediate restart]Get a scheduled task for restartThe information of the scheduled taskAdd a scheduled taskThe callback resultUpdate the scheduled taskThe callback resultalt[No scheduled task is available][A scheduled task is available]par[Logic of scheduled restart]alt[Supported]Service LayerSDK

Demo

For more information, see the Demo.