Skip to main content

net_command

Function net_command 

Source
pub fn net_command(
    netname: &str,
    role: impl Into<Option<&'static str>>,
    action: &str,
    params: Value,
    timeout: Timeout,
) -> HttpRequest
Expand description

Build a POST /net/command request (gpio, adc, dac, thermocouple, watt-meter, eload, spi, i2c, energy-analyzer).

The role is sent as a hint; the box resolves the authoritative role from its saved_nets.json and verifies the hint, so a typo’d net name or a role mismatch fails loudly instead of driving the wrong instrument.

role: None omits the hint entirely and defers fully to the box’s resolution. Used for roles with saved-record aliases (router nets may be saved as "router" or the legacy "mikrotik"; the box dispatches both to the same handler, but a hint must match the saved string exactly).