Community discussions

MikroTik App
 
fiendshard
just joined
Topic Author
Posts: 3
Joined: Sat Jan 09, 2021 3:53 pm

Script for turning PoE at exact time and turning off

Wed Dec 15, 2021 10:49 pm

Hey guys,

I need a help from experienced users for this one: I have Mikrotik 2011UiAS-2HnD router that posses one PoE port --
it is "Passive PoE-Out up to 30 V - PoE standard, which does not require negotiation between PSE (Power Sourcing Equipment) and PD (Powered Device). PoE-out uses the same voltage as supplied to the PSE (Power Sourcing Equipment). PoE-Out Standard for devices that supports input voltage up to 30 V. PD resistance on spare pairs should have ranged from 3kΩ to 26.5kΩ. (e.g. hEX PoE lite, RB3011UiAS-RM, RB2011iL-IN.)
And now the tricky part: how can I create script that does the following: turn on the power on that one PoE port at exactly 23:15 every day and keep it on for a 7 hours and then turn off?

Thank you
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 2983
Joined: Mon Apr 08, 2019 1:16 am

Re: Script for turning PoE at exact time and turning off  [SOLVED]

Wed Dec 15, 2021 11:21 pm

You need scheduler and script

Make 2 scripts: one to turn poe power on, another script to turn power off
Schedule both scripts with the needed priviledges in "/system scheduler"

script1 contains
/interface ethernet poe set ether10 poe-out=auto-on

script 2 contains
/interface ethernet poe set ether10 poe-out=off

schedule 1 : script1 runs today at start-time 23:15 interval=24h on-event=script1
schedule 2: script2 runs tomorrow at start-time 6:15 interval=24h on-event=script2


Syntax is only pseudo code.
 
fiendshard
just joined
Topic Author
Posts: 3
Joined: Sat Jan 09, 2021 3:53 pm

Re: Script for turning PoE at exact time and turning off

Wed Dec 15, 2021 11:59 pm

Hey sir, it seems like it's working.

Thank you very much sir. Now I can turn on my heating via solid-state relay at exact time and turn it off in order to preserve energy and to reduce expenses overall

Thank you again.

P.S.

Is it possible to turn off PoE automatically by putting desired time in "INTERVAL" box and simplify whole operation by executing only one scheduled script?
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 2983
Joined: Mon Apr 08, 2019 1:16 am

Re: Script for turning PoE at exact time and turning off

Thu Dec 16, 2021 3:06 am

Is it possible to turn off PoE automatically by putting desired time in "INTERVAL" box and simplify whole operation by executing only one scheduled script?
How will that single permanent running script survive a reboot, restart, power failure? You could make it intelligent with the state and the planned action in a file.

While the 2 scripts will run if it is time to run and the router is up. Restarts are no problem as long as the clock is correct.
 
holvoetn
Forum Guru
Forum Guru
Posts: 5403
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Script for turning PoE at exact time and turning off

Thu Dec 16, 2021 8:20 pm


While the 2 scripts will run if it is time to run and the router is up. Restarts are no problem as long as the clock is correct.
Enable NTP client. Problem solved :lol:
 
DitchRat95
newbie
Posts: 34
Joined: Tue Jul 19, 2022 5:43 pm

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 12:03 am

So if a guy had capsman setup and wanted to turn certain cap interfaces off and on ad certain desired times how could I edit these scripts for that?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 12:06 am

/caps-man interface disable INTERFACE_NAME

/caps-man interface enable INTERFACE_NAME
 
DitchRat95
newbie
Posts: 34
Joined: Tue Jul 19, 2022 5:43 pm

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 12:55 am

do i have to do one for each interface or can i disable multiple caps in one command
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 1:43 am

If you do not have experience, is better you do it for each interface, on same script like:

/caps-man interface disable INTERFACE_NAME1
/caps-man interface disable INTERFACE_NAME2
/caps-man interface disable INTERFACE_NAME3

If you want do something on cool way, set in the name of each CAP something that distinguish the device group.

This disable all the device that have inside the name GR1 on any place. Example GR1_sallon or Saloon_GR1 or Saloon_GR1_5GHz.
No matter the position but MUST be writed on same case, not mixed, for example _GR1_ but not _gr1_ or _Gr1_ or _gR1_ etc.

/caps-man interface disable [find where name~"GR1"]

/caps-man interface enable [find where name~"GR1"]
 
DitchRat95
newbie
Posts: 34
Joined: Tue Jul 19, 2022 5:43 pm

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 1:47 am

Are you referring to a interface list?
I did it the way you first referenced but I would like to learn more!
Thank you for your help by the way!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 1:53 am

Are you referring to a interface list?
No, just add an abbreviation inside the cap interface name that represents the logical group they belong to in your mind.
Don't invent or try to figure out what I have not written there.
 
DitchRat95
newbie
Posts: 34
Joined: Tue Jul 19, 2022 5:43 pm

Re: Script for turning PoE at exact time and turning off

Thu Apr 27, 2023 2:12 am

so for the cap name I could put say "Guest cAP" for all the interface names the interfaces I desire?

Who is online

Users browsing this forum: No registered users and 26 guests