diff --git a/src/infuse_iot/socket_comms.py b/src/infuse_iot/socket_comms.py index 99513a8..764c91f 100644 --- a/src/infuse_iot/socket_comms.py +++ b/src/infuse_iot/socket_comms.py @@ -47,7 +47,7 @@ def from_json(cls, values: dict) -> Self: return cast(Self, ClientNotificationConnectionDropped.from_json(values)) elif values["type"] == cls.Type.KNOWN_DEVICES: return cast(Self, ClientNotificationObservedDevices.from_json(values)) - raise NotImplementedError + raise NotImplementedError(f"Unknown notification: {values}") class ClientNotificationEpacketReceived(ClientNotification): @@ -147,7 +147,7 @@ def from_json(cls, values: dict) -> Self: return cast(Self, GatewayRequestConnectionRelease.from_json(values)) elif values["type"] == cls.Type.KNOWN_DEVICES: return cast(Self, GatewayRequestObservedDevices.from_json(values)) - raise NotImplementedError + raise NotImplementedError(f"Unknown request: {values}") class GatewayRequestEpacketSend(GatewayRequest): diff --git a/src/infuse_iot/tools/cloud.py b/src/infuse_iot/tools/cloud.py index ec70857..ba2c6f7 100644 --- a/src/infuse_iot/tools/cloud.py +++ b/src/infuse_iot/tools/cloud.py @@ -169,9 +169,10 @@ def add_parser(cls, parser): info_parser = tool_parser.add_parser("info", help="General device information") info_parser.set_defaults(command_fn=cls.info) info_parser.add_argument("--id", type=str, required=True, help="Infuse-IoT device ID") - info_parser = tool_parser.add_parser("kv_state", help="Key-Value device state") - info_parser.set_defaults(command_fn=cls.kv_state) - info_parser.add_argument("--id", type=str, required=True, help="Infuse-IoT device ID") + kv_parser = tool_parser.add_parser("kv_state", help="Key-Value device state") + kv_parser.set_defaults(command_fn=cls.kv_state) + kv_parser.add_argument("--id", type=str, required=True, help="Infuse-IoT device ID") + kv_parser.add_argument("--schedules", action="store_true", help="Display task schedules") def run(self): with self.client() as client: @@ -242,6 +243,10 @@ def kv_state(self, client: Client): for element in kv_state: key = element.key_name if isinstance(element.key_name, str) else str(element.key_id) + # Don't display task schedules unless requested + if key == "TASK_SCHEDULES" and not self.args.schedules: + continue + if isinstance(element.data, Unset): table.append((key, "Not set")) else: diff --git a/src/infuse_iot/tools/localhost.py b/src/infuse_iot/tools/localhost.py index 7a7bb74..08c5035 100644 --- a/src/infuse_iot/tools/localhost.py +++ b/src/infuse_iot/tools/localhost.py @@ -44,6 +44,7 @@ def add_parser(cls, parser): def __init__(self, args): self._data_lock = threading.Lock() self._columns: dict[str, dict] = {} + self._apps: set[str] = set() self._data: dict[int, dict] = {} self._port: int = args.port @@ -130,6 +131,7 @@ async def websocket_handler(self, request: BaseRequest): "columns": columns, "rows": [self._data[d] for d in devices], "tdfs": sorted(list(self._columns.keys())), + "apps": sorted(list(self._apps)), } self._data_lock.release() @@ -219,7 +221,9 @@ def recv_thread(self) -> None: if t.NAME not in self._data[source.infuse_id]: self._data[source.infuse_id][t.NAME] = {} if t.NAME in ["ANNOUNCE", "ANNOUNCE_V2"]: - self._data[source.infuse_id]["application"] = f"0x{t.application:08x}" + app_str = f"0x{t.application:08x}" + self._data[source.infuse_id]["application"] = app_str + self._apps.add(app_str) for field in t.iter_fields(nested_iter=False): if isinstance(field.val, structs.tdf_struct_mcuboot_img_sem_ver): diff --git a/src/infuse_iot/tools/localhost/index.html b/src/infuse_iot/tools/localhost/index.html index b2822cb..90f5916 100644 --- a/src/infuse_iot/tools/localhost/index.html +++ b/src/infuse_iot/tools/localhost/index.html @@ -127,7 +127,7 @@