Jump to content
C4 Forums | Control4

Amazon Echo set command for AVR volume


Recommended Posts

Hi all

Im trying to get Amazon Echo to set the volume level of the Onkyo AVR with a "Alexa Set AVR to ## " voice command.

Selecting the Onkyo TX-NR646  actions, in programming, I can program a "set the volume on Main Output" to a predefined value, say 50, but there is no option to use the Amazon Echo SET_VALUE_NUMBER string

So is it possible to write an XML instruction to achieve this please?

Im not great with XML but was thinking something like this may work

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set NAME-&gt;SET_VOLUME_LEVEL to the value of Amazon Echo-&gt;SET_VALUE_NUMBER</Description><XmlData><devicecommand owneridtype="variable" owneriditem="1133" name="="><param name="variable" type="int" /><param name="deviceid" type="int">440</param><param name="variableid" type="int">1001</param></devicecommand></XmlData></item></cutitems>

 

However the XML string from the "set volume level to" from the device actions on the AVR is

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set the volume on Main Output  to 50 on the NAME</Description><XmlData><devicecommand owneridtype="" owneriditem="-1"><command>SET_VOLUME_LEVEL</command><params><param><name>OUTPUT</name><value type="INTEGER"><static>4000</static></value></param><param><name>LEVEL</name><value type="INTEGER"><static>50</static></value></param></params></devicecommand></XmlData></item></cutitems>

 

Any ideas / pointers on this please?

 

Mak

Link to comment
Share on other sites


Or would this work maybe?

 

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set the volume on Main Output  to the value of Amazon Echo-&gt;SET_VALUE_NUMBER on the NAME</Description><XmlData><devicecommand owneridtype="" owneriditem="-1"><command>SET_VOLUME_LEVEL</command><params><param><name>OUTPUT</name><value type="INTEGER"><static>4000</static></value></param><param><name>LEVEL</name><value type="INTEGER"><static>Amazon Echo-&gt;SET_VALUE_NUMBER</static></value></param></params></devicecommand></XmlData></item></cutitems>

 

Mak

Link to comment
Share on other sites

2 minutes ago, South Africa C4 user said:

This is possible.  If I recall correctly there is a number value which you want to use rather than the string variable.

The Epic Systems driver has

SET_VALUE_NUMBER
SET_VALUE_STRING
STE_VALUE_FLOAT

 

Im trying to work out what the format of the XML should be 

 

Would it be something like

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set NAME-&gt;SET_VOLUME_LEVEL to the value of Amazon Echo-&gt;SET_VALUE_NUMBER</Description><XmlData><devicecommand owneridtype="variable" owneriditem="1133" name="="><param name="variable" type="int" /><param name="deviceid" type="int">440</param><param name="variableid" type="int">1001</param></devicecommand></XmlData></item></cutitems>

 

OR

 

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set the volume on Main Output  to the value of Amazon Echo-&gt;SET_VALUE_NUMBER on the NAME</Description><XmlData><devicecommand owneridtype="" owneriditem="-1"><command>SET_VOLUME_LEVEL</command><params><param><name>OUTPUT</name><value type="INTEGER"><static>4000</static></value></param><param><name>LEVEL</name><value type="INTEGER"><static>Amazon Echo-&gt;SET_VALUE_NUMBER</static></value></param></params></devicecommand></XmlData></item></cutitems>

 

Or am I completely wrong in both the above .. this is my first attempt at modifying the XML programming so I'm not sure.

 

Mak

Link to comment
Share on other sites

OK so this didn't work

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set the volume on Main Output  to the value of Amazon Echo-&gt;SET_VALUE_NUMBER on the NAME</Description><XmlData><devicecommand owneridtype="" owneriditem="-1"><command>SET_VOLUME_LEVEL</command><params><param><name>OUTPUT</name><value type="INTEGER"><static>4000</static></value></param><param><name>LEVEL</name><value type="INTEGER"><static>Amazon Echo-&gt;SET_VALUE_NUMBER</static></value></param></params></devicecommand></XmlData></item></cutitems>

 

The LUA debug on the AVR showed the following

 

ReceivedFromProxy(): SET_VOLUME_LEVEL on binding 5001; Call Function PRX_CMD.SET_VOLUME_LEVEL()
.   LEVEL:  50
ReceivedFromProxy(): SET_VOLUME_LEVEL on binding 5001; Call Function PRX_CMD.SET_VOLUME_LEVEL()
LUA_ERROR: [string "Lua Code"]:545: attempt to perform arithmetic on field 'OUTPUT' (a nil value)
.   OUTPUT:  4000
    LEVEL:  Amazon Echo-&gt;SET_VALUE_NUMBER
LUA_ERROR: [string "Lua Code"]:666: attempt to perform arithmetic on local 'volLevel' (a nil value)

 

Any ideas?

Link to comment
Share on other sites

Also tried this

<cutitems><item><Proxy>receiver</Proxy><Type>Command</Type><DeviceID>400</DeviceID><Description>Set NAME-&gt;SET_VOLUME_LEVEL to the value of Amazon Echo-&gt;SET_VALUE_NUMBER</Description><XmlData><devicecommand owneridtype="variable" owneriditem="1133" name="="><param name="variable" type="int" /><param name="deviceid" type="int">440</param><param name="variableid" type="int">1001</param></devicecommand></XmlData></item></cutitems>

 

The LUA debug on the AVR showed the following

 

ReceivedFromProxy(): SET_VOLUME_LEVEL on binding 5001; Call Function PRX_CMD.SET_VOLUME_LEVEL()
.   LEVEL:  20
LUA_ERROR: [string "Lua Code"]:545: attempt to perform arithmetic on field 'OUTPUT' (a nil value)
 

Again any ideas please?

Link to comment
Share on other sites

We have everything working, this is more about getting the programming in Control4 to send the information to the AVR as there is currently no option to do this so I was looking for a back door.

 

I've emailed Ari see if anything gives there

 

It's just knowing the variable and how to correctly put this into the XML for programming.

 

Mak

Link to comment
Share on other sites

1 minute ago, South Africa C4 user said:

Sorry... I must be missing something obvious here... but why not simply set the room volume variable to the value of SET_VALUE_NUMBER? One line of code in Composer...

Clearly I am missing something obvious!

The room volume variable does not alter the volume level from the AVR (Onkyo via TCP/IP) I have tired this.

Should the room volume level work? if so why doesn't it?

 

Mak

Link to comment
Share on other sites

It certainly doesn't work with my AVR and I don't think it has on others I've installed, with C4 matrix amps and audio matrix I know it works.

All the connections etc are correct for the AVR, volume up down mute works with the SR260 and C4 app but if I try using the CURRENT_VOLUME room variable and try to set this to say 50, stick it in the programming and execute it does nothing.

Hence my trying to use the set the volume level on AVR but I just cant work it out in code, maybe it cant be done but I doubt it.

 

Mak

Link to comment
Share on other sites

1 minute ago, makidoja said:

Hmmm, surely if I can send a Set Volume to 50 and the AVR volume goes to 50 it's discrete?

yes, but not all AVR's support this, so i'm just confirming that is the case.  The other way to see that is in the control4 UI on the volume when the source is on do you have JUST the + - or do you have a volume #

Link to comment
Share on other sites

Ok so Ari has replied and the driver for the onkyo AVR has a major bug in the descrete volume that's never been fixed, so I had to do a workaround

 

See the image for the code I ended up with, this will allow me to set the volume level in steps of 5, easy to remember and works great.

 

Mak

 

avr volume control alexa.jpg

Link to comment
Share on other sites

On 3/12/2017 at 0:22 PM, makidoja said:

Ok so Ari has replied and the driver for the onkyo AVR has a major bug in the descrete volume that's never been fixed, so I had to do a workaround

 

See the image for the code I ended up with, this will allow me to set the volume level in steps of 5, easy to remember and works great.

 

Mak

 

avr volume control alexa.jpg

Exactly what i did with google home and the ifttt driver in 5 db increments. Using an Integra DTR50.2

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.