As far as your main problem goes, I don’t notice anything wrong. Since you didn’t include the error, it’s hard to be of too much help.
However, a bigger problem is that I don’t think this is the correct way to do what you want, as it is going to wait for the state to change, and, since it is your triggering entity, I’m assuming the state already has.
If you want to wait 30 seconds before performing any action, just put the for on the trigger.
If you want to perform some actions right when the state changes and then more if the state stays changed for 30 seconds, you’ll either need two different automations, one with the for on the trigger and one without or you’ll need a sequence like the following:
Oh, based on what you originally posted, I assumed that was the behavior you wanted.
If you just want a delay of thirty seconds before proceeding, then just use delay. If that still isn’t right, then post the entire automation like Taras requested.