Core: Canary Camera Not Working

Created on 13 May 2020  路  20Comments  路  Source: home-assistant/core

The problem


when using the Canary integration, everything works except the camera images do not load.

Environment

  • Home Assistant Core release with the issue: 0.109.6
  • Last working Home Assistant Core release (if known): N/A
  • Operating environment (Home Assistant/Supervised/Docker/venv): Docker on 4.19.107-Unraid
  • Integration causing this issue: Canary
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/canary/

Problem-relevant configuration.yaml

canary:
  username: !secret canary_username
  password: !secret canary_password

Traceback/Error logs

Logger: aiohttp.server
Source: components/canary/__init__.py:131
First occurred: 1:54:10 PM (2 occurrences)
Last logged: 1:54:27 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 125, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 490, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 507, in handle
    image = await camera.async_camera_image()
  File "/usr/src/homeassistant/homeassistant/components/canary/camera.py", line 87, in async_camera_image
    await self.hass.async_add_executor_job(self.renew_live_stream_session)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/canary/camera.py", line 123, in renew_live_stream_session
    self._live_stream_session = self._data.get_live_stream_session(self._device)
  File "/usr/src/homeassistant/homeassistant/components/canary/__init__.py", line 131, in get_live_stream_session
    return self._api.get_live_stream_session(device)
  File "/usr/local/lib/python3.7/site-packages/canary/api.py", line 144, in get_live_stream_session
    self._timeout)
  File "/usr/local/lib/python3.7/site-packages/canary/live_stream_api.py", line 37, in __init__
    self.login()
  File "/usr/local/lib/python3.7/site-packages/canary/live_stream_api.py", line 56, in login
    self._token = response.json()[ATTR_ACCESS_TOKEN]
KeyError: 'access_token'

Additional information

All other Canary sensors seem to work okay but the cameras do not load at all.

canary

Most helpful comment

Can confirm the same issue. I have multiple Canary Pros (aka all-in-one); temp & humidity data feeds from each device are fine, but Camera cards show nothing.

Yes I do have the camera configured per documentation

ffmpeg:

camera:
  - platform: canary

All 20 comments

canary documentation
canary source
(message by IssueLinks)

Can confirm the same issue. I have multiple Canary Pros (aka all-in-one); temp & humidity data feeds from each device are fine, but Camera cards show nothing.

Yes I do have the camera configured per documentation

ffmpeg:

camera:
  - platform: canary

Same here, sensors working. Not getting video from the camera.

same here !!

Same

same, sensors okay... no video

Also seeing the KeyError: 'access_token' in logs. Sensors available, no camera images.

I opened issue https://github.com/snjoetw/py-canary/issues/4 on the underlying API this integration uses. I tried debugging everything I could think of, but I was unable to resolve the login error. I included all relevant details in case anyone else wants to take a look.

Same issue here

Same issue

same here has been this way for quite a while.

Same

馃憤 I hope this gets fixed soon!

I'm now getting these errors spamming my logs,

2020-10-31 00:13:10 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval
    await self.async_refresh()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh
    update_callback()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 223, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 453, in state_attributes
    attrs = {"access_token": self.access_tokens[-1]}
AttributeError: 'CanaryCamera' object has no attribute 'access_tokens'

Never had this previously, but I don't use the Canary camera in HA, just the arm/disarm alarm.

I'm seeing the same issue @callifo, having updated to 0.117.x. I've taken a cut of the component from before #40691 was merged, loaded that in as a custom component and can at least get the alarm control panel back, though the camera is still broken as before. When I've got a bit more time I'll try to work out what changes to the component are needed to get it to work properly with the DataUpdateCoordinator, unless @ctalkington gets there first!

I'm seeing the same issue @callifo, having updated to 0.117.x. I've taken a cut of the component from before #40691 was merged, loaded that in as a custom component and can at least get the alarm control panel back, though the camera is still broken as before. When I've got a bit more time I'll try to work out what changes to the component are needed to get it to work properly with the DataUpdateCoordinator, unless @ctalkington gets there first!

If you just go into the camera entities and disable them and then reload, it will load the rest of the canary component normally without needing to modify HA code.

As this is still open, I will ask the question here, but is anyone else having the issue whereby everytime you restart HA, you get a new message from Canary saying 'Security alert: New login to your account'. For some reason HA now shows up as unique logins to my Canary account every reboot. My email box is full of them.

As this is still open, I will ask the question here, but is anyone else having the issue whereby everytime you restart HA, you get a new message from Canary saying 'Security alert: New login to your account'. For some reason HA now shows up as unique logins to my Canary account every reboot. My email box is full of them.

Funny you mention that, I hadn't restarted HASS in probably a few months and got the alert and changed my password thinking it wasn't me... but after seeing your message, know this is exactly what triggered that.

Yeah I'm seeing this too, I tried disabling 2FA on my account and restarting HA but that didn't do anything either

please keep issues on topic and open new issues where they make sense.

this component doesn't have an active codeowner/maintainer to field these issues so the only fixes made lately have been for compatibility with HA platform changes. This is why the camera still doesn't function properly as one would need access to a device to troubleshoot. The underlying python module that handles communication with Canary also hasn't been update in 2 years so if you know a developer who has a canary device, itd be worthwhile to recruit them to help maintain this integration

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raccettura picture raccettura  路  142Comments

gieljnssns picture gieljnssns  路  277Comments

McGiverGim picture McGiverGim  路  124Comments

neotrunks picture neotrunks  路  169Comments

kdschlosser picture kdschlosser  路  374Comments