Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very unreliable connections to ATEM M2 Constellation #50

Open
astrodad opened this issue Oct 28, 2024 · 0 comments
Open

Very unreliable connections to ATEM M2 Constellation #50

astrodad opened this issue Oct 28, 2024 · 0 comments

Comments

@astrodad
Copy link

astrodad commented Oct 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant