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:
- MH-ET Live ESP32: http://geni.us/4OZdAj
- or Wemos D32 Mini: https://geni.us/9aXV
- Good Micro-USB cable: https://geni.us/4Yqui9t
- Good Phone charger that can deliver 5v 2A (10w) on a single port: https://geni.us/TiSqB
- DC-DC converter used: http://geni.us/slWB9
- Xiaomi Mijia Temperature and Humidity Sensor: https://geni.us/Tr2RpJH
- 1x, 2x, 4x or 8x Relay board with Optocoupler and 3.3v trigger: https://geni.us/dRYwMJK
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 } ]