找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 12207|回复: 5

[其它] rb路由器控制usb风扇定制关机脚本

[复制链接]
发表于 2020-6-9 17:03:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
本帖最后由 xuxi3201 于 2020-6-9 17:12 编辑

rb路由器功耗就3w,是我选择的理由
最近买了一个usb风扇,
以下是我新写的脚本,可以定时关风扇。
计划任务,每10分钟检查一次。
连续5次检查结果是没有流量,就关闭usb供电9999秒
ros20-0609.jpg


前期咨询cspm333 多次,在此表示感谢


恢复usb供电的办法,在dhcp的脚本里增加一行
{
/system routerboard usb power-reset duration=1
};



rb-usb.zip

806 Bytes, 阅读权限: 10, 下载次数: 2

售价: 5 铜板  [记录]

txt文件

routeros
发表于 2020-6-10 13:24:06 | 显示全部楼层
想法牛牛牛牛。。。
routeros
回复

使用道具 举报

 楼主| 发表于 2020-7-23 12:20:40 | 显示全部楼层
最近修改了一下,
如果手机在线,就开灯,
后半夜,一个手机不在线,就关灯。
白天关灯。
# 下面开始
# 下面开始
{
#   usb power 2 USBOLD=$USBOLD
:global USBPOW
:local USBOLD $USBPOW
:local USBNEXT "on"
:local tt ([:pick [/system clock get time] 0 8])
:local hh ([:pick [/system clock get time] 0 2])
#
:if ($USBPOW !="on" &&  $USBPOW !="off") do={:set USBPOW "on";};
:local LL037 [:len [/caps-man registration-table find mac-address="00:EC:0A:E2:xx:xx"]]
:local LL038 [:len [/caps-man registration-table find mac-address="84:C7:EA:3B:xx:xx"]]
#
:if ($hh <7 && $LL037 =0) do={:set USBNEXT "off";} ;
:if ($hh >6 && $hh <18 && $USBPOW ="on") do={:set USBNEXT "off";};
:if ($hh >6 && $hh <18 && $USBPOW ="off") do={:set USBNEXT "off";};
:if ($hh >17 && ($LL037 +$LL038) =0) do={:set USBNEXT "off";};
#
:if ($USBPOW="off" &&  $USBNEXT="on") do=\
{ /system routerboard usb power-reset duration=3;:set USBPOW "on"; };
#
:if ($USBPOW="on" &&  $USBNEXT="off") do=\
{ /system routerboard usb power-reset duration=86400;:set USBPOW "off"; };
}
#
routeros
回复

使用道具 举报

 楼主| 发表于 2020-7-23 12:27:25 | 显示全部楼层
ros0723.jpg
补充一下,
我把usb风扇,换成usb灯了
睡觉时候,把手机wifi关了,
灯就关了,
很好。
routeros
回复

使用道具 举报

发表于 2020-8-20 14:34:39 | 显示全部楼层
很好很强大
routeros
回复

使用道具 举报

发表于 2020-8-21 04:13:44 | 显示全部楼层
这个思路还行,我也去试一下
routeros
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-3-28 17:42 , Processed in 0.194322 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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