How to limit internet connection to a certain duration per day per device

Hello dear OpenWrt community,
I have been using OpenWRT (as a noob) for a while, and never could find a solution for the following problem:
How can I limit the duration of active internet traffic per device and per day ?

The application is obvious: limit the kids TV time...

Now, I know it is a naive way of framing the problem, as one needs to define what it means to have an "active internet traffic". But I can definitely set a threshold of data per minute that differentiate when the TV is on vs when it is just spying on us.

Any help would be greatly appreciated,
thank you !

Thank you, please note that I am not interested in time / schedule limitation, but activity duration.

Example: I want to limit the TV to 3h of video streaming per day, whatever the time of the day it is.

ok sorry I misunderstood the question


maybe you could do this:

it is neither elegant nor precise

can it be enough for 3 hours after the tv gets an ip address cut its connection (at now+3hours + enable firewall rule)?

https://forum.mikrotik.com/viewtopic.php?t=195160

Is it possible, maybe - is it going to be easy, no.
Streaming has no fixed bitrate, so you can't set quotas based on the transmitted bytes.
Nor do modern streaming devices observe strict radio silence while not in active use (even ignoring updates themselves), making it not that easy to determine between active streaming and just standby mode (and buffering makes it even harder, as what you can observe on the router side is quite choppy, full speed for a few seconds - mostly idle for the next 0.5-5 minutes).

While I'm not going to say that it's impossible, it's not going to be easy to get this working router-side.

1 Like

Yes, I am inclined to profile the traffic and see if I can implement that with a bit of python... it's exciting to see something maybe not served by default with the distribution!