@@ -319,3 +319,82 @@ def set_chlor_params(ctx: click.Context, bow_id: int, equip_id: int, timed_perce
319319 except Exception as e :
320320 click .echo (f"Error setting chlorinator parameters: { e } " , err = True )
321321 raise click .Abort from e
322+
323+
324+ @debug .command ()
325+ @click .argument ("bow_id" , type = int )
326+ @click .argument ("csad_id" , type = int )
327+ @click .argument ("target" , type = float )
328+ @click .pass_context
329+ def set_csad_ph (ctx : click .Context , bow_id : int , csad_id : int , target : float ) -> None :
330+ """Set the pH target value for a CSAD (Chemical Sense and Dispense).
331+
332+ This command sets the target pH level that the CSAD will attempt to maintain.
333+
334+ BOW_ID: The Body of Water (pool/spa) system ID
335+ CSAD_ID: The CSAD equipment system ID
336+ TARGET: Target pH value (typically 7.0-8.0)
337+
338+ Examples:
339+ # Set pH target to 7.4
340+ omnilogic --host 192.168.1.100 debug set-csad-ph 7 20 7.4
341+
342+ # Set pH target to 7.2
343+ omnilogic --host 192.168.1.100 debug set-csad-ph 7 20 7.2
344+
345+ """
346+ ensure_connection (ctx )
347+ omni : OmniLogicAPI = ctx .obj ["OMNI" ]
348+
349+ # Validate target pH (typical range is 6.8-8.2, but allow wider range)
350+ if not 0.0 <= target <= 14.0 :
351+ click .echo (f"Error: pH target must be between 0.0-14.0, got { target } " , err = True )
352+ raise click .Abort
353+
354+ # Execute the command
355+ try :
356+ asyncio .run (omni .async_set_csad_target_value (pool_id = bow_id , csad_id = csad_id , ph_target = target ))
357+ click .echo (f"Successfully set CSAD { csad_id } in BOW { bow_id } pH target to { target } " )
358+ except Exception as e :
359+ click .echo (f"Error setting CSAD pH target: { e } " , err = True )
360+ raise click .Abort from e
361+
362+
363+ @debug .command ()
364+ @click .argument ("bow_id" , type = int )
365+ @click .argument ("csad_id" , type = int )
366+ @click .argument ("target" , type = int )
367+ @click .pass_context
368+ def set_csad_orp (ctx : click .Context , bow_id : int , csad_id : int , target : int ) -> None :
369+ """Set the ORP target level for a CSAD (Chemical Sense and Dispense).
370+
371+ This command sets the target ORP (Oxidation-Reduction Potential) level in
372+ millivolts that the CSAD will attempt to maintain.
373+
374+ BOW_ID: The Body of Water (pool/spa) system ID
375+ CSAD_ID: The CSAD equipment system ID
376+ TARGET: Target ORP value in millivolts (typically 600-800 mV)
377+
378+ Examples:
379+ # Set ORP target to 700 mV
380+ omnilogic --host 192.168.1.100 debug set-csad-orp 7 20 700
381+
382+ # Set ORP target to 650 mV
383+ omnilogic --host 192.168.1.100 debug set-csad-orp 7 20 650
384+
385+ """
386+ ensure_connection (ctx )
387+ omni : OmniLogicAPI = ctx .obj ["OMNI" ]
388+
389+ # Validate target ORP (typical range is 400-900 mV, but allow 0-1000)
390+ if not 0 <= target <= 1000 :
391+ click .echo (f"Error: ORP target must be between 0-1000 mV, got { target } " , err = True )
392+ raise click .Abort
393+
394+ # Execute the command
395+ try :
396+ asyncio .run (omni .async_set_csad_orp_target_level (pool_id = bow_id , csad_id = csad_id , orp_target = target ))
397+ click .echo (f"Successfully set CSAD { csad_id } in BOW { bow_id } ORP target to { target } mV" )
398+ except Exception as e :
399+ click .echo (f"Error setting CSAD ORP target: { e } " , err = True )
400+ raise click .Abort from e
0 commit comments