PureDirect Yamaha text/XML - Post

Hello Community

i need your help. I want to control a function from my Yamaha AV Receiver thats can not be handle with the Yamaha Binding.

I can via Powershell from my Computer switch “PureDirect” on or off.

$body = '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Sound_Video><Pure_Direct><Mode>On</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'
Invoke-WebRequest "192.168.168.40/YamahaRemoteControl/ctrl" -ContentType "text/xml" -Method Post -Body $body

for disable puredirect

$body = '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Sound_Video><Pure_Direct><Mode>Off</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'
Invoke-WebRequest "192.168.168.40/YamahaRemoteControl/ctrl" -ContentType "text/xml" -Method Post -Body $body

How do I get this so that I can control it with openhab?

I have openhab3 on a ubuntu system.

Thanks for help

You can use

shell script with wget/curl command then can be called using executeCommandLine.

Thank you. that helped. I used the EXEC Binding.

My solution…

The Script *.sh

curl -v -X POST -d '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Sound_Video><Pure_Direct><Mode>On</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>' 192.168.168.40/YamahaRemoteControl/ctrl -k -H "Content-Type: text/xml;charset=utf-8"

Permissions of the sh file set to 777 (RW for all)

my *.things

Thing 	exec:command:puredirect 	"AV_WOH_Yamaha_RX-A750_PureDirect"		[ command="/etc/openhab/scripts/puredirect.sh", interval=0, autorun=false ]

my *.items

Switch    WOH_HIFI_AVR_PUREDIRECT   "RX-A750 MAIN_PureDirect"	<switch>	{channel="exec:command:puredirect:run", autoupdate="false"}
1 Like