Hello,
I have a remote, solar-powered site with a RB5009(POE version). The 5009 is fully powered from the 5.5mm DC jack, from a DC-DC 24-56V converter. My battery system voltage is 24V, and I'm also feeding that battery voltage into the 2-pin connector of the 5009 as a voltage reference for running my script.
So far, I have built several working scripts, used to turn ON POE when the batteries are getting a good charge from solar, and turn OFF when the battery voltage drops off at night (I don't need to run my camera and AP at night). By simply adjusting the turn on/off voltage, I can prioritize which devices turn on, given the state of battery charge.
The scripts seem to be working ok, but this is my first attempt at a script, and I was wondering if you could take a look at my script to see if there are any blatant errors or no-nos. Could you please have a look, and tell me if I need to make any corrections? Again, I have one of these scripts set up for each POE port device, and they are driven by a scheduler that runs them every 5 to 10 minutes, staggered, so they don't all run at the same time.
Thank you in advance!
Here's the script:
# Name the Device Connected to Port
:local portdevice "Mast Camera"
# Define which port to control
:local ethport LAN5
# Define what battery voltage device will turn on at
:local cutinvolts 28.2
# Define what battery voltage POE will be disabled at
:local shutoffvolts 25.4
# Define the earliest hour POE will be turned on
:local ontimeearliest 6
# Define the latest hour POE will be turned on
:local ontimelatest 12
#Gather System Information
:local voltmeter [/system/health get [find name=2pin-voltage] value]
:local poestatus;
/interface ethernet poe monitor $ethport once do={:set poestatus $"poe-out-status";}
:local thistime [/system clock get time]
:local thishour [:pick $thistime 0 2]
#Argument to turn POE OFF
:if ($voltmeter <= $shutoffvolts && $poestatus = "powered-on") do={
/interface ethernet poe set poe-out=off $ethport;
:log info message=("$portdevice POE Disabled, Voltage = $voltmeter")}
#Argument to turn POE ON
:if (($voltmeter >= $cutinvolts) && ($poestatus = "disabled") && ($thishour >= $ontimeearliest) && ($thishour <= $ontimelatest)) do={
/interface ethernet poe set poe-out=forced-on $ethport;
:log info message=("$portdevice POE Enabled, Voltage = $voltmeter")}