Automation of bathroom light in a smart home

Today I was reconfiguring the light in the bathroom again, I noticed that the light often stays on for various reasons when there are no people there, this is because I did not make it work on a timer, but I process events using sensors, these are door opening sensors and motion sensors, I have done So when the door opens, the opening sensor detects the signal and transmits it to the smart home system, and at that moment, if the light was turned off, it turns on, then when the door closes, no action occurs, and when the door is reopened, the signal is transmitted to the system again and it is checked if the light was on, then it turns off.

My goal was to make sure that when a person opens the door, there is no desire to turn on the light manually, if this happens very quickly, then after a while, of course, the desire to press the manual button disappears, since there is usually no point, or even worse, when the light turns on when the door is opened, but the person pushes by inertia press the button and it turns off again, which becomes inconvenient on the contrary, and when exiting, also so that there is no desire to press the button, I made it so that when the door opens, the person has not yet had time to get out and press at that moment the light has already turned off and then, too, after a while, the desire to manually press disappears.

Of course, this is very convenient, and for example, if you do this using a motion sensor, it also worked for me initially, then the light turns on with a significant delay, because a person should appear in the sensor's field of action, and even if he was directed at the door, then in this case there is still a delay in triggering the sensor itself, for transmission in the smart home system, for processing in the smart home system, and then only switching on occurs, which in principle gives a long delay and becomes inconvenient, because you actually enter a dark room, and when you go out, the motion sensor, of course, cannot record the moment when the door opens and a person exits, so it usually takes a long enough delay, it can be a whole minute, and only after that it can be determined that the movement in the room, say in the bathroom, has ended and you can turn off the light. Of course, in this case, people turn off the light themselves with a button, which is much more convenient and familiar.

Therefore, I use the motion sensor only for the purpose that if for some reason the light went off in the room, for example, the script worked incorrectly, and I need to turn on the light anyway, it is checked that if movement is detected, then the light turns on again, but it is done so that I detect only movement in complete darkness. if movement does not occur in the dark, then this signal is not processed, because the delay in movement itself occurs, and if a person leaves, it may turn out that the door opening sensor has transmitted information and the light has turned off, and immediately the motion sensor transmitted the information and the light turns on again.

Initially, I used a proprietary sensor from Xiaomi, a motion sensor, there is also the same motion sensor from Aqara, they have a built-in light sensor there, but I did not buy one, I used a regular one from Xiaomi, and there is some problem with this sensor, firstly, it has a waiting time to turn off, and this it's not very convenient, and of course you need to somehow understand whether the light is on or not in order to quickly send information, and for example, it's done so that if a repeat movement occurs, it can only send updated data after 20 or 30 seconds.

Therefore, I had to make a homemade sensor, which, plus, detects not only movement and illumination, but also the temperature and humidity in this room, and on this sensor I made it so that it detects the presence of movement every two seconds, if movement and at the same time appeared on the light sensor in the dark, then A delay of 2 seconds is made, this just allows you to separate the operation of the opening sensor and the motion sensor, and then sends a signal to the smart home system, and thus, if suddenly the light in the bathroom room, for example, turned off or was turned off, then when moving, it will simply turn on again.

At first, I made it so that after a while, if the door was closed and the light was on, the light in the bathroom turned off, I made a delay of 30 minutes, it turned out to be very short, and when someone is in the bathroom, for example, washing for a long time, then of course the light turned off, because the movement of the person was not recorded and it was very difficult to somehowthen there is another way to determine whether there is a person in the bathroom or not. I made a delay of 1 hour, which sometimes may not be enough, but it's still better than keeping the light on for a long time, and I made another rule that if the fan is running, and it's running if the humidity is above 65 percent, then this rule won't work for me. but if the humidity is lower and the fan is not working, then the light will turn off.

Of course, you can just do it by changing the humidity, but humidity can be high for a very long time, for example, if the bathroom door is not open, then I did an experiment to see how long it takes the fan to lower the humidity in the bathroom, then it is of course very long, that is, it is completely ineffective, and the most effective is simply open the door and then the humidity will rise in the first and other rooms, which is often very useful, because the humidity in the rooms is quite low and, accordingly, the humidity in the bathroom drops very quickly in just a few minutes to quite acceptable levels.

Well, in general, the sensors themselves can, of course, be used in completely different scenarios, in different combinations, and for example, I have a light sensor that also shows whether the light is on or not, for example, and initially I also evaluated it when I used other ways to control the light in the bathroom, it was my relays without feedback, and then I understood that the light turned on or not turned on, respectively, but now I use switches, this three-button switch works on Zigbee, and in it I made it so simple that one switch works in order to turn on the light in the bathroom, the second switch turns on the light in the toilet and the third switch is responsible for controlling the fan in the bathroom, and you can just manually turn the fans on and off and also just send the command to this switch to turn on the fan or turn on the light.

As an option, for example, to make either a presence sensor, I have a Tuya presence sensor, and a presence sensor from Aqara, these are of course interesting solutions, they really allow you to detect the presence of people, and even they can detect people not only in line of sight, but also behind a glass partition, for example, but they certainly have a disadvantage, in-firstly, this is a fairly wide range and they can also be detected behind the wall, and therefore they need to be very precisely tuned and very difficult to process, and, in principle, as a temporary solution, you can make some kind of additional wireless button in the bathroom so that you can always press this button and turn on the light, or there is an idea to use a vibration sensor, which can also be used so that if a person is washing, for example, there is always some kind of vibration in the bathroom and, for example, when at the same time, you can also turn on the light, or you can also monitor water consumption, and if it is significant, then in principle you can understand that someone is washing in the bathroom and thus assess whether to turn off the light in the bathroom or not.

Automation in a smart home should be useful and create additional comfort, but sometimes everything goes wrong… The reasons for this, and how to configure everything, see on my channel.

You may also watch

Article By Alex

If you have any ideas on how to improve automation, make it more reliable, fast and useful, then you can leave a comment below. I will try to implement the proposals and tell you in the following videos.