Closed stalakerob closed 3 years ago
yamaha documentation yamaha source (message by IssueLinks)
same here. No Media play. turn_on, volume_set, select_source works.
Same problem here
I have a V475 that was working perfectly with a script that opened a Net radio site for years and has stopped a working a short while ago through my HA script. It still works through the yamaha android app and the remote control.
The Amp switches on but stops on displaying the LED screen "Bookmarks" (Stupidly I called my bookmarks folder "Bookmarks").
I am running the latest firmware on the yamaha (they haven't updated in years and I have been upto date since then, so haven't changed anything there). I am also running the latest version of HA (core-2021.8.5)
My script is this and hasn't changed since it has been working for a year at least.
'1550095734231':
alias: 'BBC 6Music on HiFi '
sequence:
- data:
entity_id: media_player.yamaha_rx_v475
service: media_player.turn_on
- data:
entity_id: media_player.yamaha_rx_v475
media_content_id: Bookmarks>Bookmarks>BBC Radio 6 Music
media_content_type: NET RADIO
service: media_player.play_media
Get an error in my logs. I hope this helps someone cleverer than me fix this problem.
[139909405603104] 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
Logger: homeassistant.components.websocket_api.http.connection
Source: components/yamaha/media_player.py:404
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 13:30:26 (2 occurrences)
Last logged: 14:38:31
[139909405603104] 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 698, in async_play_media
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/yamaha/media_player.py", line 404, in play_media
self.receiver.net_radio(media_id)
File "/usr/local/lib/python3.9/site-packages/rxv/rxv.py", line 632, in net_radio
menu = self.menu_status()
File "/usr/local/lib/python3.9/site-packages/rxv/rxv.py", line 508, in menu_status
for elt in current_list.getchildren()
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
Since there is no solution for this since quite some time I switched to using Restful commands instead. . In configuration.yaml:
`rest_command: yamaha_rx_netradio_favorite_1: # Rock Antenne url: 'http://192.168.1.6/YamahaExtendedControl/v1/netusb/recallPreset?zone=main&num=1'
yamaha_rx_netradio_favorite_2: # Radio BOB url: 'http://192.168.1.6/YamahaExtendedControl/v1/netusb/recallPreset?zone=main&num=2'`
In scripts.yaml: ` - service_template: >
{% if is_state('input_select.internet_radio_channels', 'Rock Antenne') %}
rest_command.yamaha_rx_netradio_favorite_1
{% else %}
rest_command.yamaha_rx_netradio_favorite_2
{% endif %}`
I don't even need to select Net Radio as the source. Just turn the receiver on and execute the command. You can try it with your browser. Just copy the URL above into the browser, with your IP address of course.
Hi @stalakerob
Thanks for getting back to me. Unfortunately I don't get much response from the Amp if I just put the URL into my browser (changing the ip). I just get a 404 page and no action from the amp
Out of interest I did find another Git page that I had some success with https://github.com/christianfl/av-receiver-docs I managed to Post an XML to the amp (using postman app) and change the input on the amp.... but this git does not show how to use the internet radio function.
Just to add to @SurfingSpider's comment, the newer receivers do have more REST capabilities. Older receivers (like my RX-475) only have a basic webinterface with XML post.
Without a fix of the functionality, older receivers will be left out.
Leaving this here in case it help some else.
I created a node red flow that works with the Yamaha v475 (not a enabled musiccast model). I used a program called MITMproxy to work out what http POST requests were being sent from the yamaha app on my phone and recreated them as post requests in node red.
I am sure there are far more elegant ways to do it. but it works for me. and is faster than the old integration. I would love to know if there is a simpler way.
If you want to use this flow you just have to send it a couple of messages msg.fav = number of your bookmark you want to send i.e. 2 for the second down in the list of your bookmarks folder msg.ip = ip addr of your yamaha amp.
Node red export flow
[{"id":"01c738743d199034","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":2510,"y":4540,"wires":[["845971e20de6eb69"]]},{"id":"217d10470dea87a9","type":"change","z":"3d9125fd.0a2f6a","name":"Send turn on amp http request","rules":[{"t":"set","p":"payload","pt":"msg","to":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"PUT\"> <Main_Zone> <Power_Control> <Power>On</Power> </Power_Control> </Main_Zone> </YAMAHA_AV>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2270,"y":4540,"wires":[["01c738743d199034"]]},{"id":"75cdcf5d4d5029d2","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 2 (BBC Radio 4)","props":[{"p":"fav","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":390,"y":4700,"wires":[["c28fef1b1b7c9287"]]},{"id":"845971e20de6eb69","type":"change","z":"3d9125fd.0a2f6a","name":"Send Switch input to NET Radio HTTP Request","rules":[{"t":"set","p":"payload","pt":"msg","to":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"PUT\"> <Main_Zone> <Input> <Input_Sel>NET RADIO</Input_Sel> </Input> </Main_Zone> </YAMAHA_AV>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2320,"y":4620,"wires":[["f6438f71a9fccd5c"]]},{"id":"f6438f71a9fccd5c","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":2590,"y":4620,"wires":[["ab106eecc3343e3c"]]},{"id":"ab106eecc3343e3c","type":"change","z":"3d9125fd.0a2f6a","name":"Get Menu List (doesnt work without this)","rules":[{"t":"set","p":"payload","pt":"msg","to":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"GET\"> <NET_RADIO> <List_Info>GetParam</List_Info> </NET_RADIO> </YAMAHA_AV>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":4760,"wires":[["d7be3954e47fa148"]]},{"id":"d7be3954e47fa148","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1170,"y":4760,"wires":[["6269c9b6a5abb1ef","505102e8b5ac31d1"]]},{"id":"de2deb817000c8d4","type":"switch","z":"3d9125fd.0a2f6a","name":"<Menu_Layer> ?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Menu_Layer>1</Menu_Layer>","vt":"str"},{"t":"cont","v":"<Menu_Layer>2</Menu_Layer>","vt":"str"},{"t":"cont","v":"<Menu_Layer>3</Menu_Layer>","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1670,"y":4760,"wires":[["ac70beef4a3a5f70"],["ac70beef4a3a5f70"],["bf1c70f84d35e12f"]]},{"id":"6269c9b6a5abb1ef","type":"switch","z":"3d9125fd.0a2f6a","name":"Menu loaded yet?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Menu_Status>Ready</Menu_Status>","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1450,"y":4760,"wires":[["de2deb817000c8d4"],["f2c48329dba73d7e"]]},{"id":"f2c48329dba73d7e","type":"delay","z":"3d9125fd.0a2f6a","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":880,"y":4840,"wires":[["ab106eecc3343e3c"]]},{"id":"ac70beef4a3a5f70","type":"change","z":"3d9125fd.0a2f6a","name":"Select line 1 of menu","rules":[{"t":"set","p":"payload","pt":"msg","to":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"PUT\"> <NET_RADIO> <List_Control> <Direct_Sel>Line_1</Direct_Sel> </List_Control> </NET_RADIO> </YAMAHA_AV>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2020,"y":4760,"wires":[["6dfcab8d82492401"]]},{"id":"6dfcab8d82492401","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":2530,"y":4760,"wires":[["ab106eecc3343e3c"]]},{"id":"64b3a1aa24f08ef4","type":"change","z":"3d9125fd.0a2f6a","name":"Get Amp Basic Status","rules":[{"t":"set","p":"payload","pt":"msg","to":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"GET\"> <Main_Zone> <Basic_Status>GetParam</Basic_Status> </Main_Zone> </YAMAHA_AV>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1640,"y":4580,"wires":[["492253c7cb1c371d"]]},{"id":"492253c7cb1c371d","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1830,"y":4580,"wires":[["4da91384494de5ed","06c5b0fb2739bb75"]]},{"id":"4da91384494de5ed","type":"switch","z":"3d9125fd.0a2f6a","name":"Power on?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Power>Standby</Power>","vt":"str"},{"t":"cont","v":"<Power>On</Power>","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":2010,"y":4580,"wires":[["217d10470dea87a9"],["845971e20de6eb69"]]},{"id":"83cde9e9b2258591","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 1 (BBC 6Music)","props":[{"p":"fav","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":390,"y":4660,"wires":[["c28fef1b1b7c9287"]]},{"id":"a6884f5f0979ce3e","type":"comment","z":"3d9125fd.0a2f6a","name":"Menu Select","info":"Menu 1 = Bookmarks, Locations, Genres etc\nMenu 2 = Name of your Bookmarks folder on ytuners.com\nMenu 3 = Favorites list\n\nI want Menu 1 \"Bookmarks\" > Menu 2 \"Bookmarks\" > Menu 3 \"fav 1\"\n\nSo for me it was option 1 on the first two menus and then menu 3 takes the msg.fav number to choose which one to play ","x":830,"y":4720,"wires":[]},{"id":"06c5b0fb2739bb75","type":"debug","z":"3d9125fd.0a2f6a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2050,"y":4500,"wires":[]},{"id":"505102e8b5ac31d1","type":"debug","z":"3d9125fd.0a2f6a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1370,"y":4840,"wires":[]},{"id":"9faa83187b512891","type":"template","z":"3d9125fd.0a2f6a","name":"Create URL from msg.ip","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"http://{{ip}}/YamahaRemoteControl/ctrl","output":"str","x":1070,"y":4580,"wires":[["45aa144ae3bc2ef8"]]},{"id":"c28fef1b1b7c9287","type":"change","z":"3d9125fd.0a2f6a","name":"Set IP of Yamaaha Amp","rules":[{"t":"set","p":"ip","pt":"msg","to":"192.168.86.36","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":4580,"wires":[["9faa83187b512891"]]},{"id":"f88e56a8aecf02b9","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 11","props":[{"p":"fav","v":"11","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":120,"y":4780,"wires":[["c28fef1b1b7c9287"]]},{"id":"3b0406169861725f","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 8","props":[{"p":"fav","v":"8","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":4660,"wires":[["c28fef1b1b7c9287"]]},{"id":"d015ae1a6ed9dbdd","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 9","props":[{"p":"fav","v":"9","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":4700,"wires":[["c28fef1b1b7c9287"]]},{"id":"0a773f73c6955273","type":"inject","z":"3d9125fd.0a2f6a","name":"Favorite 10","props":[{"p":"fav","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":123,"y":4736.4443359375,"wires":[["c28fef1b1b7c9287"]]},{"id":"8b99101fc7e07918","type":"template","z":"3d9125fd.0a2f6a","name":"Select Jump_Line from msg.fav","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"PUT\"> <NET_RADIO> <List_Control> <Jump_Line>{{{Jump_Line}}}</Jump_Line> </List_Control> </NET_RADIO> </YAMAHA_AV>","output":"str","x":2330,"y":4820,"wires":[["6dfcab8d82492401"]]},{"id":"f6e1a9f7464d1fb3","type":"template","z":"3d9125fd.0a2f6a","name":"Select Direct_Sel line","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<?xml version=\"1.0\" encoding=\"utf-8\"?> <YAMAHA_AV cmd=\"PUT\"> <NET_RADIO> <List_Control> <Direct_Sel>Line_{{{Direct_Sel}}}</Direct_Sel> </List_Control> </NET_RADIO> </YAMAHA_AV>","output":"str","x":2300,"y":4900,"wires":[["a0ccdbab23c8e101"]]},{"id":"a0ccdbab23c8e101","type":"http request","z":"3d9125fd.0a2f6a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":2490,"y":4900,"wires":[[]]},{"id":"45aa144ae3bc2ef8","type":"function","z":"3d9125fd.0a2f6a","name":"Work out which page the favorite is on ","func":"// if msg.fav is in first eight\nif (msg.fav >= 1 && msg.fav <= 8) {\n msg.Jump_Line = 1\n msg.Direct_Sel = msg.fav\n\n// if msg.fav is in 9-16 \n} else if (msg.fav >= 9 && msg.fav <= 16) {\n msg.Jump_Line = 9\n msg.Direct_Sel = msg.fav - 8\n\n// if msg.fav is 17-25\n} else if (msg.fav >= 17 && msg.fav <= 25) {\n msg.Jump_Line = 17\n msg.Direct_Sel = msg.fav - 16\n} \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1350,"y":4580,"wires":[["64b3a1aa24f08ef4"]]},{"id":"567e4a29075d916b","type":"switch","z":"3d9125fd.0a2f6a","name":"Current_Line = 9","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Current_Line>9</Current_Line>","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":2010,"y":4860,"wires":[["f6e1a9f7464d1fb3"],["8b99101fc7e07918"]]},{"id":"6e19fef074c8f189","type":"switch","z":"3d9125fd.0a2f6a","name":"Current_Line = 17","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Current_Line>17</Current_Line>","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":2010,"y":4900,"wires":[["8b99101fc7e07918"],["f6e1a9f7464d1fb3"]]},{"id":"dc706ed3ce386bae","type":"switch","z":"3d9125fd.0a2f6a","name":"Current_Line = 1","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<Current_Line>1</Current_Line>","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":2010,"y":4820,"wires":[["f6e1a9f7464d1fb3"],["8b99101fc7e07918"]]},{"id":"bf1c70f84d35e12f","type":"switch","z":"3d9125fd.0a2f6a","name":"Msg.Jump_Line","property":"Jump_Line","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"9","vt":"str"},{"t":"eq","v":"17","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":1780,"y":4860,"wires":[["dc706ed3ce386bae"],["567e4a29075d916b"],["6e19fef074c8f189"]]},{"id":"c710b54ca8beccf4","type":"comment","z":"3d9125fd.0a2f6a","name":"Play 6music on Yamaha v475 amp - Using HTTP POST requests","info":"I was previously using the https://www.home-assistant.io/integrations/yamaha/ integration, and still do for everything apart from turning on the internet radio stations. It did work but I think it must have been updated to use the rest api that comes with more recent models. but the only bit that seemed to break was NET Radio\n\nwith that integration I used to be able to do all this with a service call that just contained...\n\n```\n'1550095734231':\n alias: 'BBC 6Music on HiFi '\n sequence:\n - data:\n entity_id: media_player.yamaha_rx_v475\n service: media_player.turn_on\n - data:\n entity_id: media_player.yamaha_rx_v475\n media_content_id: Bookmarks>Bookmarks>BBC Radio 6 Music\n media_content_type: NET RADIO\n service: media_player.play_media\n```\n","x":270,"y":4360,"wires":[]}]
Edit: 01-09-21 Updated the node red flow to work if you are recalling more than eight bookmarks.
I am joining in on this topic. Having the same exact problem with my scripts and being stuck on the “Bookmarks folder” since some versions. I think this was working before it was necessary to supply the “Content type” in the play media command:
this is my non-functional script that has been working for several years until now :frowning:
alias: Yamaha SWR1
sequence:
- service: media_player.turn_on
data:
entity_id: media_player.yamaha_receiver
- service: media_player.volume_set
data:
volume_level: 0.44
target:
entity_id: media_player.yamaha_receiver
- service: media_player.select_source
data:
source: NET RADIO
target:
entity_id: media_player.yamaha_receiver
- service: media_player.play_media
data:
media_content_id: Lesezeichen>Radio>SWR1 Baden-Württemberg
media_content_type: music
target:
entity_id: media_player.yamaha_receiver
mode: single
Hi @stalakerob
Thanks for getting back to me. Unfortunately I don't get much response from the Amp if I just put the URL into my browser (changing the ip). I just get a 404 page and no action from the amp
Out of interest I did find another Git page that I had some success with https://github.com/christianfl/av-receiver-docs I managed to Post an XML to the amp (using postman app) and change the input on the amp.... but this git does not show how to use the internet radio function.
For me the way using http requests does not do anything as well.
so sad it stopped working
@blautob Yes, it seems that only Musiccast receivers support http requests. Older devices only support xml. As long as the author of the yamaha component does not migrate to Python 3.9 this will not work. Alternatively there is the solution from @SurfingSpider above. You need to install Node Red and then copy the node red export flow above into it. This then handles the communication with the receiver. Node Red and Home Assistant can work together. I understand its more complex but it seems the only solution for now.
@stalakerob thanks for the explantion. Do you know how we can point the author of the yamaha component into the direction of updating to python 3.9?
This is exactly what we are doing here: raising an issue with this compoanent. But it seems this is not very high on their priority list. Too few people complaining.
BTW: As you can see above, there is not even somebody assigned to work on this yet. Maybe sending a kind reminder email to frenck (frenck@frenck.dev) woud help.
@frenck pinging you on this issue, due to the fact that my wife is only accepting home automation if she can select her fav. webradio on the mobile :-D
@blautob Do not ping random members in our organization. Thanks :+1:
Hello, I have the same problem, I use a yamaha rn-500.
The problem
The latest Home Assistant Docker version contains Python 3.9. It seems this is an issue for the Yamaha Network Receiver integration. When trying to execute media_player.play_media the following error occurs:
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
What is version of Home Assistant Core has the issue?
2021.7.2
What was the last working version of Home Assistant Core?
versions with python 3.8.x
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Yamaha Network Receiver
Link to integration documentation on our website
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response