logo elektroda
logo elektroda
X
logo elektroda

Implementing Automatic Bathroom Lighting with Tuya Door and Motion Sensors

Szyszkownik Kilkujadek 1971 17
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20763135
    Szyszkownik Kilkujadek
    Level 37  
    I am looking for an idea how to implement automatic control of bathroom lighting in a TUYA system using a door opening sensor and a motion sensor.

    Principles:
    1. After opening the door, the light turns on.
    2. The door closes - the light is on.
    3.
    a) If within e.g. 15 seconds after closing the door no one moves, the light goes out.
    b) If within the above time someone moves, the light remains on without time limit.
    4. Opening the door causes a return to pt. 1.

    How does this work? In short: if the motion detector detects movement when the door is closed, it means that for sure until the door is opened someone is there.

    Does anyone have an idea how to implement this in TUYA? Is it possible to do this without HA?
  • ADVERTISEMENT
  • #2 20763475
    Szyszkownik Kilkujadek
    Level 37  
    @jurp maybe you can give a bit more detail?

    Added after 1 [minute]:

    @ElektrodaBot can you help? This is about the problem with #1 ?
  • #3 20763552
    sumara17
    Level 16  
    Hello
    This can theoretically be done using the Smart Life app. A scene needs to be created. Of course, the lamp would have to be switched with a Wi-Fi relay. Also, a curb switch with Wi-Fi communication and a motion sensor also with Wi-Fi communication would have to be added to the door. A scene should then be created in the app. In the scene, it is also possible to enter a timer.
    The switching on and off of the relay must be made dependent on the limit switch and the motion sensor by additionally entering a timer.
  • #4 20763621
    Szyszkownik Kilkujadek
    Level 37  
    I know what is needed and I already have it.
    I just don't know how to set up such a scene.
    @ElektrodaBot can you help?
  • #5 20764836
    12robert12
    Level 29  
    Tuya has very primitive scenes and capabilities...

    If you start a scene (meet the conditions) then the task executes,
    So your 1st condition already conflicts with the 2nd condition, it is not possible to stop 1 scene in Tuya
    Maybe just the motion sensor itself and the countdown to shutdown is enough,
  • #6 20764860
    Wojtek M
    Level 39  
    Why complicate simple things! One simple switch is enough.
  • ADVERTISEMENT
  • #7 20765650
    Szyszkownik Kilkujadek
    Level 37  
    12robert12 wrote:
    If you run the scene (meet the conditions) then the task executes,
    So your 1st condition already collides with the 2nd condition, it is impossible to stop the 1st scene in Tuya
    Not true. Nothing here conflicts. Just this part of the control I already have, because it is the easiest to do.
    12robert12 wrote:
    Maybe just the motion sensor alone and the countdown to switch off,

    Not enough, especially in rooms like the bathroom.
    Instead of a motion sensor you can give a microwave presence sensor, but this solution does not interest me.

    Wojtek M wrote:
    Why complicate simple things! One simple switch is enough.
    This is very interesting. Can you tell how one switch can implement such automation?
  • ADVERTISEMENT
  • #8 20765694
    12robert12
    Level 29  
    Szyszkownik Kilkujadek wrote:
    I know what is needed and I already have it. I just don't know how to set up such a scene
    @ElektrodaBot can you help?

    Szyszkownik Kilkujadek wrote:
    12robert12 wrote:
    If you run the scene (meet the conditions) then the job is done,
    So your 1st condition already collides with the 2nd condition, it is impossible to stop 1 scene in Tuya

    Not true. Nothing here conflicts. Accurate this part of the control I already have, because it is the easiest to do.



    What do you mean? show how you wrote this scene :) , upload screenshots
    because you contradict yourself in your posts

    Different modules have different capabilities, but the Tuya scenes themselves are too primitive to do such things as you want,


    Szyszkownik Kilkujadek wrote:


    Wojtek M wrote:
    Why complicate simple things! One simple switch is enough.
    This is very interesting. Can you tell how to implement such automation with one switch?


    It is probably about a simple traditional switch,
    but such a fashion today, to automate even the light in the toilet :) when the wifi is not available, you will sit in the dark ... :) :) about the delays in the execution of tasks does not write, once it worked in 1s and the other time after 30s
  • #9 20765696
    ElektrodaBot
    AI OpenAI ChatGPT4
    12robert12 wrote:
    help?



    It is probably about a simple traditional switch,
    but such a fashion nowadays to automate even the light in the toilet :) when the wifi runs out, you will sit in the dark ... :) :) about the delays in task completion, once it worked in 1s and the other time after 30s
    Welcome to the Elektroda.pl forum!

    I definitely understand your point of view. Automation can be great, but when technology fails, things can quickly become frustrating. With home automation systems such as light switches, reliability and predictability are key, and delays can be really annoying.

    It sounds like you've encountered an automation problem that is causing intermittent delays in system responses. To help you, I would like more information about your system. Can you tell me what devices and applications are involved in your automation process? Are you using an IoT (Internet of Things) system such as Google Home, Amazon Alexa, or perhaps a local Raspberry Pi or ESP8266/ESP32-based solution? Does the latency occur on every attempt, or only in certain circumstances?

    Some potential causes could include WiFi issues (which is ironic, given your comment about sitting in the dark when WiFi is down!), latency due to server overload (if you are using cloud services), or even issues with the device itself, such as overheating.

    I look forward to hearing more from you so we can spend more time diagnosing and solving your problem. Remember, I am here to help!

    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #10 20895138
    Ramotny
    Level 3  
    The system resembles a staircase timer where one excitation is the bell button at the entrance and the other is the PIR detector in the bathroom and that's it.
  • ADVERTISEMENT
  • #11 21164335
    Marek Sp
    Level 20  
    Maybe a processor that reads the switch and the motion sensor ?
  • #12 21165644
    Szyszkownik Kilkujadek
    Level 37  
    Marek Sp wrote:
    Maybe a processor that reads the switch and motion sensor ?
    .
    I do not want any additional DIY components.
    I would like to solve this using only official and readily available Tuya / SmartLife devices.
  • #13 21165862
    Marek Sp
    Level 20  
    Well your will only with this more trouble than good in my opinion.
  • #14 21180957
    Zbino
    Level 10  
    For the bathroom, the best solution is a light switch that counts the number of people entering and leaving the room. The Luno7 for example has such a function. In my opinion, this is the best solution because you don't have to move in the bathroom. You can sit on the throne without moving or be locked in the shower cubicle and the light will not go out.
  • #15 21182899
    Szyszkownik Kilkujadek
    Level 37  
    @Zbino thanks for suggesting an alternative solution. The method for counting people has been known to me for years and it has one major drawback. The device, even if it has directional recognition, is unfortunately not immune to the situation when two people pass each other in a doorway. It is also not immune to several other human behaviours, but never mind that.

    That's why I'm combining with a motion sensor and a door.
    If someone moves in the room after the door is closed, we can be sure that the light does not have to be switched off until the door is opened. Even if someone falls asleep in the bathroom, the light will not go out.
    There is a small chance that someone inside the room will not move for, say, 15 seconds after closing the door.
  • #16 21542288
    Erbit
    Level 38  
    Szyszkownik Kilkujadek wrote:
    If after closing the door someone moves in the room then we are sure that the light does not have to be switched off until the door is opened. Even if someone falls asleep in this bathroom, the light will not go out.

    Well yes ... while sitting motionless on the toilet it will occur to him that his eyeballs have burst from exertion ....

    And on a serious note. I've been going through this subject with myself because I had similar cravings as you. Tuya and other such components are not suitable for implementing this issue because something unpredictable will always happen that they cannot handle. A motion sensor (the kind from Tuya) also has its drawbacks.... I know it has (you may not yet know).

    The only solutions that will work (will be unreliable) are devices from industrial automation and these, unfortunately, are not cheap. The most sensible solution for me was a people counter (you have to think carefully about how high to place it) but in the end it only works for me as an on/off switch for the fan after a "prolonged stay in the room". Its malfunction is not as disruptive as one malfunctioning light.
  • #17 21542302
    Szyszkownik Kilkujadek
    Level 37  
    I know the disadvantages of the radio-based motion sensors here. Unfortunately I think I will let the subject go.
  • #18 21543719
    ferbulous
    Level 18  
    Better stick to mmwave sensors for bathroom presence

Topic summary

The discussion addresses implementing automatic bathroom lighting control within the Tuya ecosystem using a door sensor and a motion sensor. The desired logic is: light turns on upon door opening; remains on after door closes; if no motion is detected within a set delay (e.g., 15 seconds) after door closure, the light turns off; if motion is detected, the light stays on indefinitely until the door reopens. Tuya's native scene capabilities are considered too primitive to fully support this multi-condition logic, as scenes cannot be stopped or combined flexibly. Solutions proposed include using Wi-Fi relays controlled by Smart Life app scenes with timers, but these have limitations. Alternative suggestions involve using a single switch or a people-counting light switch like the Luno7, which tracks entries and exits but can be error-prone with multiple occupants. Microwave presence sensors and mmWave sensors are mentioned as more reliable but are outside the Tuya-only constraint. The consensus is that Tuya devices alone may not reliably implement the complex logic without additional hardware or more advanced automation platforms like Home Assistant. Radio-based motion sensors have inherent drawbacks such as latency and false triggers, making them less ideal for precise bathroom lighting control.
Summary generated by the language model.
ADVERTISEMENT