Logic Machine Forum
Mikrotik - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Mikrotik (/showthread.php?tid=5742)



Mikrotik - gjniewenhuijse - 14.11.2024

Hello,

I created a script to connect my LM from my Mikrotik device to check if my car is at home, like the example https://kb.logicmachine.net/integration/mikrotik/

Code:
# tesla
:global auto01Stor
:local auto01 [/ip arp find mac-address="XX:XX:XX:XX:XX:XX" and complete=yes];
# tesla model 3
:if ($auto01 != $auto01Stor) do={
  :if ($auto01 != "") do={
    /tool fetch url="http://xxxxx:xxxxxxxx@x.x.x.x/scada-remote" http-data="m=json&r=grp&fn=write&alias=32/1/4&value=1" http-method=post;
  } else= {
    /tool fetch url="http:// xxxxx:xxxxxxxx@x.x.x.x /scada-remote" http-data="m=json&r=grp&fn=write&alias=32/1/4&value=0" http-method=post;
  }
  :set auto01Stor $auto01;
}

But with the latest firmware this doesn't work. Maybe because you can't send the username and password this way. 

How to solve this?


RE: Mikrotik - admin - 15.11.2024

This can be done via Mikrotik API / Wi-Fi registration table. Updated example has been posted here: https://kb.logicmachine.net/integration/mikrotik/#example