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.56k stars 30.74k forks source link

Blink integration 406 errors / becoming unavailable #107143

Closed dgarimoldi closed 10 months ago

dgarimoldi commented 10 months ago

The problem

My Integration was working till today morning and the stopped. I tried removing it and setting up from scratch, now when Ilogin i receive the authentication code via SMS but when I enter it I get the "unexpected error" message

What version of Home Assistant Core has the issue?

core-2024.1.0

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

Blink

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 10 months ago

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

Code owner commands Code owners of `blink` 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 blink` 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)


blink documentation blink source (message by IssueLinks)

UsernetFR commented 10 months ago

Same problem. The integration works this morning and nothing since. I deleted and reinstalled the intergration but it didn't work.

projects4u commented 10 months ago

Same problem here, upgraded to 2024.1, had a few issues with other integrations, restarted HA, and only Blink stopped working. Tried reinstall but didn't work.

No email was received for PIN and no prompt popped up to enter in HA.

jkb216 commented 10 months ago

Same issue here on 2024.1 I removed 'Computer' from the approved devices on my Blink app, then setting up the integration asked me to enter the 2FA code from SMS. After entering the code, the integration config flow said 'Unexpected error' and produced a log message:

Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa
    valid_token = await _send_blink_2fa_pin(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin
    return await auth.send_auth_key(blink, pin)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key
    json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e007.immedia-semi.com/api/v4/account/XXXXXX/client/XXXXXXX/pin/verify')

(account and client numbers redacted)

mkmer commented 10 months ago

I don't believe we changed anything in this part of the code. Please attach a diagnostic data dump. It appears the web site is sending an unexpected format - text instead of json.
It's possible the endpoint is down rest-e007.immedia-semi.com. My instance is using rest-u034.immedia-semi.com and appears to be working fine.

SteveEmperor commented 10 months ago

Same problem.

Core 2023.12.4 supervisor 2023.12.0 Operating system 11.2 Front end 20231208.2

Location: Germany

rene-mt commented 10 months ago

Same here.

Core 2024.1.0 Supervisor 2023.12.0 Operating System 11.2 Frontend 20240103.3

Location: Germany

From the debug logs:

2024-01-04 19:52:37.605 INFO (MainThread) [blinkpy.auth] Token expired, attempting automatic refresh.
2024-01-04 19:52:37.606 INFO (MainThread) [blinkpy.auth] Attempting login with https://rest-prod.immedia-semi.com/api/v5/account/login
2024-01-04 19:52:38.273 DEBUG (MainThread) [blinkpy.helpers.util] Setting base url to https://rest-e007.immedia-semi.com.
2024-01-04 19:52:38.273 DEBUG (MainThread) [blinkpy.api] Making GET request to https://rest-e007.immedia-semi.com/api/v3/accounts/385537/homescreen
2024-01-04 19:52:43.547 DEBUG (MainThread) [blinkpy.helpers.util] Setting base url to https://rest-e007.immedia-semi.com.
2024-01-04 19:52:43.548 DEBUG (MainThread) [blinkpy.api] Making GET request to https://rest-e007.immedia-semi.com/api/v3/accounts/385537/homescreen
Lcyganek commented 10 months ago

Same problem here.

Core 2023.12.3 Supervisor 2023.12.0 Operating System 11.2 Frontend 20231208.2

Location Germany

mkmer commented 10 months ago

Looks like older versions are broke too. Same regions?

smartkrskrab commented 10 months ago

Same problem here. UK

mkmer commented 10 months ago

Looks like something has changed or is down on some endpoints. Anyone capable of capturing the message being sent in the 2FA code on a failing system and sharing it?

leen67 commented 10 months ago

Same issue here, from France. 2024-01-04 20:47:19.761 ERROR (MainThread) [homeassistant.components.blink.config_flow] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa valid_token = await _send_blink_2fa_pin( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin return await auth.send_auth_key(blink, pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e007.immedia-semi.com/api/v4/account/****/client/***/pin/verify')

(Account/client numbers removed)

mkmer commented 10 months ago

We need to see this message: aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e007.immedia-semi.com/api/v4/account/******/client/*******/pin/verify')

File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.json()

You would need to run HA in dev and stop line 218 and share the response.text() - You may need to add test = await response.text() to get at it in debug.

valerix85 commented 10 months ago

if it helps, from Italy I have the same problem, here is what appears to me from the registry with active debugging

`Logger: homeassistant.components.blink.config_flow Source: components/blink/config_flow.py:131 Integration: Blink (documentation, issues) First occurred: 10:03:36 (4 occurrences) Last logged: 10:07:13

Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa valid_token = await _send_blink_2fa_pin( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin return await auth.send_auth_key(blink, pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e001.immedia-semi.com/api/v4/account/xxx/client/xxx/pin/verify') `

ithorn500 commented 10 months ago

having the same issue, from UK.

Also, the iCloud integration is also not working with 2fa anymore, and also the Hive integration has also stopped loggin on, since the 2024 HA upgrade. feels like it is HA related change/issue.

MaxiKingXXL commented 10 months ago

same issue in HA 2023.12.4 since yesterday

GitMouth commented 10 months ago

Hi ! idem here with : Core 2023.12.3 Supervisor 2023.12.0 Operating System 11.2 Location : France

So, how can HA make problem if there was no change ? It seems to be elsewhere ...

Sogghigno commented 10 months ago

from Italy I have the same problem

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa valid_token = await _send_blink_2fa_pin( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin return await auth.send_auth_key(blink, pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e001.immedia-semi.com/api/v4/account/155612/client/1308073/pin/verify')

hombre-13hb commented 10 months ago

Same issue here France HA 2023.10.3

petrotti77 commented 10 months ago

Stesso problema con HA 2024.1 da Italia. Rimosso il Computer dall'applicazione e rimossa integrazione da HA. Riconfigurato nuovamente ma non accetta il codice 2FA.

fanaticglue437 commented 10 months ago

Also getting the same error in the UK.

Core 2024.1.0 Supervisor 2023.12.0 Operating System 11.3 Frontend 20240103.3

Looks like the issue has come from the blinkpy library. I cloned that, ran it and tried to login. Putting a breakpoint at line 137 in the auth.py file I can see the following in the response.content:

406 Not Acceptable

The status code is also 406.

Will try and do some more debugging.

fanaticglue437 commented 10 months ago

Perhaps a related issue: https://github.com/fronzbot/blinkpy/issues/818

alain13860 commented 10 months ago

Same here no Blink integration since the update of HA this morning !

unlucio commented 10 months ago

Perhaps a related issue: fronzbot/blinkpy#818

Makes sense: I'm getting a 404 in EU and a 406 in the US whenever I try curling the login url

shawwellpete commented 10 months ago

Same problem, started overnight last night while running 2023.12.2.

I removed the Blink integration, updated HA to 2024.1.1, reset the blink password, installed the integration again, after the username and password it asked for the 2FA text code which I entered and got this... 2024-01-05_10-31-41

Marcoblue commented 10 months ago

Same here. Maybe Blink changed something?

Log: 2024-01-05 14:00:13.787 ERROR (MainThread) [blinkpy.auth] Connection error. Endpoint https://rest-e001.immedia-semi.com/api/v3/accounts/15098/homescreen possibly down or throttled.

Agosh13 commented 10 months ago

Same issue.

unlucio commented 10 months ago

Log: 2024-01-05 14:00:13.787 ERROR (MainThread) [blinkpy.auth] Connection error. Endpoint https://rest-e001.immedia-semi.com/api/v3/accounts/15098/homescreen possibly down or throttled.

interesting, it's talking about api v3, blinkpy talks about an api v5 endpoint, and I got an error on a v4 endpoint.

Seems like Blink has been a messy little developer, this smells like trying to get rid of technical debt. We just got caught in the cleanup

fronzbot commented 10 months ago

interesting, it's talking about api v3, blinkpy talks about an api v5 endpoint, and I got an error on a v4 endpoint. Seems like Blink has been a messy little developer, this smells like trying to get rid of technical debt. We just got caught in the cleanup

Tell me about it. It's miserable trying to keep up with that.

As for this issue, many times these API problems resolve themselves within 24-48hrs and also tend to be region locked. Anecdotally, I feel like I've seen more of this issues from EU endpoint than US (in fact, outside of complete API overhauls by Blink, I've never really run into these problems in the US. Again, though, totally anecdotal).

Anyways, for the users having problems, if you still see issues on or after Jan 7th, please report back because it's likely an API change we will need to uncover and figure out. If your issues resolve by then, please also chime in so we know that it was a temporary API outage or something like that.

mokny commented 10 months ago

Got the same problem on 2023.12.2. Devices are not available. Location: EU / Germany

Nevermind: Works again. Probably just an outage

mkmer commented 10 months ago

FWIW: In the last few hours my instance (located in the US) was returning text for various post commands. All entities were unavailable, yet I could reload and login, just no entities. Now a few hours later it appears to be working again. Looks like something is happening on the Blink servers. I'm still interested in a dump of the text message Blink is sending if anyone can catch it and share.

fanaticglue437 commented 10 months ago

@mkmer I quoted the text message blink sent above. The response.content contains the string ‘ 406 Not Acceptable’

stephenc01 commented 10 months ago

Same general issue since the last day or so.

2024-01-05 17:09:05.533 ERROR (MainThread) [homeassistant.components.blink.coordinator] Error requesting blink data: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-prd2.immedia-semi.com/api/v3/accounts/24081/homescreen')

ilGaru commented 10 months ago

Same here since 05/01... I noticed that the Blink Sync Module keeps switching between available and unavailable, and I found this in the logs: Making GET request to https://rest-e005.immedia-semi.com/api/v3/accounts/XXXXXX/homescreen Error requesting blink data: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e005.immedia-semi.com/api/v3/accounts/XXXXXX/homescreen') [homeassistant.components.blink.coordinator] Finished fetching blink data in 0.045 seconds (success: False) I also noticed that there seems to be a repeating pattern (at least in my case): the API is called every 30 seconds, 3 consecutive calls are successful, and then 7-8 consecutive calls fail, as if there is a throttle limit

aldoushx commented 10 months ago

Same for me, it keeps switching between available and unavailable since 17:00.

ilGaru commented 10 months ago

Same for me, it keeps switching between available and unavailable since 17:00.

Around 17:00 here too (GMT+1)

dodor87 commented 10 months ago

Same error here:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa valid_token = await _send_blink_2fa_pin( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin return await auth.send_auth_key(blink, pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://rest-e001.immedia-semi.com/api/v4/account/37341/client/1308651/pin/verify')

Denis7619 commented 10 months ago

Steddo probrema da ieri, ho provato a fare un downgrade di HA e installare nuovamente blink ma non cambia nulla, sembra un problema del server Blink.

Questi i miei log: 2024-01-06 10:11:23.792 ERROR (MainThread) [homeassistant.components.blink.config_flow] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 131, in async_step_2fa valid_token = await _send_blink_2fa_pin( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/blink/config_flow.py", line 69, in _send_blink_2fa_pin return await auth.send_auth_key(blink, pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/blinkpy/auth.py", line 218, in send_auth_key json_resp = await response.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.11/site-packages/aiohttp/client_reqrep.py", line 1165, in json raise ContentTypeError(

2024-01-06 10:17:05.664 DEBUG (MainThread) [blinkpy.helpers.util] Setting base url to https://rest-e001.immedia-semi.com. 2024-01-06 10:17:05.664 DEBUG (MainThread) [blinkpy.api] Making GET request to https://rest-e001.immedia-semi.com/api/v3/accounts/279050/homescreen 2024-01-06 10:17:11.069 DEBUG (MainThread) [blinkpy.helpers.util] Setting base url to https://rest-e001.immedia-semi.com. 2024-01-06 10:17:11.070 DEBUG (MainThread) [blinkpy.api] Making GET request to https://rest-e001.immedia-semi.com/api/v3/accounts/279050/homescreen

djeghe commented 10 months ago

Anche io stesso problema. Le entità di connettono e sconnettono in continuazione. Sono più i periodi in cui sono sconnesse

mkmer commented 10 months ago

@home-assistant rename Blink integration 406 errors / becoming unavailable

valerix85 commented 10 months ago

Anche io stesso problema. Le entità di connettono e sconnettono in continuazione. Sono più i periodi in cui sono sconnesse

Use English please

djeghe commented 10 months ago

Anche io stesso problema. Le entità di connettono e sconnettono in continuazione. Sono più i periodi in cui sono sconnesse

Use English please

ok. I have the same problem. Entities continue to connect and deconnect. Every 5 minutes I have a minute of connection and 4 of not connection.

Riccardo

MortyFleem commented 10 months ago

Same problem. Cycling between 'Unavailable' and working, But mostly 'unavaiilable'.

tfelton0350 commented 10 months ago

Having a similar issue. Blink available for 1-2 minutes then unavailable for 5-6 minutes. All day yesterday and today since update to 2024.1.2. Other info: Supervisor 2023.12.0, Operating system: 11.3, Frontend 20240104.0. Also, if this helps. If I unplug the sync 2 module, HA communicates with the cameras fine.

Truepix commented 10 months ago

Same for me, available and unavailable ... Thank you for your help in advance. I'll wait for a fix.

Latulippe9 commented 10 months ago

Same for me, available for 10 minutes then unavailable. Core 2024.1.2

KiraPC commented 10 months ago

I Guess something is happening on the blink server. Do you receive the push notification on Motion detection?

tfelton0350 commented 10 months ago

KiraPC. I don't have push notifications set up for motion. But I checked logs and when available motion is detected. But not while unavailable.

dchilton6 commented 10 months ago

Same issue here. UK cycling every 4 or 5 mins. hitting reload in integration seems to load and show entities but then goes unavailable 4 mins later.

smacpi commented 10 months ago

Same here cycling as available every 5mins