NO-TITLE-PAGE

Bathroom Climate control

This example demonstrates how to implement an IoT device for controlling a bathroom or cellar fan with the help of the HomeDing library.

Situation

In many residential buildings, there are rooms where water usage leads to increased air humidity. Also after using the toilet you may want some fresh air in the room.

High humidity levels can cause various problems, including mold growth, unpleasant odors, and damage to walls or furniture. Extended exposure to high humidity can also adversely affect health and comfort.

To reduce humidity, you can either open a window (if available) or use a fan to exhaust the moist air. This example focuses on controlling such a fan using an IoT device with built-in rules that apply to this situation.

Rules for the fan

In conventional installations, bathroom fans are typically controlled by the light switch, continuing to run for a preset time after the light is turned off. This approach can be inefficient when using the room without generating excess humidity.

Some more modern devices also have sensors for humidity and adjust their activity when humidity reaches a threshold.

This IoT device offers a smarter solution by combining two sensors and a pushbutton and can implement some more smart rules that can be adjusted using the remote web interface. This example uses this approach and provides the following features:

You can change all the threshold and time values in the configuration of the device and adapt or extend the configuration to your special needs.

There are some rules implemented that cover the above ideas that can be switched on/off using the web user interface. They are running independently and the fan will be activated whenever one of the triggers wants it.

Analog in with LDR -> Reference Element onHigh -> Start Light Timer Element Analog in with LDR -> Reference Element onLow -> Stop Light Timer Element

When the light is detected only for a short time this timer will not reach the end before stopped and onEnd Event will not be triggered.

Light Timer onEnd -> Start Fan Timer Element

The Light Trigger part of the configuration

{
  "digitalout": {
    "relay": {
      "title": "relay",
      "pin": "3"
    },
    "led": {
      "title": "led",
      "pin": "8",
      "invert": "1"
    }
  },
  "timer": {
    "led": {
      "mode": "timer",
      "restart": "1",
      "waittime": "8s",
      "pulsetime": "20s",
      "cycletime": "80s",
      "onHigh": "device/0?log=onHigh",
      "onLow": "device/0?log=onLow",
      "onValue": "digitalout/relay?value=$v",
      "onEnd": "device/0?log=onEnd",
      "title": "timer/led"
    }
  },
  "bh1750": {
    "lux": {
      "title": "light",
      "readtime": "2s"
    }
  }
}