Thank you, VDRainer. You have helped me resolve the problem.
I have been testing my conditions by impatiently triggering the automation myself. I now see that when I do that condions are ignored and the action is always performed. I thought that clicking a “trigger” link would cause the whole automation to be performed (that the trigger would be bypassed, but that conditions would be considered). Not so, it appears. If I allow the automation to run by itself it runs (or doesn’t) properly.
To me there seems to be a problem with terminology. “Trigger” seems to mean “trigger the action” not “trigger the automation”.