core: HEOS integration unable to play local mp3 files - authentication error persists

The problem

I added HEOS integration for my HEOS speaker in order to play media files, preferably local files. I can sometimes play a TTS message via the speaker, but most times not. Local mp3 files do not play at all via the speaker (but do play if I use Web Browser as playback device).

In logs I can see my test attempt to play a local mp3 file (doorbell-1.mp3). Every attempt fails with an authentication error, eventually leading to ip ban. I had to disable IP banning temporarily now.

Even if I try to use TTS playback, the logs indicate that there is an authentication error for an attempt to play local mp3 file. See log entries below.

What version of Home Assistant Core has the issue?

core-2024.1.2

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

home-assistant_heos_2024-01-07T09-59-53.102Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Log details (WARNING)


Logger: homeassistant.components.http.ban
Source: components/http/ban.py:129 
Integration: HTTP (documentation, issues) 
First occurred: 11:04:05 (9 occurrences) 
Last logged: 11:59:45

Login attempt or request with invalid authentication from 192.168.74.1 (192.168.74.1). Requested URL: '/media/media/doorbell-1.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxM2Q5MDA0YjVhZmQ0ODRjOGU4MDJjYjQ2NGRmZjlkZSIsInBhdGgiOiIvbWVkaWEvbWVkaWEvZG9vcmJlbGwtMS5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MDQ2MTU3MjksImV4cC'. (AvegaMediaServer/2.0 Linux/2.6)
Login attempt or request with invalid authentication from 192.168.74.1 (192.168.74.1). Requested URL: '/media/local/doorbell-1.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxM2Q5MDA0YjVhZmQ0ODRjOGU4MDJjYjQ2NGRmZjlkZSIsInBhdGgiOiIvbWVkaWEvbG9jYWwvZG9vcmJlbGwtMS5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MDQ2MTkwMzksImV4cC'. (AvegaMediaServer/2.0 Linux/2.6)
Login attempt or request with invalid authentication from 192.168.74.1 (192.168.74.1). Requested URL: '/media/media/doorbell-1.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIyOGVkNDQ0N2ZlZDM0NjEwOWZiZDVhNmQwOWIxNDEwNCIsInBhdGgiOiIvbWVkaWEvbWVkaWEvZG9vcmJlbGwtMS5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MDQ2MTU0MjIsImV4cC'. (AvegaMediaServer/2.0 Linux/2.6)
Login attempt or request with invalid authentication from 192.168.74.1 (192.168.74.1). Requested URL: '/media/media/doorbell-1.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxM2Q5MDA0YjVhZmQ0ODRjOGU4MDJjYjQ2NGRmZjlkZSIsInBhdGgiOiIvbWVkaWEvbWVkaWEvZG9vcmJlbGwtMS5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MDQ2MTU3MzIsImV4cC'. (AvegaMediaServer/2.0 Linux/2.6)

Additional information

Hi, forgot to mention that this issue: https://github.com/home-assistant/core/issues/100492 seems very much similar. I have restarted and rebooted HA, removed the file in question, removed and readded the speaker. Anything else that would help in troubleshooting?

A note: I run HA as a virtual machine on a proxmox server.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (2 by maintainers)

Most upvoted comments

My workaround is to simply run a python http server alongside home-assistant (in systemd).

For demonstration purposes:

python -m http.server 8000 --directory <path/to/homeassistant/media>

We can still upload files via home-assistant, but must use the shorter+unrestricted url instead.

Imagine we upload some file called “sound.mp3”, we can use the following payload for HEOS devices:

action: media_player.play_media
target:
  entity_id: media_player.your_heos_device
data:
  media_content_id: http://<home-assistant-ip>:8000/sounds.mp3
  media_content_type: url

This works for me. We could also create a custom python script using the pyheos library directly to address this, but this works for now 😃

my systemd unit
# /etc/systemd/system/http_media.service
[Unit]
Description=SimpleHttpServer for HomeAssistant Media
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/.homeassistant/media
ExecStart=/bin/python3 -m http.server 8000
Restart=on-abort

[Install]
WantedBy=multi-user.target

Just got an answer from Denon.

Response By E-mail (Zuzana) (06/03/2024 17:00) Hi Nicolas,

Thank you for contacting Denon Customer Service. After careful review of your case I have contacted our specialists, and they confirmed that 255 is indeed current URL length limit and at the moment there are no plans to change that.

I am sorry of this inconvenience. If you have any other questions or need additional support, please feel free to reach out to us.

Kind regards, Zuzka

DLNA is a no-go for my own usecase so at the moment I’m stuck with the HEOS app or a third-party service.

After (not that much) digging, I found the API documentation for HEOS, and there is no mention of the character length of URLs anywhere in it.

https://assets.denon.com/documentmaster/us/heos_cli_protocolspecification-version_04062020.pdf

However, after very few testing, I can confirm that the URL is cutoff at 255 chars.

image

The long filename returns success but doesn’t start playing. The HEOS app alerts me of “unable to play media, please try again later”. The short filename plays straight away.

Does anyone on the HASS team this is a problem with a possible workaround or fix ? The only thing I’m thinking of would be to generate short URLs upon play.

Example : http://10.0.0.10:8123/shortUrl?guid=deadbeef-cafe-babe-1234-abcdef123456 that would internally redirect to http://10.0.0.10:8123/media/local/Music/file.flac?authSig%3Dasdfasdfasdflkajsdflkajsdf....