Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15133

Scripting • Script does not execute any longer

$
0
0
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
Code:
: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?

Statistics: Posted by woro — Sun Jan 28, 2024 5:57 pm



Viewing all articles
Browse latest Browse all 15133

Trending Articles