I’ve not had an alert yet, but the test works fine.
You could swap the details around quite a lot. I’m using device_id rather than $id because I want one ticket per device (so we’re not swamped with closed ones). Not sure what’s best to put in state yet - that seems to appear in the ticket title, and may affect whether the ticket is closed automatically on recovery. We’ll see about that one.