@@ -217,20 +217,23 @@ export class OpenAPIClient {
217217 /**
218218 * Curtain-specific commands
219219 */
220- async curtainOpen ( deviceId : string ) : Promise < APICommandResponse > {
221- return this . sendCommand ( deviceId , 'setPosition' , '0,ff,0' )
220+ async curtainOpen ( deviceId : string , speed = 255 ) : Promise < APICommandResponse > {
221+ const clampedSpeed = Math . min ( 255 , Math . max ( 1 , speed ) )
222+ return this . sendCommand ( deviceId , 'setPosition' , `0,${ clampedSpeed . toString ( 16 ) . padStart ( 2 , '0' ) } ,0` )
222223 }
223224
224- async curtainClose ( deviceId : string ) : Promise < APICommandResponse > {
225- return this . sendCommand ( deviceId , 'setPosition' , '0,ff,100' )
225+ async curtainClose ( deviceId : string , speed = 255 ) : Promise < APICommandResponse > {
226+ const clampedSpeed = Math . min ( 255 , Math . max ( 1 , speed ) )
227+ return this . sendCommand ( deviceId , 'setPosition' , `0,${ clampedSpeed . toString ( 16 ) . padStart ( 2 , '0' ) } ,100` )
226228 }
227229
228230 async curtainPause ( deviceId : string ) : Promise < APICommandResponse > {
229231 return this . sendCommand ( deviceId , 'pause' )
230232 }
231233
232- async curtainSetPosition ( deviceId : string , position : number ) : Promise < APICommandResponse > {
233- return this . sendCommand ( deviceId , 'setPosition' , `0,ff,${ position } ` )
234+ async curtainSetPosition ( deviceId : string , position : number , speed = 255 ) : Promise < APICommandResponse > {
235+ const clampedSpeed = Math . min ( 255 , Math . max ( 1 , speed ) )
236+ return this . sendCommand ( deviceId , 'setPosition' , `0,${ clampedSpeed . toString ( 16 ) . padStart ( 2 , '0' ) } ,${ position } ` )
234237 }
235238
236239 /**
0 commit comments