Community discussions

MikroTik App
 
woro
Member Candidate
Member Candidate
Topic Author
Posts: 104
Joined: Sun May 24, 2015 12:47 am

Script does not execute any longer

Sun Jan 28, 2024 5:57 pm

Hi,

for my home automation's presence information I have been using a script to recognize when certain devices are registered in my wifi.

It seems this script stopped working due to an update but unfortunately I didn't recognize it quickly enough to still remember which update it was. Most likely 7.12 -> 7.13 though.

Here is the shortened script:
name="Presence" owner="admin" policy=read,write,policy,test dont-require-permissions=no
:global WolfgangON

{
  :local exists [/interface/wifi/registration-table find mac-address="CA:FF:EE:CA:FF:EE"];
  :if ($exists!="") do={
     :if ($WolfgangON != 1) do={
        /tool fetch url="http://192.168.250.12:8080/rest/items/SensorPhoneWolfgang" http-header-field="content-type:text/plain" http-data="ON" ascii=yes http-method=post;
       :set WolfgangON 1
     }
  }  else={
     :if ($WolfgangON != 0) do={
        /tool fetch url="http://192.168.250.12:8080/rest/items/SensorPhoneWolfgang" http-header-field="content-type:text/plain" http-data="OFF" ascii=yes http-method=post; 
        :set WolfgangON 0
     }
  }
}
When I run the code manually all is working as expected. So I assume it's somewhat related to policies which has been an issue throughout the last years once in a while. But even after reading more docs I don't see which policy might be missing or wrong.

Any hints?
 
optio
Long time Member
Long time Member
Posts: 675
Joined: Mon Dec 26, 2022 2:57 pm

Re: Script does not execute any longer

Sun Jan 28, 2024 6:12 pm

From 7.13 changelog:
*) fetch - require "ftp" user policy;

Generally, if you are only user which have access to router, add all policies to scripts and dont-require-permissions=yes and you will not have problems like this. I'm setting this to scripts from beginning and never had such issues with scripts during ROS version updates, but I'm only one who can log in into router and I'm not using some kind of ROS remote control automation with some restricted user.

Who is online

Users browsing this forum: No registered users and 7 guests