Hi I would like to create a binary sensor that combines a flooding sensor and a humidity sensor,
it should indicate that the shower is in use when the flooding is active and the humidity is above 65% at the same time, I tried this but it doesn’t work, where am I wrong?
You’re using the old format, which should still work but the new format is recommended.
With the legacy format you’re using, it should work provided that you’ve placed it below the section starting with binary_sensor: in your config.
If you convert to the new format, you’ll place it with the template: section.
What is the error that you are seeing?
Have you taken the jinja code from the value_template line and copied it into the template section of developer tools? What does it evaluate to?
the binary sensor works but is activated either when the humidity exceeds 65 or when the flooding sensor detects water, I would like the binary sensor to be activated when both situations occur simultaneously
With the code you showed, I don’t see how that is possible. However I see that you don’t have a unique_id specified. If you have been changing the sensor config and reloading the template entities yaml in the developer tools without a unique_id configured, HA doesn’t know that you changed that sensor and will instead think you configured a brand new sensor. So you may be looking at the state of binary_sensor.shower_occupany and see that it is not changing behavior after you modified its config, when unbeknownst to you, binary_sensor.shower_occupancy2 has been created and is working like you would expect.
I would recommend restarting HA and then reply whether the issue still persists. Restarting will clear all the duplicate sensors that were created by doing yaml reloads. Also, get in the habit of adding unique_id to your yaml-configured sensors. And while you’re at it, update to the new template format that I linked to in my earlier reply.