MCPcopy Create free account
hub / github.com/bytespider/Meross / printDeviceTable

Function printDeviceTable

packages/cli/src/cli.ts:69–110  ·  view source on GitHub ↗
(
  deviceInformation: Record<string, any>,
  deviceAbility?: Record<string, any>,
  devicePassword?: string
)

Source from the content-addressed store, hash-verified

67}
68
69export async function printDeviceTable(
70 deviceInformation: Record<string, any>,
71 deviceAbility?: Record<string, any>,
72 devicePassword?: string
73): Promise<void> {
74 const {
75 system: { hardware: hw, firmware: fw },
76 } = deviceInformation;
77
78 const rows = [
79 [
80 'Device',
81 `${hw.type} ${hw.subType} ${hw.chipType} (hardware:${hw.version} firmware:${fw.version})`,
82 ],
83 ['UUID', hw.uuid],
84 ['Mac address', hw.macAddress],
85 ['IP address', fw.innerIp],
86 ];
87
88 if (fw.server) {
89 rows.push(['Current MQTT broker', `${fw.server}:${fw.port}`]);
90 }
91
92 rows.push(
93 ['Credentials', `User: ^C${hw.macAddress}\nPassword: ^C${devicePassword}`],
94 [
95 'MQTT topics',
96 `Publishes to: ^C/appliance/${hw.uuid}/publish\nSubscribes to: ^C/appliance/${hw.uuid}/subscribe`,
97 ]
98 );
99
100 if (deviceAbility) {
101 const abilityRows = [];
102 for (const [ability, params] of Object.entries(deviceAbility)) {
103 abilityRows.push(`${ability.padEnd(38)}\t${JSON.stringify(params)}`);
104 }
105
106 rows.push(['Ability', abilityRows.join('\n')]);
107 }
108
109 terminal.table(rows, tableOptions);
110}
111
112/**
113 * Displays a list of WIFI Access Points

Callers 1

meross-info.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected