Nabu Casa & Chromecast URL

I’m thinking of migrating from DuckDNS to Nabu Casa. Partly for to remove port forwarding and partly for access to Azure TTS.

However I’m not clear on how I would specify the URL for playing media on my Chromecast Audio.

e.g. at the moment I have:

  action:
  - service: media_player.play_media
    data:
      entity_id: media_player.entranceway_speaker
      media_content_type: music
      media_content_id: >
        {% if states('input_select.chime_type') == 'Westminster' %} 
          https://mydomain.duckdns.org/local/sounds/GrandFatherChime{{ now().strftime('%I') }}.mp3
        {% elif states('input_select.chime_type') == 'Cuckoo' %}
          https://mydomain.duckdns.org/local/sounds/cuckoo-clock-{{ now().strftime('%I') }}.mp3
        {% else %} 
          https://mydomain.duckdns.org/local/sounds/minesweeper.mp3
        {% endif %}

Also what do I set these to?

homeassistant:
  external_url: !secret base_url
  internal_url: !secret base_url

External URL will be the nabu casa address you get and internal URL the local IP.

Don’t know about the chromecast URL.

1 Like

Does that not change when I disconnect and reconnect remote access?

no your nabu casa account will always serve the same subdomain

1 Like

So I guess that’s what I use for the Chromecast Audio then. It just has to be a publicly accessible file location.

yes should be :slight_smile:

1 Like

Finally got around to doing this today.

It was a bit of a chore. Issues:

  1. Addon webpage ingress issues because of Firefox’s tracking protection. Eventually got the exception correct.
  2. Forgot about changing some Home Assistant API sensors to http.
  3. Stuffed around for ages with the iOS app trying to get the internal URL right before remembering I had disabled wifi on my mobile to test external access :roll_eyes:
  4. VSCode sync was generating lots of errors in Home Assistant until I updated the internal URL to http.

The Chormecast URL was indeed the the Nabu Casa URL and that turned out to be easiest thing to fix.

So now I have external access without port forwarding, a smooth sounding Irish lass to do my TTS announcements and I am supporting Home Assistant development. Nice. :+1:

EDIT: one, hopefully last, thing I had to clean up. Had to delete my duckdns domain as it was generating these errors:

Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:393
First occurred: 16:27:35 (9 occurrences)
Last logged: 19:19:29

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

Had to set the logging level to debug to track it down.

1 Like

I have a similar error constantly showing up… is the problem that Im using DuckDNS??

Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:393
First occurred: November 5, 2021, 8:15:26 PM (66369 occurrences)
Last logged: 3:36:11 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

Yes it’s probably someone scanning your open port.

1 Like

Thanks for your quick reply. So is the only solution here to go to Nabu Casa? Or should I just ignore this warning as long as my HA password is strong enough?

I found that I didn’t need the domain at all. Just use the /local folder structure - the domain is added depending on the root you are serving from. The bit I was not understanding was what /local actually meant.

1 Like