Exploring Node-Red and HA Integration for Smart Parental Controls

Hi everyone! I wanted to share my recent project where I integrated Node-Red with Home Assistant to create a smart parental control system for my kids’ internet access. It’s been a fascinating journey, and I’d love to hear your thoughts or suggestions!

The Goal:
I wanted to create a system where I could easily block or allow internet access for my kids based on predefined schedules. The idea was to have a single switch in HA that would trigger an action in Node-Red, which in turn would update the status back to HA. This way, everything stays centralized and user-friendly.

The Setup:
I’m using a UniFi UDM Pro, which supports traffic rules but doesn’t natively integrate with HA for this specific functionality. So, I decided to bridge the gap using Node-Red. Here’s what I did:

  1. Node-Red Configuration:

    • Created a switch node that can toggle traffic rules on the UDM Pro (blocking or unblocking internet access for specific devices).
    • Added a binary sensor node to report the status of the traffic rule back to HA.
  2. Home Assistant Integration:

    • Set up a template switch in HA that combines the switch and binary sensor into a single entity. This allows me to see the current status and control the switch directly from HA.

Here’s the configuration I used:
yaml
switch:

  • platform: template
    hannah_internet:
    friendly_name: “Hannah Internet”
    unique_id: “hannah_internet”
    value_template: “{{ is_state(‘binary_sensor.hannah_internet_rule’, ‘on’) }}”
    turn_on:
    service: switch.turn_off
    target:
    entity_id: switch.hannah_internet_rule
    turn_off:
    service: switch.turn_on
    target:
    entity_id: switch.hannah_internet_rule

The Results:
So far, the system works perfectly! I can easily toggle internet access for my kids from HA, and the status updates in real-time. It’s been a great way to enforce screen time rules without manually adjusting settings on the UDM Pro.

My Questions:
I’m wondering if there’s a more streamlined way to achieve this without using a template switch. Is there a way to have a single node in Node-Red handle both sending commands to HA and reporting status back? I’d love to hear if others have implemented similar solutions or have suggestions for improvement!

Additional Thoughts:
This project has really highlighted the power of integrating different platforms like Node-Red and HA. It’s amazing how customizable these systems are, even for complex use cases. I’m now thinking about expanding this setup to include more parental controls, like content filtering or application restrictions.

If anyone has experience with similar projects or has tips for optimizing this setup, I’d be thrilled to hear from you! Let’s keep the discussion going!

Cheers,
Jean-Yves