Description
The Python halpi CLI has a get command that retrieves individual measurements and runtime values from the daemon. This command is missing from the Rust implementation.
Python CLI Behavior
halpi get V_in # Get input voltage only
halpi get V_supercap # Get supercap voltage only
halpi get state # Get state only
halpi get firmware_version # Get firmware version only
# etc.
This command calls the /values/<key> endpoint and prints just the value (not in a table format like status).
Reference Implementation
Python implementation: HALPI2-python-daemon/src/halpi/cli.py:248-267
@app.command("get")
def get(
measurement: str = typer.Argument(
...,
help=(
"Measurement to retrieve (e.g., V_in, V_supercap, I_in, "
"T_mcu, state, 5v_output_enabled, usb_port_state, watchdog_enabled, "
"watchdog_timeout, watchdog_elapsed, hardware_version, firmware_version, "
"device_id)"
),
),
) -> None:
"""Get individual measurements and runtime values."""
try:
value = asyncio.run(async_get_value_key(state["socket"], measurement))
console.print(value)
except Exception as e:
console.print(f"Error getting measurement '{measurement}': {e}", style="red")
raise typer.Exit(code=1)
Proposed Implementation
Add a new Get command to the Rust CLI:
#[derive(Subcommand)]
enum Commands {
// ... existing commands ...
/// Get individual measurements and runtime values
Get {
/// Measurement key to retrieve (e.g., V_in, state, firmware_version)
measurement: String,
},
}
The command should:
- Accept a measurement key as an argument
- Call the
/values/<key> endpoint via the Unix socket
- Print just the value (not formatted in a table)
- Exit with error code 1 if the key doesn't exist or another error occurs
API Compatibility
This is required for 100% CLI compatibility with the Python halpid 4.x version.
Description
The Python
halpiCLI has agetcommand that retrieves individual measurements and runtime values from the daemon. This command is missing from the Rust implementation.Python CLI Behavior
This command calls the
/values/<key>endpoint and prints just the value (not in a table format likestatus).Reference Implementation
Python implementation:
HALPI2-python-daemon/src/halpi/cli.py:248-267Proposed Implementation
Add a new
Getcommand to the Rust CLI:The command should:
/values/<key>endpoint via the Unix socketAPI Compatibility
This is required for 100% CLI compatibility with the Python
halpid4.x version.