@staticmethod
def parse_motion_state(val):
    """Convert motion state byte to seconds."""
    number = val & 63
    unit = (val & 192) >> 6
    if unit == 1:
        number *= 60
    elif unit == 2:
        number *= 60 * 60
    elif unit == 3 and number < 32:
        number *= 60 * 60 * 24
    elif unit == 3:
        number -= 32
        number *= 60 * 60 * 24 * 7
    return number
