Automation / Scripting of OpenWrt

Hi All,

Cross-posting also from OpenWrt forum.

Newbie question, so please excuse if I use wrong terminology. I have a Battery Powered LTE router running OpenWrt (Gl.Inet Pulli) which I use in my car as a travel router. Great little device and works really well, however with one minor annoyance, which I hope can be addressed with some form of script or automation…

When we arrive back home from a trip, I turn off the car engine, and (of course) the router switches to battery mode, and all the devices (kid’s iPads etc) stay connected to the travel router. This has 2 downsides - 1) The devices are connected to the slower LTE network rather than home wifi and 2) The battery runs down.

I’d like to know if it’s possible to write a script that would work this way…

TRIGGER - when the router switches to battery mode (ie car ignition turned off)
CONDITION - check if the home wifi SSID is detected
ACTION - power off the router

Is this kind of scripting / automation possible in OpenWrt? Or is there a better alternate approach that anyone could suggest?

Thanks for any help

If you set up repeater, the router will automatically connect to your home wifi when you arrive at home.

But unfortunately the router cannot be powered off completely via script.

1 Like

Thanks @alzhao - with that in mind, is there some way on the device to set a weight or priority on the different internet connections? If I set up repeater mode for my home wifi, then when I arrive home, the router will have 2x internet connections - one repeater, and the still active LTE? My concern is that it might “load-balance” between the 2 networks, which would lead to 50% of the traffic still going over the LTE connection which is “metered” rather than the home wifi which is unlimited.

By defaullt it is doing “fail over”, not “load balance”.

So it will use Repeater when it is available. It will use LTE only when Repeater is not connected.

1 Like

Great - thanks @alzhao - so is there any setting that controls the order with which internet connections are considered? I assume it’s something like…

  1. Wired Ethernet
  2. Repeater
  3. LTE
  4. Tethering
    Is that right, and can it be changed?
    Also, is there any reason that the OpenWrt poweroff command wouldn’t work?

You can adjust the order in the multiple wan settings.

Tethering is ahead of Cellular.

1 Like

Brilliant - thanks again @alzhao!

And lastly do you know if the poweroff command would work? (I want to preserve battery charge)