|
23 | 23 | get_device_by_device_id, |
24 | 24 | get_device_kv_entries_by_device_id, |
25 | 25 | get_device_last_route_by_device_id, |
| 26 | + get_device_logger_states_by_device_id, |
26 | 27 | get_device_state_by_id, |
27 | 28 | ) |
28 | 29 | from infuse_iot.api_client.api.organisation import ( |
@@ -192,6 +193,7 @@ def info(self, client: Client): |
192 | 193 | board = get_board_by_id.sync(client=client, id=info.board_id) |
193 | 194 | state = get_device_state_by_id.sync(client=client, id=info.id) |
194 | 195 | route = get_device_last_route_by_device_id.sync(client=client, device_id=id_str) |
| 196 | + logger_states = get_device_logger_states_by_device_id.sync(client=client, device_id=id_str) |
195 | 197 |
|
196 | 198 | table: list[tuple[str, Any]] = [ |
197 | 199 | ("UUID", info.id), |
@@ -221,6 +223,24 @@ def info(self, client: Client): |
221 | 223 | if route.bt_adv: |
222 | 224 | table += [("BT Address", f"{route.bt_adv.address} ({route.bt_adv.type_})")] |
223 | 225 |
|
| 226 | + if isinstance(logger_states, list) and len(logger_states) > 0: |
| 227 | + logger_names = { |
| 228 | + 0: "Onboard", |
| 229 | + 1: "Removable", |
| 230 | + } |
| 231 | + |
| 232 | + for logger in logger_states: |
| 233 | + name = logger_names.get(logger.index, str(logger.index)) |
| 234 | + table += [ |
| 235 | + (f"~~~{name} Logger Sync~~~", ""), |
| 236 | + ("Last Report Time", logger.last_reported_time), |
| 237 | + ("Last Downloaded Time", logger.last_downloaded_time), |
| 238 | + ("Reported Block", logger.last_reported_block), |
| 239 | + ("Downloaded Block", logger.last_downloaded_block), |
| 240 | + ] |
| 241 | + if isinstance(logger.last_reported_block, int) and isinstance(logger.last_downloaded_block, int): |
| 242 | + table += [("Block Lag", logger.last_reported_block - logger.last_downloaded_block)] |
| 243 | + |
224 | 244 | print(tabulate(table)) |
225 | 245 |
|
226 | 246 | def _kv_display(self, table: list[tuple[str, Any]], name_base: str, dictionary: dict): |
|
0 commit comments