Skip to content

Commit a01918c

Browse files
committed
bathcontrol example
1 parent 86eb76a commit a01918c

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

examples/bathcontrol.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Bathroom Climate control
2+
3+
--
4+
5+
This example demonstrates how to implement an IoT device for controlling a bathroom or cellar fan with the help of the HomeDing library.
6+
7+
## Situation
8+
9+
In many residential buildings, there are rooms where water usage leads to increased air humidity.
10+
Also after using the toilet you may want some fresh air in the room.
11+
12+
High humidity levels can cause various problems, including mold growth, unpleasant odors, and damage to walls or
13+
furniture. Extended exposure to high humidity can also adversely affect health and comfort.
14+
15+
To reduce humidity, you can either open a window (if available) or use a fan to exhaust the moist air. This example
16+
focuses on controlling such a fan using an IoT device with built-in rules that apply to this situation.
17+
18+
## Rules for the fan
19+
20+
In conventional installations, bathroom fans are typically controlled by the light switch, continuing to run for a
21+
preset time after the light is turned off. This approach can be inefficient when using the room without generating
22+
excess humidity.
23+
24+
Some more modern devices also have sensors for humidity and adjust their activity when humidity reaches a threshold.
25+
26+
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
27+
using the remote web interface. This example uses this approach and provides the following features:
28+
29+
* A light sensor is capturing the light situation. The light switch is not used.
30+
Instead a simple light sensor is used to trigger fan activity. No need to capture a signal from a high voltage line.
31+
* A Humidity sensor is capturing the light situation.
32+
*
33+
* The fan doesn't start when the light is switched on for a few seconds only.
34+
* The fan will be started for a few minutes after the light has been switched off.
35+
* When the humidity sensor signals a humidity higher than 80 % the fan will start.
36+
* When the humidity has fallen under 60 % the fan will be switched off.
37+
* When pressing the push button the fan will be activated for 60 seconds per push.
38+
* When long pressing the push button the device will go into off mode.
39+
* When long pressing the push button again the device will start again in normal mode.
40+
41+
You can change all the threshold and time values in the configuration of the device
42+
and adapt or extend the configuration to your special needs.
43+
44+
There are some rules implemented that cover the above ideas that can be switched on/off using the web user interface.
45+
They are running independently and the fan will be activated whenever one of the triggers wants it.
46+
47+
Analog in with LDR -> [Reference Element] onHigh -> Start Light [Timer Element]
48+
Analog in with LDR -> [Reference Element] onLow -> Stop Light [Timer Element]
49+
50+
When the light is detected only for a short time this timer will not reach the end before stopped and onEnd Event
51+
will not be triggered.
52+
53+
Light Timer onEnd -> Start Fan [Timer Element]
54+
55+
56+
The Light Trigger part of the configuration
57+
58+
59+
[Reference Element]: /elements/reference.md
60+
[Timer Element]: /elements/timer.md
61+
62+
63+
``` json
64+
{
65+
"digitalout": {
66+
"relay": {
67+
"title": "relay",
68+
"pin": "3"
69+
},
70+
"led": {
71+
"title": "led",
72+
"pin": "8",
73+
"invert": "1"
74+
}
75+
},
76+
"timer": {
77+
"led": {
78+
"mode": "timer",
79+
"restart": "1",
80+
"waittime": "8s",
81+
"pulsetime": "20s",
82+
"cycletime": "80s",
83+
"onHigh": "device/0?log=onHigh",
84+
"onLow": "device/0?log=onLow",
85+
"onValue": "digitalout/relay?value=$v",
86+
"onEnd": "device/0?log=onEnd",
87+
"title": "timer/led"
88+
}
89+
},
90+
"bh1750": {
91+
"lux": {
92+
"title": "light",
93+
"readtime": "2s"
94+
}
95+
}
96+
}
97+
```
98+

0 commit comments

Comments
 (0)