I apologize for my English as it’s not my native language.
I am trying to create a bathroom occupancy sensor, so I know when someone of us is having a shower.
Currently I was using a humidity sensor and a lights switch.
and changing occupancy state using the following template:
{{ states('sensor.humidity_158d00048684ab') | int > states.sensor.bathroom_humidity_stats.state | int and states.sensor.bathroom_humidity_stats.state != 'unknown' and states.group.attic_wc.state == 'on' }}
I am having two problems
First of all, if my wife have a shower in the morning the sensor won’t change state as she might not turn on the lights.
However the most important is that I had false sensor states, as we live on an island and the humidity changes very often nearly the whole day. So the above implementation was giving me that someone is having a shower even though nobody in the shower.
I tried to re-write the template using the following logic:
{% if states.sun.sun.state == 'below_horizon' %}
{{ states.sensor.bathroom_humidity_stats.state | int - states('sensor.humidity_158d00048684ab') | int > 10 and states.sensor.bathroom_humidity_stats.state != 'unknown' and states.group.attic_wc.state == 'on' }}
{% else %}
{{ states.sensor.bathroom_humidity_stats.state | int - states('sensor.humidity_158d00048684ab') | int > 10 and states.sensor.bathroom_humidity_stats.state != 'unknown' }}
{% endif %}
However the above is also not working
Here is the graph from sensor the time I was having a shower.
Hi, I use a trend binary sensor to determine when the shower is occupied and turn on a dehumidifer. The following is the code which you may be able to adapt for your application:
I use a standard Passive Infrared Detector (a Philips Hue motion sensor).
I have a 10 minute timeout and that is plenty in most cases.
What I recommend is
make the lights off as a slow transition like 30 seconds. When you sit on the throne with the mobile and time flies, you see the lights dim and can wave your hand to reset the 10 minute timer. There is nothing worse than suddenly be in the dark with no warning
try and position the sensor so it also covers the shower
Sure … it’s the minimum rate that the humidity must change by for the sensor to switch on in %/sec as per the docs.
Mine is set 0.01667 %/sec or 1%/min and you probably need to play around with this to get the best result. My sample duration is 300sec so I am only monitoring over the last 5 mins.
Thank you!
Has anyone working values for Xiaomi Sensor ?
Reading the FAQ it says:
> If the temperature humidity and atmospheric pressure varies a bit only, data will be reported once an hour. If the temperature variation exceeds 0.5℃, the humidity variation exceeds 6% and the atmospheric pressure is no less than 25Pa, data will be reported instantly.
So I’m wondering if someone has test already and got working values?
That’s actually the Aqara Zigbee sensor that I have however the way the humidity changes will probably be influenced by a number of factors like the temperature, size of the room, the type of shower (i.e. the force of the spray and its spray pattern etc.).
I just just set some default settings for the Trend binary sensor and tweaked these a little until it worked reliably for my bathroom which is quite small. I would say that the reliability of my setup is about 95% or better.
in my home, the bathroom door is closed when someone is using the bathroom and open when no one is using it. so it is very simple to determine whether the bathroom is occupied or not by using a door sensor.