diff --git a/src/iotcli/cli/commands/control.py b/src/iotcli/cli/commands/control.py index e882496..5a76970 100644 --- a/src/iotcli/cli/commands/control.py +++ b/src/iotcli/cli/commands/control.py @@ -37,11 +37,13 @@ def control(ctx, action, device_name, value): """Control a device: on, off, status, set property=value.""" out = Output(ctx.obj["json_output"]) cfg: ConfigManager = ctx.obj["config"] - ctrl = DeviceController(verbose=ctx.obj["verbose"], debug=ctx.obj["debug"]) + device = cfg.get_device_or_none(device_name) device = cfg.get_device_or_none(device_name) if not device: out.error(f"Device not found: {device_name}") + return + ctrl = DeviceController(verbose=ctx.obj["verbose"], debug=ctx.obj["debug"]) try: if action == "on": diff --git a/src/iotcli/skills/generator.py b/src/iotcli/skills/generator.py index be92df7..97b841c 100644 --- a/src/iotcli/skills/generator.py +++ b/src/iotcli/skills/generator.py @@ -159,7 +159,6 @@ def build_device_context(device: Device) -> dict[str, Any]: "petfeeder": [ "`on` triggers exactly **one quick portion** — it does NOT let you choose the amount.", "To dispense a specific amount use `set \"portions=N\"` (N = 1–10). This is the correct command for scheduled or on-demand feeding.", - "To dispense a specific amount use `set \"portions=N\"` (N = 1–60). This is the correct command for scheduled or on-demand feeding.", "Always query status first to check `food_level` before feeding — dispense may fail silently if the hopper is empty.", ], "airfryer": [ diff --git a/tests/test_mcp.py b/tests/test_mcp.py index 2a429ed..1c17724 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -11,6 +11,8 @@ import json import pytest +pytest.importorskip("mcp") + from iotcli.config.manager import ConfigManager from iotcli.core.device import Device, DeviceStatus from iotcli.mcp.tools import list_tools, handle_tool