I’m actually having more issues than I thought. Here is my configuration code. Once I get this figured out, I’ll try the automation again. I’m very new to home assistant and have only done basic stuff so far. Very likely that it’s a simple mistake. Thanks for the help.
Agree that posting actual code using 3 `s is far better than a screenshot.
I do see that your binary sensor indentation is off - first line should not be same ‘depth’ as the 2nd and 3rd. Also depends on how / where you’re configuring these - w/in configuration.yaml or if you’re using (as I am) separate files referenced via includes within configuration.yaml:
Certainly realize some of this configuration can be foreign when first starting - but worth learning the building blocks - will help tremendously as you become more addicted
i have some trouble with the average value over the past 24h, my sensor isn’t reporting every 1 or 2 minutes it’s a zigbee device, so my avg value rises rapedly when there is moister. such vast that the treshold value never occured.
How could i solve this, i would like to test it to a value from let’s say 1 or 2 hours ago.
The attributes expose the underlying values for easy view when drilling down on the Net sensor and easy access for automations in the trigger from_state and to_state properties.
Controlling fan based on bathroom humidity (regardless you use smart fan, smart relay or something like Switchbot Bot) is a good idea. However, I’d set the target humidity in a different way. I see no reason to set it by history. There are several objectives:
Healthy humidity in space where you usually are (usually recommended: 40% – 60%; some recommend just 55% for summer).
Reducing mold risk – the ranges can be somewhat higher, but if you have something like 23°C or more, the threshold is something like 65%. When your sensor is not directly above bath, maybe you will want to lower the threshold, even to something like 60 % or less. (I’ve written something about desired humidity at How do you care about humidity - #2 by v6ak .)
So, when you have something like 30% humidity on average, it doesn’t make much sense to achieve this low value after bathing.
Thanks for posting this, managed to get it created in HA but I’m not sure if there is an issue as it seems to be showing as always on, is that normal behaviour?
I am sure you understand that you are not supposed to just copy and paste the codes, but will have to tweak the parameters based on how those readings are reported, how you calculate the average, and even where you are.
Tips to troubleshoot: double check your config, plot 3 things together: your humidity and average humidity and your binary sensor, and if you are using any automation, trace your automation.
I’m trying to track the issue and have tried playing about with the sample size both number of hours
and sample size but whatever I do it seems to be working properly in that respect,. in that comparing the actual humidity sensor and the average linear everything seems to be working correctly its smoothing out the graph and I’m seeing the spike definitively earlier on the actual sensor vs my statistic sensor.
So my understanding is I should be getting the binary motion sensor only triggering as on when the actual rises over 5% more than the average linear? I copied your code exactly for the binary sensor as based on the figures I get 5% seems the right point to trigger based on either 1 or 3 hour sampling I tried.
But the issue is no matter what the difference between the 2 weather its above or below 5% the binary always shows as detecting motion, and without the state change in the binary I cant actually use the sensor. My understanding is if anything the binary should be showing if anything as not detecting motion but guess I must be missing something pretty obvious?
This is what I currently have in the configuration.yaml but also tried different hours and sampling size with the same result
sensor:
- platform: statistics
name: En Suite Humidity Average Linear 3h
entity_id: sensor.en_suite_th_humidity
state_characteristic: average_linear
max_age:
hours: 3
sampling_size: 180
template:
- binary_sensor:
- name: "Showering en suite"
unique_id: showering_ensuite
device_class: motion
state: >
{{( states('sensor.en_suite_th_humidity') | float(0) ) >
( states('sensor.en_suite_humidity_average_liner_3h') | float(0) + 5 ) }}
Was such a dumb issue got someone else to look at it and they spotted I had a typo in the statistic sensor when I typed it into the binary spent hours looking at it myself and never noticed. Thanks for your help though only got to this stage reading your posts
Hello, I am also trying to start the bath saddle fan when the humidity exceeds the desired %. Can you show me the complete code so that I can create my automation with my values?