I have a contact switch on the back of our dehumidifier. I use this contact switch as part of an automation to alert me when its full and then stop alerting when the water draw is opened where the contact switch.
What i would like to do is somehow capture how many times the contact switch is set to open. Is this possible at all?
You need to give me more info. Are you using any integrations, entities, devices or hubs, dongles, etc. It will deal with some scripting, so YAML will most likely be involved. Google HA and reading and counting a contact closure.
Assuming this switch is represented by a sensor in your HA setup…history_stats integration (see its docs)
Below counts for today…by fiddling with start/end you can create week/month/etc.