Skip to content

Very unreliable connections to ATEM M2 Constellation #50

@astrodad

Description

@astrodad

Hi,

I've got a simple python script that switches the preview source but I'm finding that it often takes multiple attempts to connect to the ATEM on the same physical network (both devices on the same switch). Am I using this API incorrectly (apologize, I am a Python novice).

def connect_to_atem():
    """Establish connection to ATEM with retry logic"""
    switcher = PyATEMMax.ATEMMax()
    max_attempts = 5
    
    try:
        logger.info(f"Attempting to connect to ATEM at {ATEM_IP}")
        switcher.connect(ATEM_IP)
        
        for attempt in range(max_attempts):
            logger.info(f"Connection attempt {attempt + 1} of {max_attempts}")
            if switcher.waitForConnection(timeout=10.0):
                logger.info("Connected to ATEM")
                return switcher
            else:
                logger.warning(f"Attempt {attempt + 1} failed")
                if attempt < max_attempts - 1:
                    time.sleep(1)
                    switcher.disconnect()
                    time.sleep(0.5)
                    switcher.connect(ATEM_IP)
        
        return None
            
    except Exception as e:
        logger.error(f"Error connecting to ATEM: {e}")
        return None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions