Netatmo integration, Presence camera not working

Hi all,

I have included the Netatmo integration in my HA using the confiuration UI - which seem to work great for the indoor and outdoor modules!

However, HA is unable to detect my precense camera. I’ve tried both adding the configuration using HA cloud and the configuration.yaml option, both with the same result.
My Netatmo account is set to give HA permissions “all”. No problem viewing the videostream in the Netatmo app/webpage.

Currently running version 245 on HassOS 4.13

Anyone with the same problem or with a fix for this isue?

Br
Stian

Do you see any Netatmo related entries in the logs?

Hi, yes. There’s this one:

Logger: homeassistant
Source: components/cloud/account_link.py:146
First occurred: 24. september 2020, 11:49:03 (605 occurrences)
Last logged: 7:41:44

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/pyatmo/auth.py”, line 141, in query
rsp = self._oauth.post(url=url, data=params, timeout=timeout)
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 578, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py”, line 477, in request
url, headers, data = self._client.add_token(
File “/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py”, line 198, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py”, line 93, in async_update
await self.async_fetch_data(
File “/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py”, line 117, in async_fetch_data
self.data[data_class_entry] = await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.8/site-packages/pyatmo/home_coach.py”, line 22, in init
super(HomeCoachData, self).init(auth, url_req=_GETHOMECOACHDATA_REQ)
File “/usr/local/lib/python3.8/site-packages/pyatmo/weather_station.py”, line 30, in init
resp = self.auth.post_request(url=self.url_req)
File “/usr/local/lib/python3.8/site-packages/pyatmo/auth.py”, line 156, in post_request
resp = query(url, params, timeout, 3)
File “/usr/local/lib/python3.8/site-packages/pyatmo/auth.py”, line 150, in query
self._oauth.token = self.refresh_tokens()
File “/usr/src/homeassistant/homeassistant/components/netatmo/api.py”, line 33, in refresh_tokens
run_coroutine_threadsafe(
File “/usr/local/lib/python3.8/concurrent/futures/_base.py”, line 439, in result
return self.__get_result()
File “/usr/local/lib/python3.8/concurrent/futures/_base.py”, line 388, in __get_result
raise self._exception
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 444, in async_ensure_token_valid
new_token = await self.implementation.async_refresh_token(self.token)
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 81, in async_refresh_token
new_token = await self._async_refresh_token(token)
File “/usr/src/homeassistant/homeassistant/components/cloud/account_link.py”, line 146, in _async_refresh_token
return await account_link.async_fetch_access_token(
File “/usr/local/lib/python3.8/site-packages/hass_nabucasa/account_link.py”, line 112, in async_fetch_access_token
resp.raise_for_status()
File “/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py”, line 941, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message=‘Bad Request’, url=URL(‘https://account-link.nabucasa.com/refresh_token/netatmo’)

The first thing that I notice apart from the exceotions happening there, you have to use your own Netatmo dev account and configure that in configuration.yaml. Please remove the interation, add the config, restart HA and add the integration again using configuration.yaml.

Hi Tobi

I have been having a similar issue, the cameras have become unavailable in the integration after restarts of home assistant, uninstalling and reinstalling the integration worked the first time but now no cameras are discovered… I am using a dev account and the configuration yaml option in the integration, no web hook ban, and i have tried registering and unregistered the web hooks. Any thoughts?

Logger: homeassistant.components.camera
Source: components/netatmo/data_handler.py:117
Integration: Camera ([documentation](https://www.home-assistant.io/integrations/camera), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+camera%22))
First occurred: 11:55:58 (1 occurrences)
Last logged: 11:55:58

Error while setting up netatmo platform for camera


Traceback (most recent call last): 
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform 
    await asyncio.shield(task) 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 94, in async_setup_entry 
    async_add_entities(await get_entities(), True) 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 53, in get_entities 
    await data_handler.register_data_class( 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 149, in register_data_class 
    await self.async_fetch_data( 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 117, in async_fetch_data 
    self.data[data_class_entry] = await self.hass.async_add_executor_job( 
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run 
    result = self.fn(*self.args, **self.kwargs) 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 122, in __init__ 
    self.update_camera_urls(camera_id) 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 179, in update_camera_urls 
    self.cameras[home_id][camera_id]["local_url"] = check_url( 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 175, in check_url 
    return resp.get("local_url") 
AttributeError: 'NoneType' object has no attribute 'get'

Thanks

To make sure that you’re actually using the yaml config please remove the integration, restart HA and add the integration again.

It should look like this:

image

Hi Tobi,

I have tried re-installing the integration using configuration. Yaml options several times. However the same result unfortunately. All other devices are discovered except the camera.

I will post a copy of the error log later today.

Br
Stian

Hi,

I have the same problem. all weather-station related products are discovered fine, but my cameras are not. I’m on the latest version. I’ve switched from Synology to raspberry installation, but have the same problem. Everything else works fine

Does the integration panel also state that you’re using configuration.yaml rather than HA Cloud?

HA Cloud
image

vs.

Configuration.YAML

Hi Tobi,

Yes, I confirm that is shows configuration.yaml

mine is showing cloud

Please check your logs for Netatmo related messages (ideally turn on debug logging) to gather some insights.

As I wrote earlier, please remove the integration, restart HA and add the integration again.

Hi again,

Removed, rebooted and re installed the integration.

Logs shows the following:

Logger: homeassistant.components.camera
Source: components/netatmo/data_handler.py:117
Integration: Kamera ([documentation](https://www.home-assistant.io/integrations/camera), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+camera%22))
First occurred: 7:13:12 (1 occurrences)
Last logged: 7:13:12

Error while setting up netatmo platform for camera

Traceback (most recent call last): 
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform 
    await asyncio.shield(task) 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 94, in async_setup_entry 
    async_add_entities(await get_entities(), True) 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 53, in get_entities 
    await data_handler.register_data_class( 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 149, in register_data_class 
    await self.async_fetch_data( 
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 117, in async_fetch_data 
    self.data[data_class_entry] = await self.hass.async_add_executor_job( 
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run 
    result = self.fn(*self.args, **self.kwargs) 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 122, in __init__ 
    self.update_camera_urls(camera_id) 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 179, in update_camera_urls 
    self.cameras[home_id][camera_id]["local_url"] = check_url( 
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 175, in check_url 
    return resp.get("local_url") 
AttributeError: 'NoneType' object has no attribute 'get'

Hi Tobi

I cant really shed much light on the issue. But for me after removing the integration, updating to 0.115.4, and then preforming the reintegration of Netatmo all my devices including the cameras have come back.
I also was definitely using the configuration.yaml option as you displayed. One thing i did notice however that trying to access dev.netatmo.com over the weekend was producing a blank page. So it may have been an issue with their server as i was still receiving the webhook events from my cameras in HA.
Thanks

1 Like

I can confirm the outage of dev.netatmo.com, noticed that on Saturday IIRC.

Hello again. Some more follow up, after updating to 0.115.5 i have lost the cameras from the integration again, they where marked as orphaned.
Tried the reinstall of the component (using yaml) and only the weather station entities are discovered non of the three cameras. The debug logs dont give any indication of an issue other than no mention of cameras at all, the webhook is successfully registered, and all the weather station sensors added

2020-09-30 08:32:29 DEBUG (MainThread [homeassistant.components.netatmo.netatmo_entity_base] New client sensor.netatmo ...........

etc

Not sure what this one is but thats the only log that looks unusual:

2020-09-30 08:32:29 DEBUG (MainThread) [homeassistant.components.netatmo.data_handler] Data class HomeCoachData added

The cameras are just not being discovered. Tried creating a new app in dev.netatmo.com and the same result. All the webhook triggers from the cameras are received by HA though.

i have the same problem. deleted the integration, rebooted the server and added the integration again. all my weather station sensors are found and work fine…cameras aren’t discovered at all. no error

:point_right: Netatmo integration, Presence camera not working
Did you check that?

Yes definitely using the configuration.yaml within the integrations page.