I've got a basic lease script to detect if my phone is present:
Code: Select all
:global chMAC "F4:xxx";
:global leaseBound
:global leaseServerName
:global leaseActMAC
:global leaseActIP
:if ($leaseBound =1) do={
:if ([$leaseActMAC] = $chMAC) do={
:log info "assign CH";
/tool fetch http-method=put url="http://192.168.1.25:8080/rest/items/pres_ch/state" mode=http http-header-field="content-type: text/plain" http-data="ON"
}
}
:if ($leaseBound =0) do={
:if ([$leaseActMAC] = $chMAC) do={
:log info "deassign CH";
/tool fetch http-method=put url="http://192.168.1.25:8080/rest/items/pres_ch/state" mode=http http-header-field="content-type: text/plain" http-data="OFF"
}
}
However, I noticed the following entries in my log:
Code: Select all
653 20:57:42 dhcp,info defconf deassigned 192.168.1.52 from F4:xxx
654 20:57:42 dhcp,info defconf assigned 192.168.1.52 to F4:xxx
655 20:57:42 script,info assign CH
656 20:57:42 script,info deassign CH
As you can see, the script is executed in reverse order, for the statements, rendering my result
useless.
Is there any way to serialize this?