Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring! Failed to connect when adding integration #112574

Closed
czornikk opened this issue Mar 7, 2024 · 20 comments · Fixed by #112589
Closed

Bring! Failed to connect when adding integration #112574

czornikk opened this issue Mar 7, 2024 · 20 comments · Fixed by #112589

Comments

@czornikk
Copy link

czornikk commented Mar 7, 2024

The problem

When setting up the integration I get 'Failed to connect'
image

I have tried setting all 3 lists I have to Germany in the app, also tried USA and reverted back to setting them all to UK (which is the one I use normally), none of them worked.

What version of Home Assistant Core has the issue?

core-2024.3.0

What was the last working version of Home Assistant Core?

core-2024.2.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Bring!

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Locale file articles.en-DE.json could not be loaded from filesystem. Will continue trying to download locale.
Exception: Cannot load articles.en-DE.json: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 821, in __load_article_translations dictionaries[locale] = await r.json() ^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json return await super().json(*args, loads=loads, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://web.getbring.com/locale/articles.en-DE.json')

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Mar 7, 2024

Hey there @miaucl, @tr4nt0r, mind taking a look at this issue as it has been labeled with an integration (bring) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of bring can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign bring Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


bring documentation
bring source
(message by IssueLinks)

@tr4nt0r
Copy link
Contributor

tr4nt0r commented Mar 7, 2024

en-DE? That's a very weird locale. But i think i know what happened here. Unfortunately this is not a language setting that can be changed in the app. Will try to fix it asap.

@rillekille
Copy link

Same issue for me.

@alsFC
Copy link

alsFC commented Mar 7, 2024

Same for me. I have set my Phone to English but the Region & Language setting in the Bring! app is set to "Germany". Maybe that helps to understand.

@rsousa13
Copy link

rsousa13 commented Mar 7, 2024

Same issue with Portuguese:

Origem: components/bring/__init__.py:37
Primeira ocorrência: 08:01:10 (20 ocorrências)
Último registo: 08:06:11

Locale file articles.pt-PT.json could not be loaded from filesystem. Will continue trying to download locale.
Exception: Cannot load articles.pt-PT.json: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 821, in __load_article_translations dictionaries[locale] = await r.json() ^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json return await super().json(*args, loads=loads, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://web.getbring.com/locale/articles.pt-PT.json')```

@ping13
Copy link

ping13 commented Mar 7, 2024

Same here

2024-03-07 10:08:54.316 ERROR (MainThread) [bring_api.bring] Exception: Cannot load articles.en-CH.json:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 821, in __load_article_translations
    dictionaries[locale] = await r.json()
                           ^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://web.getbring.com/locale/articles.en-CH.json')

@simonepittis
Copy link

simonepittis commented Mar 7, 2024

the integration try to get a JSON file, but get an HTML page if it's not articles.en-EN.json

Not Works:
curl -u YourEmailAddress https://web.getbring.com/locale/articles.en-DE.json

Works:
curl -u YourEmailAddress https://web.getbring.com/locale/articles.en-EN.json

@tr4nt0r can you bypass with adding the LANG selection?

  • de-DE
  • en-EN
  • fr-FR
  • it-IT

image

@tr4nt0r
Copy link
Contributor

tr4nt0r commented Mar 7, 2024

no worries, this is just a failover I made for in case the language could not be determined from the shopping list settings. It was just not validated correctly against the list of supported locales. I already fixed it, just waiting for review.

@L0bit0
Copy link

L0bit0 commented Mar 8, 2024

Hi

I thing I have same issue with en-ES:

Logger: bring_api.bring
Source: components/bring/__init__.py:37
First occurred: March 7, 2024 at 9:57:05 AM (2492 occurrences)
Last logged: 1:58:53 PM

Locale file articles.en-ES.json could not be loaded from filesystem. Will continue trying to download locale.
Exception: Cannot load articles.en-ES.json: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 821, in __load_article_translations dictionaries[locale] = await r.json() ^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json return await super().json(*args, loads=loads, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://web.getbring.com/locale/articles.en-ES.json')

I see this issue is now closed, but, I did not see the solution, what I missed?

thansk

@simonepittis
Copy link

simonepittis commented Mar 8, 2024

Hi

I thing I have same issue with en-ES:

Logger: bring_api.bring
Source: components/bring/__init__.py:37
First occurred: March 7, 2024 at 9:57:05 AM (2492 occurrences)
Last logged: 1:58:53 PM

Locale file articles.en-ES.json could not be loaded from filesystem. Will continue trying to download locale.
Exception: Cannot load articles.en-ES.json: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 821, in __load_article_translations dictionaries[locale] = await r.json() ^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json return await super().json(*args, loads=loads, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://web.getbring.com/locale/articles.en-ES.json')

I see this issue is now closed, but, I did not see the solution, what I missed?

thansk

if it´s not urgent wait the patch... but if you want using the CLI (you need to have a CLI access in not protection mode):

docker exec -it homeassistant /bin/bash
cd /usr/local/lib/python3.12/site-packages/bring_api/locales
cp articles.en-EN.json articles.en-ES.json
exit

Note: this is something not permanent, when you reinstall the core you miss it... but works

image

With English + Norway county
image

@tr4nt0r
Copy link
Contributor

tr4nt0r commented Mar 13, 2024

en-ES, also known as the Spanglish locale. Bring really should have that as supported language 🤣 (And sorry again for introducing this bug)

@hesspoint
Copy link

Same for me. I have set my Phone to English but the Region & Language setting in the Bring! app is set to "Germany". Maybe that helps to understand.

Yes exactly what I do for all my devices

@HA-TB303
Copy link

Still doesn't work with core-2024.3.1, also the workaround does not work for me.

@simonepittis
Copy link

2024.3.1 works for me, no errors

@czornikk
Copy link
Author

czornikk commented Mar 14, 2024

2024.3.1 works for me, no errors

Yeah, me too, both workaround and after upgrade to 2024.3.1.

Still doesn't work with core-2024.3.1, also the workaround does not work for me.

This might be a different issue. Logs would probably help.

@HA-TB303
Copy link

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/bring/coordinator.py", line 53, in _async_update_data
items = await self.bring.get_list(lst["listUuid"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 257, in get_list
item["itemId"] = self.__translate(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/bring_api/bring.py", line 896, in __translate
raise ValueError(f"Locale {locale} not supported by Bring.")
ValueError: Locale nl-BE not supported by Bring.

@tr4nt0r
Copy link
Contributor

tr4nt0r commented Mar 14, 2024

Try updating the language settings of your shopping list in the Bring app.
Screenshot_20240314-221630-122.png

@HA-TB303
Copy link

HA-TB303 commented Mar 14, 2024

To what? It is set to Dutch, which is the language I need.

@hesspoint
Copy link

I just installed the HA 2024.3.1 update and now it works for me

@tr4nt0r
Copy link
Contributor

tr4nt0r commented Mar 14, 2024

To what? It is set to Dutch, which is the language I need.

just tap again on dutch and you should see a message to wait, when it goes away it should have saved the language.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants