updateDeviceState method
Using a Boolean value (true or false), this operation enables or disables the device given a device ID.
May throw ResourceNotFoundException. May throw InvalidRequestException. May throw InternalFailureException.
Parameter deviceId
:
The unique identifier of the device.
Parameter enabled
:
If true, the device is enabled. If false, the device is
disabled.
Implementation
Future<void> updateDeviceState({
required String deviceId,
bool? enabled,
}) async {
ArgumentError.checkNotNull(deviceId, 'deviceId');
final $payload = <String, dynamic>{
if (enabled != null) 'enabled': enabled,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/devices/${Uri.encodeComponent(deviceId)}/state',
exceptionFnMap: _exceptionFns,
);
}