找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 3469|回复: 44

[小米其它型号路由器] 小米WR30U-Lede固件编译添加CPU,WIFI温度显示

[复制链接]
本帖最后由 Lost.V 于 2023-9-10 13:19 编辑

起因: 自己玩wr30u。看到既然有温度传感器,页面上没有显示,就想着加一个,所以产生了一下的方法。 (此方法其实通用与有温控的设备)
效果 看图

方法:
PS 小改动了下样式,之前漏了一点代码,现在补全了




1、增加中文词条
文件路径/home/lede/lede/package/lean/default-settings/po/zh-cn/default.po

        msgid "Temperature"
        msgstr "温度"

        msgid "WiFi Temperature"
        msgstr "WiFi 温度"


2、修改状态页显示温度
文件路径 /home/lede/lede/feeds/luci/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm

2.0 找到
                        local cpu_usage = (luci.sys.exec("expr 100 - $(top -n 1 | grep 'CPU:' | awk -F '%' '{print$4}' | awk -F ' ' '{print$2}')") or "6") .. "%"


                        再此行下面添加
        
                        local cpu_temp = luci.sys.exec("echo $(awk {'print sprintf(\"%.2f\",$1/1000)'} /sys/class/thermal/thermal_zone0/temp) ℃")
               
                        local wifi1_temp = luci.sys.exec("echo $(awk {'print sprintf(\"%.f\",$1/1000)'} /sys/class/ieee80211/phy0/hwmon1/temp1_input) ℃")
        
                        local wifi2_temp = luci.sys.exec("echo $(awk {'print sprintf(\"%.f\",$1/1000)'} /sys/class/ieee80211/phy1/hwmon2/temp1_input) ℃")

2.1、找到                local rv = {
                                cpuusage = cpu_usage,

                        在此行下面添加
                                cputemp = cpu_temp,         (新增)
                                wifi1temp = wifi1_temp,        (新增)
                                wifi2temp = wifi2_temp,        (新增)

2.2、找到                  if (e = document.getElementById('cpuusage'))
                                e.innerHTML = info.cpuusage;
                        
                        在此行下面添加
                                
                        if (e = document.getElementById('cputemp'))        (新增)
                                e.innerHTML = info.cputemp;
                        
                        if (e = document.getElementById('wifi1temp'))        (新增)
                                e.innerHTML = info.wifi1temp;
                        
                        if (e = document.getElementById('wifi2temp'))        (新增)
                                e.innerHTML = info.wifi2temp;

2.3、找到                 <tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr> 行,
                        在此行下添加
                        
游客,如果您要查看本帖隐藏内容请回复



处女技术贴,希望大家喜欢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 1恩山币 +1 收起 理由
poph*** + 1 强大的恩山!(以下重复1万次)

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
支持一下, 这个有办法加在编译脚本里面吗?

点评

道理上可以 懒得折腾 这个方法也很简单了  详情 回复 发表于 2023-9-7 19:13
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
1538304461 发表于 2023-9-7 15:54
支持一下, 这个有办法加在编译脚本里面吗?

道理上可以  懒得折腾 这个方法也很简单了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

学习一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢楼主
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

留名备用
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

谢谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

有兴趣出个360T7的不
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

有兴趣出个360T7的不?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
好东西,mark
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

官方固件能不能改
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

正需要这个,感谢楼主的分享,谢谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享,空了研究一下。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-27 18:04

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表