Can I just add a further complication? (For fun?)
I have more than one RF Bridge* so my automations have to have different dictionaries which made it a lot harder to construct without errors. I’m not complaining I like the result but I leave it as an exercise for you if you’d like to consider a ‘super-deluxe’ method.
*I have three actually, which I now think is overkill but I was having some problems with dead spots causing some sensors to be unreliable no matter where I placed the Bridges. I still occasionally get sensors stuck in the ON position so I wonder if it is just cheap sensors not performing properly or something else going on^. I am however not sure that the third Bridge was necessary. But even so, because of the layout of my house I do need two.
^Comments welcome if this could be something I am overlooking in the processing. Thinking, as I write this, I am wondering if two sensors firing simultaneously could cause one to not be registered by HA in time?