Hello guys!
Maybe someone can help with advice or script.
On the POE router, I need following: when the interface is turned off, POE is also turned off and vice versa.
Thanks!
or
/interface ethernet disable [find <some field>=<some value>]
/interface ethernet disable [find mac-address=0C:10:7B:A0:00:01]
/interface ethernet enable [find mac-address=0C:10:7B:A0:00:01]
[find mac-address=
The logic is as follows, only there is one nuance, I can’t get the current statuses of the interfaces lolWhen the script disable/enable the interface, add a line for off/auto the poe...
:local interfaces ("ether1", "ether2", "ether3", "ether4", "ether5")
:foreach interfaceName in=$interfaces do={
:local poeInterface [/interface find name=$interfaceName]
:if ($poeInterface != "") do={
:local linkState [/interface get $interfaceName link]
:if ($linkState = "down") do={
:local poeEnabled [/interface get $poeInterface poe-out]
:if ($poeEnabled = "auto-on") do={
/interface poe set $poeInterface poe-out=off
:log info ("POE on interface $interfaceName has been disabled.")
}
} else={
:local linkState [/interface get $interfaceName link]
:if ($linkState = "up") do={
:local poeDisabled [/interface get $poeInterface poe-out]
:if ($poeDisabled = "off") do={
/interface poe set $poeInterface poe-out=auto-on
:log info ("POE on interface $interfaceName has been enabled.")
}
}
}
I use Mikrotik integration in Home Assistant, which expose ports, trafic sensors and many many another.Maybe you’re going about this the wrong way. Not enough information provided
If all your end devices are power from the router/switch. Why not *just* turn off Poe. That will then in turn make the interface “not running”, and you can easily see/script based upon that if you have other things that depend on the interface status
Why would you go through all this effort?
But i guess thats my point really.I use Mikrotik integration in Home Assistant, which expose ports, trafic sensors and many many another.Maybe you’re going about this the wrong way. Not enough information provided
If all your end devices are power from the router/switch. Why not *just* turn off Poe. That will then in turn make the interface “not running”, and you can easily see/script based upon that if you have other things that depend on the interface status
Why would you go through all this effort?
So i have POE router with cameras connected to it.
I have automation, which, in the event of a battery discharge (from which the entire infrastructure is powered), smoothly disconnects the consumers specified in the automation.
So, the switch, which can be controlled from the home assistant, turns off only ethernet, while the POE on the interface remains turned on and consumes electricity.
It’s actually for these purposes that I want to write a script to bind these events.
I hope I explained.