Step detection for data set with 0 or more steps

Solution for Step detection for data set with 0 or more steps
is Given Below:

I am trying to figure out a way to detect steps in my data set without setting a threshold (at least avoiding setting an arbitrary threshold). I have a data set that is an example of real data that I want my code to work on and a made up data set.

Here is the real example data set with only one step

Here is an imaginary data set with multiple steps

Here a graph of just the data before manipulation

    d = clockDiff
    dary = np.array([*map(float, d)])

    dary -= np.average(dary)
    step = np.hstack((np.ones(len(dary)), -1*np.ones(len(dary))))
    dary_step = np.convolve(dary, step, mode="valid")
    step_indx =  np.where(abs(np.diff(np.diff(dary_step))) > 0)[0]  
    for step in step_indx:
        plt.plot((step, step), (dary_step[step]/10, 0), 'r')

It was taken from:Step detection in one-dimensional data

But I can’t seem to set it up for data with more than one step

Thus far I have tried:

scipy.signal.find_peaks(array) but it only finds the highest peak

np.argmax() from the original code but same problem with multiple peaks

the current method is looking to calculate the rate of change and finding where the second derivative is not zero but the real data graph is not a perfectly straight line so there are slope differences and I am trying to avoid setting an arbitary threshold to account for that because I want the program to work with a wide range of data sets