Reading Contact Senor

Hi, I'm looking at creating an app that monitors a specific HomeKit contact sensor and when it opens have it trigger different notification depending on how many times it's been opened within 24 hours.

I've read conflicting information if that is possible within HomeKit due to security. Is it possible to read a HomeKit accessory like that? If so do you have any suggestions on how to?

Thank you!