SOLVED Switch on PoE-out when the CPU temperature is too high

Hello, I would like a script that turns on the PoE-out if the CPU temperature of the router gets too high. Temperature adjustable.
This by script in schedullar.
Does anyone have an idea?
Hoping that someone can help

This should get you startet.
I do not have PoE interface, so could not test that.

:if ([/system health get temperature] >= 40) do={
/interface ethernet set ether1 poe-out=forced-on
}

Save this as a script and run it as a schedule job.

To add from cli (10 minute interval and 40 degree as limit)

/system script
add dont-require-permissions=no name=Temperatur-PoE owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
    ":if ([/system health get temperature] >= 40) do={\r\
    \n:put \"yes\"\r\
    \n} "

/system scheduler
add interval=10m name=PoE-test on-event=Temperatur-PoE policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-date=mar/22/2019 start-time=15:30:00

Hello Jotne, it works like a charm, you are great with scripts.

Thank you verry verry match

I would add a second script to check if cpu temp is say below 30 to turn off POE.

I take it the POE is powering a FAN?

That was simple…