Reduce Sensor Messaging Noise to MQTT
Fluttering
            if previousState == 0:
                if ticks_diff(ticks_ms(), clock) &gt;= 0:

This is called a soft debounce. It may or may not be adequate. My usual recommendation is to do hard debounce instead (or maybe in addition) via a first-order RC lowpass filter followed by hysteresis in a Schmitt trigger. If none of that makes sense to you, then that's a question for https://electronics.stackexchange.com/ .
Truthiness
I would sooner write
if state:

rather than
if state == 1:

snake_case
Per PEP8, previousState should be previous_state.