Teltonika Firmware 17.1 Switch On Off Wireguard with Event Juggler

Hello,

Since the I/O Juggler will no longer work in the future, I wanted to use the Event Juggler.
However, I have not been able to find a way to deactivate or activate Wireguard via a script.

Can anyone help me with this? The Wireguard connection should be switched on and off via a key switch using input (3).

Thanks in advance.
Walle

Hello,

I recommend checking our script examples here: User Scripts examples - Teltonika Networks Wiki to better understand how to write scripts for our devices.

In your script, for example, you could use the WireGuard config POST method (https://developers.teltonika-networks.com/reference/rutx50/7.10.1/v1.2/wireguard#post-wireguard-config), where you can specify whether to enable or disable WireGuard.

Please let me know if you have any further questions about this.

Best regards,

It used to be very easy. I used to disable my Wireguard connections with this command, but now nothing seems to work in the new Event Juggler.
I can’t even tell if the script is starting or what is happening in the background. I can’t find any status messages or reports.

Example:
uci set network.NameofWireguardconnectgion1.disabled=‘1’
uci set network.NameofWireguardconnectgion2.disabled=‘1’
uci set network.NameofWireguardconnectgion3.disabled=‘1’
uci set network.NameofWireguardconnectgion4.disabled=‘1’
uci commit network
/etc/init.d/network restart

No nothing happends

I forgot something

Is it possible to stop the Wirrgusrd server without having to restart the modem every time?

But that would be secondary; the important thing is that you can switch the Wireguard connection on and off using the key switch via input 3.

I have configured everything, but it does not start the script.
Where can I see what the problem is?
It goes through the condition, but is it actually running my script?

grafik

How can I tell if it has accepted and processed the script?

Event Juggler

Event Data Configuration:

Conditions:

The script with the following commands:

Thank you in advanced

I finally found a solution.

It has to go in the root directory, see the image below.

I think that should help you too. In any case, it works when I have it in the root folder. Why it only works there, I honestly have no idea.

grafik

Hello,

Apologies for the delayed response.

Am I correct in understanding that your issue is resolved? If not, please let me know.

Feel free to reach out if you have any further questions or need additional assistance.

Best regards,

Hello Marija,
Yes, I found a solution using the UCI commands. However, I have to restart the modem every time, which is not very convenient.

I haven’t implemented your suggestion with the Wireguard POST script. Could you send me an example?
Can I stop Wireguard without having to restart the modem every time? If I use the key switch?

Cheers

Hello,

When using the API, there is no need to restart the network — you can simply enable or disable the WireGuard instance.

To disable WireGuard:
api put /wireguard/config '{"data":[{"id":"tunnelname","enabled":"0"}]}'
To enable WireGuard:
api put /wireguard/config '{"data":[{"id":"tunnelname","enabled":"1"}]}'.

Let me know if you have any more questions!

Best regards,

Oh, now I understand… This would be a completely different implementation than the one I implemented above. I thought everything was done via the WEB GUI? The API is a completely different approach.

The Wireguard configuration would therefore not be created via the WEB GUI, but via a script in JSON format.

Can you provide me with a backup of a sample configuration? So I can see how the API is used.

Hello,

If you have WireGuard configured on your router, you can log in via CLI and execute the command: api get /wireguard/config
This will return your WireGuard configuration so you can review its structure.

I also recommend checking our API reference for more details: https://developers.teltonika-networks.com/reference/rutx50/7.10.1/v1.2/wireguard#get-wireguard-config.

Best regards,