From 31926ecf80218747028f461e9ead8d1c80910e93 Mon Sep 17 00:00:00 2001 From: Rodrigo Bertoldo de Sousa Martins Date: Thu, 2 Apr 2026 13:12:32 -0300 Subject: [PATCH] genieACS: add more parameters Signed-off-by: Rodrigo Bertoldo de Sousa Martins --- src/bot/handler.js | 51 ++++++++++++++++++++++++++++++++++++++++++--- src/genieacs/api.js | 42 +++++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 5 deletions(-) diff --git a/src/bot/handler.js b/src/bot/handler.js index ba16498..9f721c8 100644 --- a/src/bot/handler.js +++ b/src/bot/handler.js @@ -1164,7 +1164,31 @@ Digite /help para ver todos os comandos disponíveis! msgCPE += ` 🔧 SW: ${esc(d.softwareVersion)}\n`; if (tagLabel) msgCPE += ` 🏷️ TAG: \`${tagLabel}\`\n`; if (d.ssid24) msgCPE += ` 📶 SSID 2.4GHz: ${esc(d.ssid24)} (Canal ${esc(d.channel24)}, Auto: ${esc(d.autoChannel24)})\n`; + if (d.clients24 !== null && d.clients24 !== undefined) msgCPE += ` 👥 Clientes 2.4GHz: ${esc(d.clients24)}\n`; if (d.ssid5) msgCPE += ` 📶 SSID 5GHz: ${esc(d.ssid5)} (Canal ${esc(d.channel5)}, Auto: ${esc(d.autoChannel5)})\n`; + if (d.clients5 !== null && d.clients5 !== undefined) msgCPE += ` 👥 Clientes 5GHz: ${esc(d.clients5)}\n`; + + // PPPoE WAN + if (d.pppoeStatus || d.pppoeIP) { + msgCPE += `\n 🌐 *PPPoE WAN*\n`; + if (d.pppoeStatus) msgCPE += ` ├ Status: ${esc(d.pppoeStatus)}\n`; + if (d.pppoeIP) msgCPE += ` ├ IP: \`${esc(d.pppoeIP)}\`\n`; + if (d.pppoeUptime) msgCPE += ` ├ Uptime: ${esc(d.pppoeUptime)}\n`; + if (d.gatewayWAN) msgCPE += ` ├ Gateway: ${esc(d.gatewayWAN)}\n`; + if (d.dnsWAN) msgCPE += ` ├ DNS WAN: ${esc(d.dnsWAN)}\n`; + if (d.linkFisicoWAN) msgCPE += ` ├ Link Físico: ${esc(d.linkFisicoWAN)}\n`; + if (d.trafegoRecebido) msgCPE += ` ├ Recebido: ${esc(d.trafegoRecebido)}\n`; + if (d.trafegoEnviado) msgCPE += ` ├ Enviado: ${esc(d.trafegoEnviado)}\n`; + if (d.pppoeLastError && d.pppoeLastError !== 'ERROR_NONE') msgCPE += ` └ Último Erro: ${esc(d.pppoeLastError)}\n`; + } + + // DHCP LAN + if (d.dhcpInicio || d.dhcpFim || d.dnsLAN) { + msgCPE += `\n 🏠 *DHCP LAN*\n`; + if (d.dhcpInicio) msgCPE += ` ├ Início: ${esc(d.dhcpInicio)}\n`; + if (d.dhcpFim) msgCPE += ` ├ Fim: ${esc(d.dhcpFim)}\n`; + if (d.dnsLAN) msgCPE += ` └ DNS LAN: ${esc(d.dnsLAN)}\n`; + } await this.bot.sendMessage(chatId, msgCPE, { parse_mode: 'Markdown' }); } @@ -7396,7 +7420,7 @@ Digite /help para ver todos os comandos disponíveis! const tagLabel = d.tags && d.tags.length > 0 ? d.tags.map(esc).join(', ') : 'N/A'; const buscadoPor = resultado.searchedBy === 'tag' ? 'TAG' : 'Serial'; - const msg = + let msg = `📡 *Informações do Roteador*\n` + `📌 Instância: ${esc(resultado.instance)}\n` + `🔎 Encontrado por: ${buscadoPor}\n\n` + @@ -7411,11 +7435,32 @@ Digite /help para ver todos os comandos disponíveis! `📶 *Wi-Fi 2.4 GHz*\n` + `├ SSID: ${esc(d.ssid24)}\n` + `├ Canal: ${esc(d.channel24)}\n` + - `└ Auto-Canal: ${esc(d.autoChannel24)}\n\n` + + `├ Auto-Canal: ${esc(d.autoChannel24)}\n` + + `└ Clientes: ${d.clients24 !== null && d.clients24 !== undefined ? esc(d.clients24) : 'N/A'}\n\n` + `📶 *Wi-Fi 5 GHz*\n` + `├ SSID: ${esc(d.ssid5)}\n` + `├ Canal: ${esc(d.channel5)}\n` + - `└ Auto-Canal: ${esc(d.autoChannel5)}`; + `├ Auto-Canal: ${esc(d.autoChannel5)}\n` + + `└ Clientes: ${d.clients5 !== null && d.clients5 !== undefined ? esc(d.clients5) : 'N/A'}`; + + // PPPoE WAN + msg += `\n\n🌐 *PPPoE WAN*\n`; + msg += `├ Username: ${esc(d.pppoeUsername)}\n`; + msg += `├ Status: ${esc(d.pppoeStatus)}\n`; + msg += `├ IP: \`${esc(d.pppoeIP)}\`\n`; + msg += `├ Uptime: ${esc(d.pppoeUptime)}\n`; + msg += `├ Gateway: ${esc(d.gatewayWAN)}\n`; + msg += `├ DNS WAN: ${esc(d.dnsWAN)}\n`; + msg += `├ Link Físico: ${esc(d.linkFisicoWAN)}\n`; + msg += `├ Recebido: ${esc(d.trafegoRecebido)}\n`; + msg += `├ Enviado: ${esc(d.trafegoEnviado)}\n`; + msg += `└ Último Erro: ${esc(d.pppoeLastError)}`; + + // DHCP LAN + msg += `\n\n🏠 *DHCP LAN*\n`; + msg += `├ Início: ${esc(d.dhcpInicio)}\n`; + msg += `├ Fim: ${esc(d.dhcpFim)}\n`; + msg += `└ DNS LAN: ${esc(d.dnsLAN)}`; await this.bot.sendMessage(chatId, msg, { parse_mode: 'Markdown' }); diff --git a/src/genieacs/api.js b/src/genieacs/api.js index 401a376..4b5677c 100644 --- a/src/genieacs/api.js +++ b/src/genieacs/api.js @@ -15,12 +15,31 @@ const DEVICE_PROJECTION = [ 'DeviceID.OUI', 'InternetGatewayDevice.DeviceInfo.SoftwareVersion', 'InternetGatewayDevice.DeviceInfo.HardwareVersion', + // Wi-Fi 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID', 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.AutoChannelEnable', 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel', + 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.TotalAssociations', 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.SSID', 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.AutoChannelEnable', - 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.Channel' + 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.Channel', + 'InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.TotalAssociations', + // PPPoE WAN + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Username', + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ConnectionStatus', + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ExternalIPAddress', + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.LastConnectionError', + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSServers', + 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DefaultGateway', + // Link físico e tráfego + 'InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.PhysicalLinkStatus', + 'VirtualParameters.pppoe_uptime', + 'VirtualParameters.trafego_recebido', + 'VirtualParameters.trafego_enviado', + // DHCP LAN + 'InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MinAddress', + 'InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MaxAddress', + 'InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers' ].join(','); class GenieACSApi { @@ -227,12 +246,31 @@ class GenieACSApi { oui : get('DeviceID.OUI') ?? idOUI, softwareVersion : get('InternetGatewayDevice.DeviceInfo.SoftwareVersion'), hardwareVersion : get('InternetGatewayDevice.DeviceInfo.HardwareVersion'), + // Wi-Fi ssid24 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID'), autoChannel24 : autoChannel24 === true || autoChannel24 === 'true' || autoChannel24 === '1' ? 'Sim' : 'Não', channel24 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel'), + clients24 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.TotalAssociations'), ssid5 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.SSID'), autoChannel5 : autoChannel5 === true || autoChannel5 === 'true' || autoChannel5 === '1' ? 'Sim' : 'Não', - channel5 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.Channel') + channel5 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.Channel'), + clients5 : get('InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.TotalAssociations'), + // PPPoE WAN + pppoeUsername : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Username'), + pppoeStatus : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ConnectionStatus'), + pppoeIP : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ExternalIPAddress'), + pppoeUptime : get('VirtualParameters.pppoe_uptime'), + pppoeLastError : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.LastConnectionError'), + dnsWAN : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSServers'), + gatewayWAN : get('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DefaultGateway'), + // Link físico e tráfego + linkFisicoWAN : get('InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.PhysicalLinkStatus'), + trafegoRecebido : get('VirtualParameters.trafego_recebido'), + trafegoEnviado : get('VirtualParameters.trafego_enviado'), + // DHCP LAN + dhcpInicio : get('InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MinAddress'), + dhcpFim : get('InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MaxAddress'), + dnsLAN : get('InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers') }; } }