home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.77k stars 30.87k forks source link

HEOS speakers can be controlled but don't provide feedback (Restarting Home Assistant solves the issue for a while) #70078

Closed quizzical86 closed 2 years ago

quizzical86 commented 2 years ago

The problem

I have a problem with the HEOS integration: On a regular basis Home Assistant does not correctly reflect the status of the HEOS speakers anymore. For example:

Restarting Home Assistant Core will solve the issue for a while but then it comes back. I don't see errors in the logs linked to HEOS. I don't know whether others have this issue or whether it's just me. I've had it for a while now.

What version of Home Assistant Core has the issue?

core-2022.4.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HEOS

Link to integration documentation on our website

https://www.home-assistant.io/integrations/heos/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.heos.media_player Source: components/heos/media_player.py:103 Integration: Denon HEOS (documentation, issues) First occurred: 15 April 2022, 23:17:29 (46 occurrences) Last logged: 10:01:54

Unable to clear playlist: Command timed out Unable to play media: Command timed out Unable to stop: Command timed out Unable to set volume level: Command timed out Unable to play: Command timed out

Logger: homeassistant Source: /usr/src/homeassistant/homeassistant/runner.py:96 First occurred: 15 April 2022, 23:17:39 (48 occurrences) Last logged: 10:31:20

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pyheos/connection.py", line 158, in _handle_connection_error await self._disconnect() File "/usr/local/lib/python3.9/site-packages/pyheos/connection.py", line 143, in _disconnect await self._response_handler_task File "/usr/local/lib/python3.9/site-packages/pyheos/connection.py", line 219, in _response_handler commands.remove(event) ValueError: list.remove(x): x not in list

Logger: homeassistant.components.heos Source: components/heos/init.py:303 Integration: Denon HEOS (documentation, issues) First occurred: 10:30:50 (3 occurrences) Last logged: 10:31:20

Failed to group media_player.livingkeukenheos with ['media_player.bathroom']: Command timed out

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

heos documentation heos source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @andrewsayre, mind taking a look at this issue as it has been labeled with an integration (heos) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

quizzical86 commented 2 years ago

OK so I've been able to further narrow down this problem and can now reproduce it consistently. I have a Xiaomi scale that sends my weight via bluetooth every time I use the scale. I have a ESPHOME device that captures this bluetooth message and sends it to Home Assistant where I keep track of my weight. I have an automation in Node Red that calculates my weight change and asks Home Assistant to have a HEOS speaker (using Google TTS) inform me about my weight change.

Whenever this Node Red automation launches Home assistant immediately after stops receiving feedback (volume level, playing/idle/...) from the HEOS speaker. I've tried to narrow down what part of the Node Red automation exactly triggers this bug between Home Assistant and HEOS but didn't really succeed. I simplified the Node Red automation to the following (I manually inject some messages into the automation and it does some calculations and transformations and then clears the playlist and calls on Home Assistant to let HEOS speak the message): If I try to simplify it any further the bug doesn't appear anymore. image

Here's the Node Red code:

[{"id":"ce27b3df04aa99b1","type":"inject","z":"92da3f90.2062d","name":"","props":[{"p":"payload"},{"p":"msg.data.old_state.state","v":"82.20","vt":"num"},{"p":"msg.data.new_state.state","v":"82.10","vt":"num"},{"p":"data.old_state.last_changed","v":"","vt":"date"},{"p":"who","v":"John","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1640,"y":4860,"wires":[["d2b2998cae39ed9a"]]},{"id":"d2b2998cae39ed9a","type":"function","z":"92da3f90.2062d","name":"Calculate difference","func":"msg.verschil = msg.data.old_state.state-msg.data.new_state.state;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1810,"y":4860,"wires":[["eabca73648513fa2"]]},{"id":"8a8a22d92229a9e9","type":"moment","z":"92da3f90.2062d","name":"Since when?","topic":"","input":"data.old_state.last_changed","inputType":"msg","inTz":"Europe/Brussels","adjAmount":"2","adjType":"hours","adjDir":"subtract","format":"timeAgo","locale":"nl_BE","output":"timeago","outputType":"msg","outTz":"Europe/Brussels","x":2130,"y":4860,"wires":[["1d0e7899bd678fd7"]]},{"id":"24c6dfe7d5450e03","type":"change","z":"92da3f90.2062d","name":"","rules":[{"t":"set","p":"bericht","pt":"msg","to":"who&\" je bent \"&verschil&\" gram afgevallen sinds je laatste meting \"&timeago&\". Die meting was rond \"&uur&\" uur.\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":2440,"y":4860,"wires":[["4f9d22939480bd3a"]]},{"id":"41af3517073851d7","type":"api-call-service","z":"92da3f90.2062d","name":"Bathroom say: weight change","server":"5c29d263.09d2ac","version":5,"debugenabled":true,"domain":"tts","service":"google_translate_say","areaId":[],"deviceId":[],"entityId":["media_player.bathroom"],"data":"{\"entity_id\":\"media_player.bathroom\",\"message\":\"{{bericht}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2830,"y":4860,"wires":[[]]},{"id":"4f9d22939480bd3a","type":"api-call-service","z":"92da3f90.2062d","name":"clear playlist","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"media_player","service":"clear_playlist","areaId":[],"deviceId":[],"entityId":["media_player.bathroom"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2610,"y":4860,"wires":[["41af3517073851d7"]]},{"id":"eabca73648513fa2","type":"calculator","z":"92da3f90.2062d","name":"To grams","inputMsgField":"verschil","outputMsgField":"verschil","operation":"mult","constant":"1000","round":true,"decimals":0,"x":1980,"y":4860,"wires":[["8a8a22d92229a9e9","1d0e7899bd678fd7"]]},{"id":"1d0e7899bd678fd7","type":"moment","z":"92da3f90.2062d","name":"Hour","topic":"","input":"data.old_state.last_changed","inputType":"msg","inTz":"Europe/Brussels","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH","locale":"nl_BE","output":"uur","outputType":"msg","outTz":"Europe/Brussels","x":2290,"y":4860,"wires":[["24c6dfe7d5450e03"]]},{"id":"5c29d263.09d2ac","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.