Emotiva xmc-1

Can anyone please let me know , how to get this emotiva xmc-1 done.

1 Like

Were you ever able to get the XMC-1 into HA?

If someone knows how to implement this network API in HA, that would be golden. Much better than using a Harmony of course.

Hello,
This is a piece of code, far from perfect but it works well, that I wrote for another home automation system. You may freely grab anything you may find usefull from it. It supports sending commands to XMC-1 and itach box. As far as itach is concerned, IR codes are of course specific to my gear. Some are learned, some are taken from itach database.

#!/usr/bin/env python
# -*- coding: latin-1 -*-

import socket
import sys
import string
from time import sleep
import errno
import fcntl, os
from urllib.request import urlopen
import urllib.parse

#import domoticz

# Preamp codes
#iTACH IP2IR module
#PrƩampli YBA
CD='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,32,32,64,64,32,32,64,64,32,3225\r'
TUNER='sendir,1:2,1,36023,1,1,32,32,64,32,32,32,32,64,32,32,32,32,64,32,32,64,64,64,32,32,32,3600\r'
PHONO='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,32,32,64,64,64,64,32,32,32,3235\r'
VIDEO='sendir,1:2,1,36023,1,1,32,32,64,32,32,32,32,64,32,32,32,32,32,32,32,32,64,64,64,64,32,3235\r'
AUX='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,64,64,32,32,32,32,64,64,32,3235\r'
TAPE='sendir,1:2,1,36023,1,1,32,32,64,32,32,32,32,64,32,32,32,32,64,64,32,32,32,32,64,32,32,3267\r'
PHASEIN='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,64,32,32,32,32,32,32,3267\r'
PHASEOUT='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,64,64,32,32,64,3267\r'
MUTE='sendir,1:2,1,36023,1,1,32,32,32,32,64,32,32,64,32,32,32,32,64,32,32,64,32,32,64,64,32,3235\r'
VOLUME_PLUS='sendir,1:2,1,36023,1,1,32,32,64,32,32,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,3235\r'
VOLUME_MOINS='sendir,1:2,2,36023,1,1,32,32,64,32,32,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,32,3267\r'

#Lecteur BR4K Samsung
BACKWARD='sendir,1:1,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,57,18,18,18,57,18,57,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,57,18,57,18,57,18,57,18,2191\r'
CURSORDOWN='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,18,18,18,18,56,18,56,18,18,18,18,18,18,18,18,18,56,18,56,18,18,18,18,18,56,18,56,18,56,18,2185\r'
CURSORENTER='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,18,18,18,18,18,18,56,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,2185\r'
CURSORLEFT='sendir,1:3,1,38000,1,1,170,170,19,19,19,18,20,18,19,19,19,19,19,56,19,19,19,18,20,18,19,19,19,19,19,18,20,18,19,19,19,19,19,18,20,169,19,57,19,56,19,56,20,18,19,57,19,56,19,19,19,56,20,56,19,19,19,18,20,18,19,19,19,19,19,56,19,19,19,18,20,56,19,56,20,56,19,2149\r'
CURSORRIGHT='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,56,18,18,18,56,18,56,18,18,18,18,18,18,18,56,18,18,18,56,18,18,18,18,18,56,18,56,18,56,18,2185\r'
CURSORUP='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,18,18,18,18,56,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,18,18,18,18,56,18,56,18,56,18,2185\r'
FORWARD='sendir,1:1,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,57,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,57,18,57,18,57,18,18,18,57,18,57,18,57,18,2194\r'
FORWARDNEXT='sendir,1:3,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,57,18,18,18,57,18,18,18,57,18,18,18,18,18,18,18,18,18,57,18,18,18,57,18,18,18,57,18,57,18,57,18,2195\r'
FUNCTIONBLUE='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,18,18,56,18,18,18,18,18,56,18,18,18,18,18,56,18,56,18,18,18,56,18,56,18,18,18,56,18,56,18,2185\r'
FUNCTIONGREEN='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,56,18,18,18,18,18,18,18,56,18,18,18,18,18,56,18,18,18,56,18,56,18,56,18,18,18,56,18,56,18,2185\r'
FUNCTIONRED='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,56,18,18,18,56,18,56,18,2185\r'
FUNCTIONYELLOW='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,56,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,56,18,56,18,56,18,18,18,56,18,56,18,2185\r'
INFO='sendir,1:3,1,38000,1,1,171,171,19,19,19,19,19,19,19,19,19,19,19,57,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,171,19,57,19,57,19,57,19,19,19,19,19,57,19,57,19,57,19,57,19,19,19,19,19,19,19,57,19,19,19,19,19,19,19,19,19,57,19,57,19,57,19,2155\r'
MENUDISC='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,18,18,56,18,56,18,56,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,2185\r'
MENUHOME='sendir,1:3,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,18,18,57,18,57,18,18,18,57,18,18,18,18,18,18,18,57,18,18,18,18,18,57,18,18,18,57,18,57,18,57,18,2196\r'
MENUMAIN='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,18,18,56,18,56,18,56,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,56,18,56,18,56,18,2185\r'
MENUPOPUP='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,56,18,56,18,56,18,56,18,56,18,18,18,56,18,56,18,2183\r'
OPENCLOSE='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,56,18,56,18,56,18,56,18,56,18,56,18,56,18,2185\r'
PLAYPAUSETOGGLE='sendir,1:3,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,18,18,18,18,57,18,18,18,57,18,18,18,18,18,18,18,57,18,57,18,18,18,57,18,18,18,57,18,57,18,57,18,2195\r'
POWERTOGGLE='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,56,18,56,18,56,18,56,18,56,18,56,18,56,18,56,18,2185\r'
RETURN='sendir,1:3,1,38000,1,1,170,170,19,18,19,19,19,19,19,19,19,19,19,56,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,170,19,56,19,56,19,56,19,19,19,56,19,56,19,56,19,19,19,56,19,19,19,19,19,19,19,19,19,19,19,19,19,56,19,19,19,56,19,56,19,56,19,2175\r'
REVERSEPREVIOUS='sendir,1:3,1,38000,1,1,171,171,18,18,18,18,18,18,18,18,18,18,18,57,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,171,18,57,18,57,18,57,18,18,18,18,18,57,18,18,18,18,18,57,18,18,18,18,18,18,18,57,18,18,18,57,18,57,18,18,18,57,18,57,18,57,18,2195\r'
STOP='sendir,1:3,1,38000,1,1,170,170,18,18,18,18,18,18,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,170,18,56,18,56,18,56,18,18,18,56,18,56,18,18,18,18,18,56,18,18,18,18,18,18,18,18,18,18,18,56,18,56,18,18,18,56,18,56,18,56,18,2185\r'
TOOLS='sendir,1:3,1,38000,1,1,170,170,19,19,19,19,19,19,19,19,19,19,19,56,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,170,19,56,19,56,19,56,19,18,19,19,19,56,19,19,19,56,19,56,19,56,19,19,19,19,19,56,19,19,19,56,19,19,19,19,19,19,19,56,19,56,19,2175\r'

# end of iTach

XMC_POWERON='sendir,1:1,1,38000,1,69,341,170,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,64,21,64,21,64,21,64,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,21,21,21,21,1517,341,85,21,3655\r'
XMC_STANDBY='sendir,1:1,1,38000,1,69,341,170,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,64,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,64,21,64,21,64,21,64,21,64,21,21,21,1517,341,85,21,3655\r'

XMC_COMMAND='<?xml version="1.0" encoding="utf-8"?><emotivaControl><commandName value="commandValue" ack="yes" /></emotivaControl>'
XMC_COMMAND_MODE_SURROUND='<?xml version="1.0" encoding="utf-8"?><emotivaControl><"surround_mode" value="0" ack="yes" /></emotivaControl>'
XMC_PING='<?xml version="1.0" encoding="utf-8"?><emotivaPing />'

#XMC_UPDATE=      '<?xml version="1.0" encoding="utf-8"?><emotivaUpdate><volume /></emotivaUpdate>'
XMC_UPDATE=      '<?xml version="1.0" encoding="utf-8"?><emotivaUpdate><mode /><volume /><speaker_preset /><center /><subwoofer /><surround /></emotivaUpdate>'
XMC_SUBSCRIPTION='<?xml version="1.0" encoding="utf-8"?><emotivaSubscription><mode /><volume /><speaker_preset /><center /><subwoofer /><back /></emotivaSubscription>'
XMC_SUBSCRIBE='<?xml version="1.0" encoding="utf-8"?><emotivaUnsubscribe><mode /><volume /><speaker_preset /><center /><subwoofer /><back /></emotivaUnsubscribe>'
#XMC_SUBSCRIPTION='<?xml version="1.0" encoding="utf-8"?><emotivaSubscription><volume /></emotivaSubscription>'

IP2IR_IPADDRESS = 'yourIP'
IP2IR_PORT = 4998
XMC_IPADDRESS = 'yourIP'
XMC_TRANSACTION_PORT_IN = 7000
XMC_TRANSACTION_PORT_RESPONSE = 7001
XMC_CONTROL_PORT = 7002
DOMOTICZ_IPADDRESS = 'yourIP'


def log(info):
    info  = (urllib.parse.quote(info))
    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=addlogmessage&message=' + info)
    return;
  
#print (str(sys.exc_info()))
#exit()

SLEEPTIME=0.5
TIMEOUT=60
audio = sys.argv[1]

print (audio)

try:
    value = sys.argv[2]
except:
    value = ''

BUFFER_SIZE = 2000

#row 0 is command
#row 1 is IP address
#row 2 is port
#row 3 is protocol
    
if audio == 'Plex':
    #Set preamp input to VidƩo and XMC input to Input 1
    MESSAGE=[[XMC_POWERON,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"],[VIDEO,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandName','source_1')
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandValue','0')
elif audio == 'Shield':
    #Set preamp input to VidƩo and XMC input to Input 2
    MESSAGE=[[XMC_POWERON,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"],[VIDEO,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandName','source_2')
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandValue','0')
elif audio == 'BR4K':
    #Set preamp input to VidƩo and XMC input to Input 2
    MESSAGE=[[XMC_POWERON,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"],[VIDEO,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandName','source_4')
    MESSAGE[1][0]=str.replace(MESSAGE[1][0],'commandValue','0')
elif audio == 'jRiver':
    #Set preamp input to Audio
    MESSAGE=[[AUX,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CD':
    #Set preamp input to CD
    MESSAGE=[[CD,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'Tourne disque':
    #Set preamp input to Phono
    MESSAGE=[[PHONO,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]

#BR4K
elif audio == 'POWERTOGGLE':
    MESSAGE=[[POWERTOGGLE,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]    
elif audio == 'OPENCLOSE':
    MESSAGE=[[OPENCLOSE,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]    
elif audio == 'PLAYPAUSETOGGLE':
    MESSAGE=[[PLAYPAUSETOGGLE,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'STOP':
    MESSAGE=[[STOP,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CURSORLEFT':
    MESSAGE=[[CURSORLEFT,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CURSORRIGHT':
    MESSAGE=[[CURSORRIGHT,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CURSORDOWN':
    MESSAGE=[[CURSORDOWN,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CURSORUP':
    MESSAGE=[[CURSORUP,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CURSORENTER':
    MESSAGE=[[CURSORENTER,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'MENUHOME':
    MESSAGE=[[MENUHOME,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'TOOLS':
    MESSAGE=[[TOOLS,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'RETURN':
    MESSAGE=[[RETURN,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'MENUDISC':
    MESSAGE=[[MENUDISC,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'INFO':
    MESSAGE=[[INFO,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'FORWARDNEXT':
    MESSAGE=[[FORWARDNEXT,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'REVERSEPREVIOUS':
    MESSAGE=[[REVERSEPREVIOUS,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'FORWARD':
    MESSAGE=[[FORWARD,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]    
elif audio == 'BACKWARD':
    MESSAGE=[[BACKWARD,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'CHAPTER':
    MESSAGE=[[TOOLS,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[CURSORENTER,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[CURSORDOWN,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"],[CURSORENTER,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]

#End of BR4K

#XMC-1 commands
elif audio == 'muteOn':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','mute_on')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'muteOff':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','mute_off')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio.find('volumeSet') == 0:
    audio=audio.replace('volumeSet','') # extract volume value
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"],[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','set_volume')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',audio)
    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','set_volume')
    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',audio)
elif audio == 'volumeUp':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','volume')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)
elif audio == 'volumeDown':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','volume')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)
elif audio == 'info':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','info')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'subscribe':
    MESSAGE=[[XMC_SUBSCRIPTION,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
elif audio == 'unsubscribe':
    MESSAGE=[[XMC_SUBSCRIBE,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]        
elif audio == 'update':
    MESSAGE=[[XMC_UPDATE,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
#elif audio == 'dim':
#    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
#    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','dim')
#    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')   
elif audio == 'dim':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"],[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','dim')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','dim')
    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue','0') 
elif audio == 'speakerPreset1':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','preset1')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'speakerPreset2':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','preset2')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'speakerDirac':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','dirac')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeReferenceStereo':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','reference_stereo')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeStereo':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','direct')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeSurround':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','surround_mode')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeDolby':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','dolby')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeDTS':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','dts')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeAllStereo':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','all_stereo')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'modeAuto':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','auto')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'moviePreset':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','movie')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'musicPreset':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','music')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue','0')
elif audio == 'centerTrim':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','center_trim_set')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)    
elif audio == 'subwooferTrim':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','subwoofer_trim_set')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)    
elif audio == 'surroundTrim':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','surround_trim_set')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)    
elif audio == 'backTrim':
    MESSAGE=[[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]#,[XMC_COMMAND,XMC_IPADDRESS,XMC_CONTROL_PORT,"UDP"]]
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandName','back_trim_set')
    MESSAGE[0][0]=str.replace(MESSAGE[0][0],'commandValue',value)
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandName','volume')
#    MESSAGE[1][0]=str.replace(MESSAGE[0][0],'commandValue',value)                                              
elif audio == 'XMC_STANDBY':
    MESSAGE=[[XMC_STANDBY,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
elif audio == 'XMC_POWERON':
    MESSAGE=[[XMC_POWERON,IP2IR_IPADDRESS,IP2IR_PORT,"TCP"]]
else:
    # unknown command
    print ('command not supported')
    exit()

sTCP = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

sUDPreceive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sUDPreceive.bind(('',XMC_TRANSACTION_PORT_RESPONSE))
fcntl.fcntl(sUDPreceive, fcntl.F_SETFL, os.O_NONBLOCK)

sUDPreceiveA = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sUDPreceiveA.bind(("",XMC_CONTROL_PORT))
fcntl.fcntl(sUDPreceiveA, fcntl.F_SETFL, os.O_NONBLOCK)

#for row in MESSAGE:
#    #for e in row:
#        #print (e)
#    print (row)
IPADDRESS_PREVIOUS=""
loop=0
loopA=0
poweringUp = False
#print MESSAGE
for row in MESSAGE:
#    print (row)
    loopA+=1
    #print ("loopA :", loopA)
    if row[3] == "UDP": # it is XMC by design, because this is the sole unit using UDP
        # send a ping and check if unit is On. If not wait until it is ready (PowerOn has been sent before)
        while True:
            # send a ping until a response is given
            sUDP.sendto(XMC_PING.encode(), (XMC_IPADDRESS, XMC_TRANSACTION_PORT_IN))
            #print ('ping sent: ', MESSAGE[0][0])
            # wait some time to let the unit answer
            sleep (0.1) # was 0.01
            try:
#                sUDPreceive.settimeout(1)
                data = sUDPreceive.recvfrom(500)
#                print (data)
            except socket.error as e:
                err = e.args[0]
                poweringUp = True
                if err == errno.EAGAIN or err == errno.EWOULDBLOCK:
                    sleep(SLEEPTIME)
                    #print ('No data available')
                    loop+=1
                    if loop*SLEEPTIME >= TIMEOUT/SLEEPTIME:
#                        print('timeout')
                        exit()
                    continue
                else:
                    # a "real" error occurred
#                    print e
                    sys.exit(1)
                #TBD implement a timeout of 20 sec in case there is a problem with the unit
            else:
#                sUDPreceive.close
                # unit is ready send the command now
                #print (data)
#                print ("unit is ready, powerinUp is ", poweringUp)
                # there is a bug in the API, that gives control back too soon, or should I check now for unit ready state if exists?
                if poweringUp:
                    sleep (18.0)
                    #print ("command to be sent: ", row)
                sUDP.sendto(row[0].encode(), (row[1], row[2]))
                # TBD : check if OK
                
                sleep (0.1)

                if poweringUp:
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=278&switchcmd=Set%20Level&level=30&parsetrigger=false')                
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=290&switchcmd=Set%20Level&level=0&parsetrigger=false')                
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=291&switchcmd=Set%20Level&level=0&parsetrigger=false')                
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=292&switchcmd=Set%20Level&level=0&parsetrigger=false')                
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=293&switchcmd=Set%20Level&level=0&parsetrigger=false')                
                    urlopen('http://'+DOMOTICZ_IPADDRESS+'/json.htm?type=command&param=switchlight&idx=283&switchcmd=Set%20Level&level=10&parsetrigger=false')                
                break
    else: # TCP protocol
        if IPADDRESS_PREVIOUS != row[1]:
            if IPADDRESS_PREVIOUS != "": s.close()
            sTCP.connect((row[1], int(row[2])))
            IPADDRESS_PREVIOUS=row[1]
#        print ("TCP", row[0])
        result = sTCP.send(row[0].encode())
#        print (result)
        data = sTCP.recv(BUFFER_SIZE).decode()
        sleep (0.05)

#        print ("received data:", data)

sUDP.close
sUDPreceive.close
sUDPreceiveA.close
sTCP.close
#print ("end")

@pawan7lps , @kolia and @NaderMTL . If anyoneā€™s interested, Iā€™ve tried to write some custom services to send commands to the xmc-1 and query its state. Itā€™s polling only - Iā€™ll try and look at subscriptions later. Iā€™ll post it to hacs, but you can download it as a custom hacs repo now if you want to try it. peteS-UK/xmc: Send commands from Home Assistant to Emotive XMC-1 (github.com)

Let me know if youā€™re able to give it a try and if it works OK etc.

Thank you for this new integration. I donā€™t have much time right now but I will certainly give it a try and send feedback here.

@kolia Iā€™ve updated it a couple of times, and I think itā€™s all working nicely now. Itā€™s a service at the moment, as that was the easiest way to get the functionality going. Iā€™ll try and turn it into a device at some point but let me know if thereā€™s anything you find or more functions that would be handy.

Thanks for this update. Is display brightness supported? Do you have some examples to illustrate how to use the 3 services?

Brightness isnā€™t supported at the moment, but I can easily add anything thatā€™s in the list of supported commands, which is below. More likely, Iā€™ll add an ā€œotherā€ option, else the list will get rather longā€¦

Itā€™s 3 custom services. So, once installed, youā€™ll have 3 new services you can use in automations, scripts etcā€¦

If you want to just test them, look at the services tab in Developer Tools and search for the xmc services

Once youā€™ve done an update_states, youā€™ll get a bunch of states (e.g. Power, Input etc.), that you can use as conditions etcā€¦

Command Value Description
none 0 No command. Ignored.
Standby 0 Enter standby mode
source_tuner 0 Set source to Tuner
source_1 0 Set source to Input 1
source_2 0 Set source to Input 2
source_3 0 Set source to Input 3
source_4 0 Set source to Input 4
source_5 0 Set source to Input 5
source_6 0 Set source to Input 6
source_7 0 Set source to Input 7
source_8 0 Set source to Input 8
menu 0 Enter/Exit menu
up 0 Menu Up
down 0 Menu Down
left 0 Menu Left
right 0 Menu Right
enter 0 Menu Enter
dim 0 Cycle through FP dimness settings
mode +1/-1 Mode up/down
info 0 Show Info screen
mute 0 Zone 1 Mute Toggle
mute_on 0 Zone 1 Mute on
mute_off 0 Zone 1 Mute off
music 0 Select Music preset
movie 0 Select Movie preset
center +n/-n Center Volume increment up/down
subwoofer +n/-n Subwoofer Volume increment up/down
surround +n/-n Surrounds Volume increment up/down
back +n/-n Backs Volume increment up/down
input +n/-n Change Zone 1 Input up/down
input_up 0 Zone 1 Input selection increment up
input_down 0 Zone 1 Input selection increment down
power_on 0 Zone 1 Power On
power_off 0 Zone 1 Power Off
volume +n/-n Zone 1 Volume increment up/down
set_volume n Zone 1 Volume set level -96ā€¦11
loudness_on 0 Loudness On
loudness_off 0 Loudness Off
loudness 0 Toggle Zone 1 Loudness on/off
speaker_preset 0 Cycle through Speaker Presets
mode_up 0 Mode increment up
mode_down 0 Mode increment down
bass_up 0 Bass level increment up
bass_down 0 Bass level increment down
treble_up 0 Treble level increment up
treble_down 0 Treble level increment down
zone2_power 0 Toggle Zone 2 Power On/Off
zone2_power_off 0 Zone 2 Power Off
zone2_power_on 0 Zone 2 Power On
zone2_volume +n/-n Zone 2 Volume increment up/down
zone2_set_volume n Zone 2 Volume set level -96ā€¦11
zone2_input +1/-1 Change Zone 2 Input up/down
zone1_band 0 Toggle Tuner Band AM/FM (also changes tuner in Zone 2)
band_am 0 Set Tuner Band AM (changes tuner in Zone 1 and Zone 2)
band_fm 0 Set Tuner Band FM (changes tuner in Zone 1 and Zone 2)
zone2_mute 0 Toggle Zone 2 Mute
zone2_mute_off 0 Zone 2 Mute Off
zone2_mute_on 0 Zone 2 Mute On
zone2_band 0 Not implemented
frequency +1/-1 Tuner Frequency up/down
seek +1/-1 Tuner Seek up/down
channel +1/-1 Tuner Preset Station up/down
stereo 0 Select mode Stereo
direct 0 Select mode Direct
dolby 0 Select mode Dolby
dts 0 Select mode DTS
all_stereo 0 Select mode All Stereo
auto 0 Select mode Auto
reference_stereo 0 Set Mode to Reference Stereo
surround_mode 0 Set mode to Surround
preset1 0 Select speaker preset 1
preset2 0 Select speaker preset 2
dirac 0 Select speaker DIRAC
hdmi1 0 Select input HDMI 1
hdmi2 0 Select input HDMI 2
hdmi3 0 Select input HDMI 3
hdmi4 0 Select input HDMI 4
hdmi5 0 Select input HDMI 5
hdmi6 0 Select input HDMI 6
hdmi7 0 Select input HDMI 7
hdmi8 0 Select input HDMI 8
coax1 0 Select input Coax 1
coax2 0 Select input Coax 2
coax3 0 Select input Coax 3
coax4 0 Select input Coax 4
optical1 0 Select input Optical 1
optical2 0 Select input Optical 2
optical3 0 Select input Optical 3
optical4 0 Select input Optical 4
ARC 0 Select input ARC
usb_stream 0 Select input USB stream
tuner 0 Select input Tuner 1
analog1 0 Select input Analog 1
analog2 0 Select input Analog 2
analog3 0 Select input Analog 3 4
analog4 0 Select input Analog 5
analog5 0 Select input Analog 7.1
analog7.1 0 Select input Analog
front_in 0 Select input Front
center_trim_set n Center Volume set level -12.0ā€¦+12.0
subwoofer_trim_set n Subwoofer Volume set level -12.0ā€¦+12.0
surround_trim_set n Surrounds Volume set level -12.0ā€¦+12.0
back_trim_set n Backs Volume set level -12.0ā€¦+12.0
width_trim_set n Widths Volume set level -12.0ā€¦+12.0
height_trim_set n Heights Volume set level -12.0ā€¦+12.0
zone2_analog1 0 Select Zone 2 input Analog 1
zone2_analog2 0 Select Zone 2 input Analog 2
zone2_analog3 0 Select Zone 2 input Analog 3
zone2_analog4 0 Select Zone 2 input Analog 4
zone2_analog5 0 Select Zone 2 input Analog 5
zone2_analog71 0 Select Zone 2 input Analog 7.1
zone2_analog8 0 Select Zone 2 input Analog 8
zone2_front_in 0 Select Zone 2 input Front
zone2_ARC 0 Select Zone 2 input ARC
zone2_ethernet 0 Select Zone 2 input Ethernet
zone2_follow_main 0 Select Zone 2 input Follow Main
zone2_coax1 0 Select Zone 2 input Coax 1
zone2_coax2 0 Select Zone 2 input Coax 2
zone2_coax3 0 Select Zone 2 input Coax 3
zone2_coax4 0 Select Zone 2 input Coax 4
zone2_optical1 0 Select Zone 2 input Optical 1
zone2_optical2 0 Select Zone 2 input Optical 2
zone2_optical3 0 Select Zone 2 input Optical 3
zone2_optical4 0 Select Zone 2 input Optical 4
channel_1 0 Select Tuner Station 1
channel_2 0 Select Tuner Station 2
channel_3 0 Select Tuner Station 3
channel_4 0 Select Tuner Station 4
channel_5 0 Select Tuner Station 5
channel_6 0 Select Tuner Station 6
channel_7 0 Select Tuner Station 7
channel_8 0 Select Tuner Station 8
channel_9 0 Select Tuner Station 9
channel_10 0 Select Tuner Station 10
channel_11 0 Select Tuner Station 11
channel_12 0 Select Tuner Station 12
channel_13 0 Select Tuner Station 13
channel_14 0 Select Tuner Station 14
channel_15 0 Select Tuner Station 15
channel_16 0 Select Tuner Station 16
channel_17 0 Select Tuner Station 17
channel_18 0 Select Tuner Station 18
channel_19 0 Select Tuner Station 19
channel_20 0 Select Tuner Station 20

OK - I posted a new version (1.2), which supports all of the above commands (listed in a dropdown in the send_command service. So, you can set anything that the XMC supports. I also added the ability in the update_state service to monitor any of the 40 or notifications that the XMC supports - i.e. you could create a trigger based on a change of any state - e.g. you could trigger on the change of video format if you felt inclined.

Iā€™ve also added some usage examples to the readme.md on github

Thanks a lot for this work and the interesting additions. Iā€™ll keep you posted when Iā€™ll have time to use it. Let me know whether Brightness is something you could add in the near future. I never succeeded to make it work, I suspect the API documentation is incomplete.

It should be supported now - thereā€™s a command and notification for ā€œdimā€, which cycles through the settings. Iā€™ll try it later - my xmcā€™s in a av room, so I never see the screen.

@kolia, sadly youā€™re right. It looks like the API doesnā€™t work for dim. Calling the command just pops up the current setting on the fp, but calling it again doesnā€™t cycle through as it should. I guess the api just doesnā€™t work :frowning: Iā€™ll try sending them a note to see if they have any feedback, but donā€™t hold my breath. I tried various other settings, but didnā€™t get anywhere. I also tried the ā€œunofficial Emotiva Remoteā€ app on my (android) phone, and it does exactly the same with with dim setting.

well at least your findings confirm my own experience. I was hoping that you found a trick to get it work by sending some kind of magic command.
Edit : as a last resort, since I have an itach ir directly connected to the xmc ir interface, I may succeed toā€™use Brightness this way

It seems like it doesnā€™t even work in their ā€œofficialā€ app - https://emotivalounge.proboards.com/post/1069066. Yes, I have a cable based IR connection from my hub as well, and the IR codes are supposed to work. Never tried them for Dim as the XMCā€™s in a rack so I donā€™t see it, but Iā€™ll give it a go if I get a mo.

OK - just to confirm. The IR command for DIM does cycle through the brightness (in my case sent through a Philips IR extender via cable), but the network API version of the command just pulls up the current status and never cycle through. Comment on the emo website suggests that the XMC-2 has the same problem. Iā€™ve asked Emo a question, but not expecting a response tbh.

@kolia and everyone. I had some time over the weekend, so got a chance to turn the services into a media player component. So, itā€™ll now search for your processor and add as a new entity called media_player.emotivaprocessor which you can control using a normal media player card. It also has the service to allow you to send any command still (emotiva.send_command). I havenā€™t had a chance to update the docs yet, but the repo is now at https://github.com/peteS-UK/emotiva/. Add it as a custom repo. It now supports configuration flow in HA rather than having to do it manually in configuration.yaml, and will now show a normal integration and entity within the UI. Basically, itā€™s now a full media player component and seems to work fine.

Hello everyone.
I implemented this integration to command my Emotiva RMC-1. Some commands work perfectly and others donā€™t. For example, the volume control control works correctly:

  • type: ā€˜custom:button-cardā€™
    tap_action:
    action: call-service
    service: emotiva_xmc.send_command
    target: {}
    data:
    Command: volume
    Value: ā€˜+1ā€™
    entity: emotiva_xmc.processor
    name: ā€˜Volume Upā€™
    icon: mdi:volume-plus
    hold_action:
    action: none
    template:
    • button_icon_square
    • feedback_click

while others instead of executing the command open the processor status page. For example, the command to select the source:

  • type: ā€˜custom:button-cardā€™
    name: ā€˜HDMI 1ā€™
    icon: mdi:hdmi-port
    tap action:
    action: call-service
    service: emotiva_xmc.send_command
    target: {}
    data:
    Command: hdmi1
    Value: ā€˜0ā€™
    entity: emotiva_xmc.processor
    template:
    • button_square
    • feedback_click

Where am I going wrong?

Hi @flavio61 . Thereā€™s a much newer version of the integration at peteS-UK/emotiva: Create Home Assistant Media Player for Emotiva Processors (github.com) Use this one instead - itā€™ll give you a full media player component as well as the other service same as before.

Having said that, Iā€™m glad to hear that some work (at least). Try the new version of the integration, and then report back on how it works - I have an XMC-1 so canā€™t test it on RMC, but the API is supposed to be largely common. Iā€™ve tried asking Emotiva support for the RMC/XMC-2 API but without any luck getting a response.

BTW - If itā€™s as simple as something like the RMC having different input names, weā€™ll be able to see that in the debug. Basically, when something changes on the processor, it sends out a notification if youā€™re subscribed to that change. So, if you change the input on the RMC (e.g. by the IR remote or using the buttons), itā€™ll send out a packet saying ā€œsource = HDMI2ā€, and we can use that to see what the correct commands are - the notifications and the commands are use the same data. Once youā€™ve installed the new integration, you can enable debug logging on the device it creates and then capture the logsā€¦

Thanks Peter,
I hadnā€™t seen this new version of the integration. I have already removed the old integration and installed the new one, although to install it I had to use the manual option because the one from HACS didnā€™t work for me. In HACS I added your repository and it shows it but after rebooting HA it disappears. Having installed it manually, wonā€™t it update automatically? Tonight Iā€™m going to start programming my tablet and let you know how it goes on my RMC-1. Thankā€™s for all.