iMicknl / ha-nest-protect

Nest Protect integration for Home Assistant. This will allow you to integrate your smoke, heat, co and occupancy status real-time in HA.
MIT License
338 stars 64 forks source link

pynest exception #345

Open Zaleo80 opened 3 months ago

Zaleo80 commented 3 months ago

The problem

image

What version of this integration (ha-nest-protect) has the issue?

0.4.0b5

What version of Home Assistant Core has the issue?

2024.7.3

Device / Model

Battery

Diagnostics information

I have no real issues, just found the error in the logging with the question to report it on GitHub, here it is.

Home Assistant log

Logs ``` Traceback (most recent call last): File "/config/custom_components/nest_protect/__init__.py", line 208, in _async_subscribe_for_data dict(b, **buckets.get(b.object_key, {})) for b in [data.updated_buckets] ^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'object_key' ```

Additional information

Not sure if this is related, but after making a backup I get the message there is an error. Then in the logging I stumbled onto this message. Following the onscreen instruction I created this bug report.

iSteve-O commented 2 months ago

I came to report this same issue.

Matsuo3rd commented 1 month ago

Error spawns every hour under 0.4.0b6

2024-09-30 12:25:28.886 ERROR (MainThread) [custom_components.nest_protect] Unknown pynest exception. Please create an issue on GitHub with your logfile. Updates paused for 1 minute.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 317, in subscribe_for_data
    result = await response.json()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/aiohttp_client.py", line 80, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1199, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: text/plain', url='https://czfe28-front01-iad01.transport.home.nest.com/v6/subscribe'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/__init__.py", line 169, in _async_subscribe_for_data
    result = await entry_data.client.subscribe_for_data(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 321, in subscribe_for_data
    raise PynestException(
custom_components.nest_protect.pynest.exceptions.PynestException: 200 error while subscribing - 
2024-09-30 13:26:31.987 ERROR (MainThread) [custom_components.nest_protect] Unknown pynest exception. Please create an issue on GitHub with your logfile. Updates paused for 1 minute.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 317, in subscribe_for_data
    result = await response.json()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/aiohttp_client.py", line 80, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1199, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: text/plain', url='https://czfe28-front01-iad01.transport.home.nest.com/v6/subscribe'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/__init__.py", line 169, in _async_subscribe_for_data
    result = await entry_data.client.subscribe_for_data(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 321, in subscribe_for_data
    raise PynestException(
custom_components.nest_protect.pynest.exceptions.PynestException: 200 error while subscribing - 
2024-09-30 14:27:35.227 ERROR (MainThread) [custom_components.nest_protect] Unknown pynest exception. Please create an issue on GitHub with your logfile. Updates paused for 1 minute.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 317, in subscribe_for_data
    result = await response.json()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/aiohttp_client.py", line 80, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1199, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: text/plain', url='https://czfe28-front01-iad01.transport.home.nest.com/v6/subscribe'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/__init__.py", line 169, in _async_subscribe_for_data
    result = await entry_data.client.subscribe_for_data(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/nest_protect/pynest/client.py", line 321, in subscribe_for_data
    raise PynestException(
custom_components.nest_protect.pynest.exceptions.PynestException: 200 error while subscribing -
bpanucci commented 6 days ago

I observed the same error message. Would be nice to know if it is something serious, because I have some smoke detectors running. They should work in case of fire.

iMicknl commented 5 days ago

@bpanucci your smoke detectors will still work, however if there is an issue between the communication of Nest server and this integration, you might not be notified via Home Assistant. But to reassure you, the normal Nest Protect functionality will never be impacted by any 3rd party integration.