📵 Child WiFi Blocker - Block your child's WiFi at bedtime via UniFi

Child WiFi Blocker :no_mobile_phones:

Version 1.3.0 | Automatically block your child's WiFi at bedtime and unblock it in the morning — via the UniFi Network integration!

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Create one automation per child. Each child can have multiple devices (phone, tablet, laptop) — all blocked and unblocked together at the same time. :locked:

Features

  • :no_mobile_phones: Automatic blocking — Blocks all configured devices at the set bedtime
  • :white_check_mark: Automatic unblocking — Unblocks devices again in the morning
  • :date: Day schedule — Choose which days the schedule is active (weekdays, weekend, or any combination)
  • :repeat_button: Self-correcting — On HA startup and automation reload, immediately enforces the correct state without waiting for a manual trigger
  • :house: Away blocking — Optionally block devices immediately when nobody is home, and unblock when someone returns (only during the allowed time window)
  • :pause_button: Quick toggle — Enable/disable the schedule without removing the automation

Requirements

  • Home Assistant 2024.6.0+
  • UniFi Network integration — Installed and configured in Home Assistant
  • UniFi client block switches — The integration creates a switch entity per tracked client device. When the switch is ON, the device is blocked from the network.

Optional

  • Person / device_tracker / group entity — For the "block when nobody is home" feature

How It Works

The blueprint uses the UniFi switch entities that the UniFi Network integration creates per tracked device. Flipping a switch ON blocks that device from the network; OFF allows it again.

Trigger moments

Trigger Action
:crescent_moon: Block time reached Block all devices — only on active days
:sun: Unblock time reached Unblock all devices — only on active days
:house: Presence → not_home Block immediately (if away-blocking is enabled)
:house: Presence → home Unblock (if enabled and within allowed time window)
:repeat_button: HA startup Evaluate current time and enforce correct state
:repeat_button: Automation reloaded Evaluate current time and enforce correct state

Midnight-crossing schedules

The blueprint correctly handles schedules that cross midnight (e.g. block at 22:00, unblock at 07:00):

If block_time > unblock_time  →  blocked when: now ≥ block_time  OR  now < unblock_time
If block_time < unblock_time  →  blocked when: now ≥ block_time AND now < unblock_time

Configuration

:baby: Child

Parameter Description Default
:bust_in_silhouette: Child's name Label only — does not affect automation logic Child
:mobile_phone: Devices to block UniFi switch entities for this child's devices (multi-select) —

:date: Schedule

Parameter Description Default
:crescent_moon: Block time Time at which WiFi is blocked 21:00:00
:sun: Unblock time Time at which WiFi is unblocked 07:00:00
:tear_off_calendar: Active days Days on which the schedule applies All days

:gear: Options (collapsed)

Parameter Description Default
:house: Also block when nobody is home Block immediately when presence goes to not_home Off
:busts_in_silhouette: Presence entity Person, device_tracker, group, or binary_sensor Optional
:white_check_mark: Enable this automation Quick on/off without removing the automation On

Setup — Finding UniFi block switches

  1. Go to Settings → Devices & Services → UniFi Network
  2. Open the integration and browse the entities
  3. Look for switch entities named after your child's devices
  4. Switch ON = device blocked, Switch OFF = device allowed

Usage Tips

  • Name each automation after the child — e.g. 📵 WiFi — Emma and 📵 WiFi — Liam so they are easy to identify in the automations list
  • Multiple devices per child — Select all of a child's devices in one automation; they all block and unblock together
  • Different schedules per day — Create two automations per child with different times, each covering different active days (e.g. weekdays vs weekend)

GitHub

Full documentation, troubleshooting, and version history: GitHub Repository

Changelog

  • 1.3.0 - Added self-correcting behaviour: startup and automation-reload triggers immediately enforce the correct block/unblock state; fixed midnight-crossing time window logic
  • 1.2.0 - Fixed "malformed" error on presence entity — added default: {} to make the field truly optional
  • 1.1.0 - Device selector now filtered to UniFi switches only — no more unrelated switches in the list
  • 1.0.0 - Initial release

I feel as though this would be much more easily achieved with the built-in settings in your router, thereby removing any reliance on HA.

To each their own though.

, you don't have to use it. I put it here for someone who can use it.

No hard feelings :grinning_face:

:+1:

A useful feature would be an option to invert the switch logic. In my setup, the switch is named "_blocked", but its behavior is inverted. Turning the switch off blocks the device in the UniFi Controller, while turning it on unblocks it. Having an option to invert the switch would make the integration much more intuitive.