That type of question has been asked many times. In short: Inspect the event data. You might have good info already on the state change trigger data, otherwise trigger on the underlying event itself and check the data that you receive. The event listener is a great tool for this.
EDIT: I missed that you’re asking about HomeKit specifically, but the above should still be helpful. HomeKit emits events you can check.