Anytime Help Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support
  • Guest
  • Log In
  • AKG
    Microphones Wireless Integrated Systems Automatic Mixers Headphones Discontinued Products (AKG) Video Manual Series (AKG) General AKG Inquiries Certifications (AKG)
  • AMX
    Networked A/V Distribution (AVoIP) Traditional A/V Distribution Video Signal Processing Architectural Connectivity User Interfaces Control Processing Power (AMX) Programming (AMX) Software (AMX) Discontinued Products (AMX) Video Manual Series (AMX) General AMX Inquiries Certifications (AMX)
  • BSS
    Soundweb™ Omni Soundweb™ London Soundweb™ Contrio™ Software (BSS) Discontinued Products (BSS) Video Manual Series (BSS) General BSS Inquiries Certifications (BSS)
  • Crown
    CDi DriveCore Series CDi Series Commercial Series ComTech Series DCi DriveCore Series I-Tech HD Series XLC series XLi Series XLS DriveCore 2 Series XTi 2 Series Software (Crown) Discontinued Products (Crown) Video Manual Series (Crown) General Crown Inquiries Certifications (Crown)
  • dbx
    CX Series 500 Series DriveRack Personal Monitor Control ZonePRO Zone Controllers FeedBack Suppression Microphone Preamps Dynamics Processors Crossovers Equalizers Software (dbx) Discontinued Products (dbx) General dbx Inquiries Certifications (dbx)
  • Flux::
    Immersive Processing Analysis Subscriptions General FLUX: Inquiries
  • JBL
    Cinema Sound Installed Live Portable Tour Sound Recording & Broadcast Software (JBL) Discontinued Products (JBL) Video Manual Series (JBL) General JBL Inquiries Certifications (JBL)
  • Lexicon
    Plugins Effects Processors Cinema Discontinued Products (Lexicon) Video Manual Series (Lexicon) General Lexicon Inquiries Certifications (Lexicon)
  • Martin
    Atomic ELP ERA Exterior MAC P3 VC VDO Tools Discontinued Products (Martin) General Martin Inquiries Certifications (Martin)
  • Soundcraft
    Digital Analog Connected Analog Only Discontinued Products (Soundcraft) Video Manual Series (Soundcraft) General Soundcraft Inquiries Certifications (Soundcraft)
  • General HARMAN Inquiries
    Dante
+ More
  • Home
  • BSS
  • Video Manual Series (BSS)

Python - Relay Control | MUSE

Video Manual Series


Written by Felipe Guerrero

Updated at August 26th, 2026

In this video, you’ll learn how to control relay ports on an AMX MUSE controller using Python. We’ll walk through toggling relay states with button events and using simple Boolean logic to manage hardware behavior. You’ll also see how to monitor relay state changes with watch events and generate log feedback for debugging. By the end, you’ll have a solid foundation for integrating real-world hardware control into your automation workflows.

What You’ll Learn:
• Controlling MUSE relay ports with Python
• Toggling relay states using button events
• Applying Boolean logic to manage hardware behavior
• Monitoring relay changes with watch events
• Logging feedback for debugging and visibility
• Integrating physical control elements into automation systems

Transcript
Hello, and welcome to this video on controlling MUSE relay ports using Python code.  For this example, we are going to start with some basic code already written.  You can see here that we have a couple of devices already defined.  We have dvIdevice for our MUSE controller’s idevice and dvTP for a touch panel.  In addition, we have a very basic button event created for button number 1 on port 1.
We want to write a simple piece of code that turns on the relay when the button is pressed, and when the button is released, turn off that relay.  The first thing we need to look at is how the relay is controlled.  To do this, let’s look at the descriptor file for idevice.  Right-click on idevice in the Devices list and select Descriptor, now select Text for the file type at the top of the window.
Now, search the text document for the word relay.  You can see here that there are 4 relay ports on this controller, and each relay port has a single Parameter called state.  It’s a Boolean parameter that is read/write indicated by the rw.  This means to control the state of the relay we need to change the value to the state parameter.  In addition, if we wanted to trigger something based on that state, we could use a watch event to monitor the state parameter.

 
Let’s return to our script and start writing some code.  The first thing we are going to do is create a device for our relay port.  To do this, let’s assign dvRelay to be equal to dvIdevice.relay[0].
*** Enter Code ***
dvRelay = dvIdevice.relay[0]
*****************
In our button event, let’s create the two conditionals necessary to be triggered when the button is pressed and released.  For this we will create an if statement that says if(event.value == True): this will be the push trigger, and below it we will put the else: statement for the release trigger.
*** Enter Code ***
If(event.value == True):
Else:
******************
To control our relay ports, we need to set the ‘state’ attribute parameter to true for on and false for off.  Below our if statement, type in dvRelay.state = True, and below the else statement type in dvRelay.state = False.
*** Enter Code ***
dvRelay.state = True
dvRelay.state = False
******************
Save your code and upload it to the MUSE controller and be sure and attach to[RJ1.1][MW1.2] the code when it is running.  When you press and release the touch panel button, you should see the LED for relay 1 blink on and off as well as hear the clicking sound of the relay being actuated.  Since our code can’t see an LED or hear the clicking, how can we know if the relay port is on or off?
To monitor the state of the relay port, we can create a watch for the state parameter.  Remember, watches require that a callback function be passed to the watch.  First let’s create the watch.  The watch will be dvRelay.state.watch, and we will pass it a function named relayState.
*** Enter Code ***
dvRelay.state.watch(relayState)
*****************
The first thing we’ll do is create our call back function and look at the dictionary printout to see what information we receive when the relay turns on and off.  Let’s create an info log by typing in context.log.info(f”Relay dictionary: {event.__dict__}”)
*** Enter Code ***
Def relayState(event):
Context.log.info(f”Relay dictionary: {event.__dict__}”)
Load code and show printout of dictionary.
*****************
The dictionary provides us the id of the parameter that triggers the event, “state”, and more importantly the current “value” of that state.  We can use value to create a conditional to print out whether the relay is on or off.[RJ2.1][MW2.2]
We can actually use the same conditional we created in our button event for value.  
*** Enter Code ***
If(event.value == True):
Else:
****************
Lastly, let’s create a couple of info logs informing us of the state of the relay.  For each conditional type in context.log.info(“Relay 1 is ON/OFF”).
*** Enter Code ***
Context.log.info(“Relay 1 is ON”)
Context.log.info(“Relay 1 is OFF”)
*****************
Save and upload your code to the controller.  Now when you press the touch panel button, you should see the messages that your relay is on or off.

Related Videos

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Exploring AMX MUSE | E6: How AMX MUSE Simplifies Integration with Enterprise Services

Related Articles

  • Exploring AMX MUSE | E6: How AMX MUSE Simplifies Integration with Enterprise Services
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand