Hide entities (sensors, switches) dynamically?

I recently saw a post here on the forum of someone who nested a group with settings into another group, which may just work for you. I’ll see if I can find it again…

EDIT: I found it! Have a look here. It’s not perfect but I’d say it comes pretty darn close.