Home Assistant: Automated Bathroom Ventilation

Even since we’ve lived in our new house I have wanted to create a sort of “automatic” bathroom ventilation. Our central ventilation box has a feature that can be used for that but we needed hooked it up. But, combining two of my recent Home Assistant videos it’s actually quite easy now, let’s build it and throw some Node-Red into the mix too! 😀

Video

The whole scenario and technical stuff, including Node-Red is again best explained in a video, have a look. I’ll have some accompanying text below. 🙂

Videos mentioned

In the above video I mentioned two video for more details, please find their blog posts (with videos) here:

As also mentioned in the video, make sure to check out Frenck’s YouTube channel: https://www.youtube.com/user/Frenck

Shopping links

This project involves several hardware items, most of those are:

Node-Red

The easiest way to configure Node-Red is really by following the video instructions.

As mentioned in the video, installing and linking Node-Red is super simple, if you are running hass.io. For that you just need to add the following hass.io repository of “frenck”: https://github.com/hassio-addons/repository

If you are not running hass.io, you will need to install Node-Red standalone (no instructions for that) and then link it to Home Assistant using a “Long-lived access token“.

Node-Red flow import

If you just want to import the flow instead of creating it yourself you can do so by importing the code below. You will still need to have the right palletes installed and add your own Home Assistant configuration.

[
    {
        "id": "48a00a38.3c1374",
        "type": "tab",
        "label": "Bathroom video",
        "disabled": false,
        "info": ""
    },
    {
        "id": "98d93d42.4772e",
        "type": "server-state-changed",
        "z": "48a00a38.3c1374",
        "name": "",
        "server": "1f59e9af.65e7d6",
        "entityidfilter": "sensor.sensor_4_humidity",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "x": 350,
        "y": 260,
        "wires": [
            [
                "769eaa61.3e684c"
            ]
        ]
    },
    {
        "id": "769eaa61.3e684c",
        "type": "switch",
        "z": "48a00a38.3c1374",
        "name": "Turn On/Off?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "65",
                "vt": "num"
            },
            {
                "t": "lt",
                "v": "55",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 650,
        "y": 260,
        "wires": [
            [
                "a09c229.16c55e"
            ],
            [
                "6aa68547.add554"
            ]
        ]
    },
    {
        "id": "a09c229.16c55e",
        "type": "api-call-service",
        "z": "48a00a38.3c1374",
        "name": "",
        "server": "1f59e9af.65e7d6",
        "service_domain": "switch",
        "service": "turn_on",
        "data": "{\"entity_id\":\"switch.relay_aircycle_1\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "x": 910,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "6aa68547.add554",
        "type": "api-call-service",
        "z": "48a00a38.3c1374",
        "name": "",
        "server": "1f59e9af.65e7d6",
        "service_domain": "switch",
        "service": "turn_off",
        "data": "{\"entity_id\":\"switch.relay_aircycle_1\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "x": 910,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "1f59e9af.65e7d6",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": false,
        "hassio": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true
    }
]

 

4 thoughts on “Home Assistant: Automated Bathroom Ventilation”

  1. I like what you have done here.

    I’ve build something similair in my bathroom, only difference is that I’ve build the humidity sensor myself, but used an ClikOnClickOff relay, connected via my Homey to turn the fan on and off.

    Had an old Raspberry Pi laying around somewhere, so I’ve just installed HASS IO and I’m looking into the possibilities.

    Do you happen to have any experience with MH-Z19 CO2 sensors? I’ve been fiddling around with these for a while, but I always seem to end up breaking them.

    Keep up the good work!

Leave a Reply

Your email address will not be published. Required fields are marked *