Hi,
Is there a majority function or condition for automation?
For example, if I have 3 sensors, how do I check at least 2 out of 3 agree or match the condition?
(like value, above, below,…)
Thanks,
Regards,
Hi,
Is there a majority function or condition for automation?
For example, if I have 3 sensors, how do I check at least 2 out of 3 agree or match the condition?
(like value, above, below,…)
Thanks,
Regards,
I don’t believe there’s such a filter in standard Jinja2 nor in filters added in Home Assistant.
Create a template that computes the quantity of sensors whose value meets your criteria and then check if the resulting quantity is 2 or more.
Well, I’d like a standard and flexible function.
For more info: Majority function - Wikipedia
Given that it doesn’t exist you have the following options:
If I’m asking here, It’s because I don’t know how to do it
I explained how to do it in my first post (22 days ago).
If you need help composing the template, post the names of the sensors that will be involved and what their values can be.