Disable wifi for specific users

I have two kids, and they would both much rather screw around on the internet than do things like chores, clean up after themselves, go to bed, etc. Well, the solution to that problem is to take it away, and only give it back when I’m good and ready. So I set up some automation to do it for me.

For a little background, I’m using pihole for my DNS and adblocking, and this is the core to this functionality. In pihole, you can setup groups and blocklists through the UI, which really just interacts with a sqlite database behind the scenes.

First, I setup a group for each offender, and added all their devices to the group. Adding this group to the blocklist will drop all their packets. Nice.

Next step is to do this directly to the database via ssh. Each of these can be done with a one liner, once you do a little digging in the DB and get the appropriate domainlist_id and group_id:

sudo sqlite3 /etc/pihole/gravity.db 'INSERT into domainlist_by_group (domainlist_id,group_id) values (25,4);'
sudo sqlite3 /etc/pihole/gravity.db 'DELETE FROM domainlist_by_group WHERE group_id=4;'

I also found that the lists needed to be reloaded for either change to take effect:

pihole restartdns reload-lists

So now we can disable specific groups/devices, but i’m not going to login and run this command each time I need to, so thats where HASS comes in.

First, I setup some helper toggles to represent the state of the wifi for each user. In node-red, I watch the state of that toggle, and if it flips off, run an ssh node agains the pihole instance to run the above INSERT and reload-list. If it toggles on, do the DELETE.

Easy. But not easy enough for me.

I have an iPhone, so I setup a shortcut to toggle off or on for the specific kid, and now all i have to do is tell Siri to “disable daughters internet” and my job is done, and their jobs GET done.

Very nice.

Also, since we’re in node-red, its easy to setup a trigger to shut off the internet at a specific time on school nights, so we can enforce bedtime.

Next steps are to add a dashboard specific for each kid with a card containing toggles for each chore. When all toggles are flipped, the wife and I will get an actionable notification that we can use to enable the internet right from there.

In my profession we call them “the accused” until the jury finds them guilty :slight_smile:

1 Like

We take their extensive records into consideration. :slight_smile:

1 Like