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

Verisure Capture Cam is not working #90534

Open
maol01 opened this issue Mar 30, 2023 · 30 comments
Open

Verisure Capture Cam is not working #90534

maol01 opened this issue Mar 30, 2023 · 30 comments
Assignees
Milestone

Comments

@maol01
Copy link

maol01 commented Mar 30, 2023

The problem

Logger: homeassistant.components.websocket_api.http.connection
Source: components/verisure/coordinator.py:156
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:51:31 (4 occurrences)
Last logged: 18:10:52

[140548659899664] 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 809, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/verisure/camera.py", line 139, in capture_smartcam
self.coordinator.smartcam_capture(self.serial_number)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 190, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/verisure/coordinator.py", line 156, in smartcam_capture
.get("requestId")
AttributeError: 'NoneType' object has no attribute 'get'

What version of Home Assistant Core has the issue?

2023.4.0b0

What was the last working version of Home Assistant Core?

core-2023.4.0b0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Stopped working after the last Connection issue of the Verisure Integration

@home-assistant
Copy link

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

Code owner commands

Code owners of verisure 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 verisure Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


verisure documentation
verisure source
(message by IssueLinks)

@frenck
Copy link
Member

frenck commented Apr 4, 2023

@niro1987 Do you have an idea?

@niro1987
Copy link
Contributor

niro1987 commented Apr 4, 2023

I was able to reproduce the error with these steps:

  1. Setup Verisure component on a MyPages user with Minimal permissions.
  2. Call the verisure.capture_smartcam service on a Verisure Camera entity.

Later, I will try the same on a MyPages user with a higher permission level, to see if that makes any difference.

@niro1987
Copy link
Contributor

niro1987 commented Apr 5, 2023

Only the admin user can capture new camera snapshots.

@mangan01
Copy link

mangan01 commented Apr 6, 2023

My admin utser can not capture new Camera snapshots

@maan79
Copy link

maan79 commented Apr 6, 2023

I am the admin user and still have same issue.

@niro1987
Copy link
Contributor

niro1987 commented Apr 6, 2023

@persandstrom can you assist?

@persandstrom
Copy link
Contributor

Can you capture from the mobile app?

@henriklundqvist
Copy link

i can with the same user take capture from verisures app but not from HA

@persandstrom
Copy link
Contributor

I would suggest you to try the python-verisure CLI to see if we can get some clues.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@henriklundqvist
Copy link

Hello, the issue still persists unfortunately (Core 2023.7.1)

@github-actions github-actions bot removed the stale label Jul 10, 2023
@niro1987
Copy link
Contributor

#90534 (comment)
Did anyone try the python-verisure CLI to see if we can get some clues?

@Fjury
Copy link

Fjury commented Jul 30, 2023

#90534 (comment) Did anyone try the python-verisure CLI to see if we can get some clues?

@niro1987 python-verisure works with the same verisure account credentials like used in HA. Also with the verisure iOS App I am able to take pictures.

@Fjury
Copy link

Fjury commented Jul 30, 2023

I see, @joostlek make same small changes in camera.py in the dev build.
I used the new version from dev build as custom_component add version to manifest and restart ha. The symbol on the devices page changed, but the log is nearly the same.

python-verisure and the iOS App are working with the same user credentials.

Attached you can find the anonymized version of my log - while Verisure integration is in Debug Mode.

Let me know if I can provide any more information to solve this problem.

home-assistant_2023-07-30T15-12-23.929Z.log

Home Assistant 2023.7.3
Supervisor 2023.07.1
OS 10.3
on RPi4

@joostlek
Copy link
Member

FYI, my change was only removing a warning by explicitly saying that the entity name of some entities is the same as the device name. No logic changes

@niro1987
Copy link
Contributor

#90534 (comment) Did anyone try the python-verisure CLI to see if we can get some clues?

@niro1987 python-verisure works with the same verisure account credentials like used in HA. Also with the verisure iOS App I am able to take pictures.

The reason to try the python-verisure package directly, is to see if there is any useful information in the request/response cycle. Perhaps there are different types of cameras, that should be addressed in different ways.

@niro1987
Copy link
Contributor

Camera capture does work for me, I have this model camera.

image

@niro1987
Copy link
Contributor

WIthout any feedback, there isn't anything we can do for you

@rasmusbe
Copy link
Contributor

rasmusbe commented Sep 3, 2023

I'm having the same problem with my new camera detector https://publish-p28054-e86343.adobeaemcloud.com/content/dam/verisure/media/global/devices/CAMERAPIR_GEN_3.png/jcr:content/renditions/medium-240.png

I'll try the cli later today or tomorrow but wanted to keep this issue alive until I'm able to test it 😊

@rasmusbe
Copy link
Contributor

rasmusbe commented Sep 3, 2023

The service fails when I call service: verisure.capture_smartcam and I also noticed that I can not see any last image on my camera devices.

And here is some logs:

Here is my HA log for Verisure with debug-logging active when calling the service from Developer tools
2023-09-03 12:51:57.020 DEBUG (MainThread) [homeassistant.components.verisure] Finished fetching verisure data in 1.225 seconds (success: True)
2023-09-03 12:52:53.324 DEBUG (SyncWorker_0) [homeassistant.components.verisure] No image to display
2023-09-03 12:52:53.627 DEBUG (SyncWorker_1) [homeassistant.components.verisure] Download new image 9395775875548228647
2023-09-03 12:52:53.830 DEBUG (SyncWorker_1) [homeassistant.components.verisure] Old image_id=None
2023-09-03 12:52:53.834 DEBUG (SyncWorker_1) [homeassistant.components.verisure] Trying to open /config/9395775875548228647.jpg
2023-09-03 12:52:57.241 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 828, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/verisure/camera.py", line 140, in capture_smartcam
    self.coordinator.smartcam_capture(self.serial_number)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/verisure/coordinator.py", line 149, in smartcam_capture
    .get("requestId")
     ^^^
AttributeError: 'NoneType' object has no attribute 'get'
2023-09-03 12:52:57.275 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140527649889984] Error handling message: Unknown error (unknown_error) Rasmus from 185.113.98.117 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 716, in handle_execute_script
    response = await script_obj.async_run(msg.get("variables"), context=context)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1569, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 828, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/verisure/camera.py", line 140, in capture_smartcam
    self.coordinator.smartcam_capture(self.serial_number)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/verisure/coordinator.py", line 149, in smartcam_capture
    .get("requestId")
     ^^^
AttributeError: 'NoneType' object has no attribute 'get'
2023-09-03 12:52:58.697 DEBUG (MainThread) [homeassistant.components.verisure] Finished fetching verisure data in 1.235 seconds (success: True)

Response when running `python -m verisure --cameras` (some values redacted)
{
    "data": {
        "installation": {
            "cameras": [
                {
                    "visibleOnCard": false,
                    "initiallyConfigured": true,
                    "imageCaptureAllowed": "ALWAYS",
                    "imageCaptureAllowedByArmstate": null,
                    "device": {
                        "deviceLabel": "REDACTED",
                        "area": "Vardagsrum",
                        "__typename": "Device"
                    },
                    "latestCameraSeries": {
                        "image": [
                            {
                                "imageId": "9395775875548228650",
                                "imageStatus": "COMPLETED",
                                "captureTime": "2023-09-03T03:18:29.000Z",
                                "url": "https://e-api02.verisure.com/xbn/2/installation/REDACTED/device/REDACTED/customerimagecamera/image/9395775875548228650"
                            }
                        ]
                    }
                },
                {
                    "visibleOnCard": false,
                    "initiallyConfigured": true,
                    "imageCaptureAllowed": "ALWAYS",
                    "imageCaptureAllowedByArmstate": null,
                    "device": {
                        "deviceLabel": "ABCD 1234",
                        "area": "Hall",
                        "__typename": "Device"
                    },
                    "latestCameraSeries": {
                        "image": [
                            {
                                "imageId": "9395775875548228647",
                                "imageStatus": "COMPLETED",
                                "captureTime": "2023-09-03T03:18:27.000Z",
                                "url": "https://e-api02.verisure.com/xbn/2/installation/REDACTED/device/ABCD%201234/customerimagecamera/image/9395775875548228647"
                            }
                        ]
                    }
                }
            ]
        }
    }
}
Response when running `python -m verisure --camera-get-request-id "ABCD 1234"` (but with my own deviceLabel)
{
    "errors": [
        {
            "message": "Request Failed",
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "ContentProviderCaptureImageRequest"
            ],
            "data": {
                "status": 400,
                "logTraceId": "67a93d52-2984-458c-8387-3abf41d68b8a",
                "errorCode": "CCCP_DEVICE_NOT_CLAIMED",
                "errorMessage": "Device not claimed"
            }
        }
    ],
    "data": {
        "ContentProviderCaptureImageRequest": null
    }
}

So my guess is that there is something broken with the camera-get-request-id method

@rasmusbe
Copy link
Contributor

rasmusbe commented Sep 3, 2023

I have recorded the traffic from the Verisure app, here is the request as it looks like (variable values replaced)

URL: https://m-api02.verisure.com/graphql
Request:

[{
	"query": "mutation CaptureImageRequest($giid: String!, $deviceLabel: String!, $deviceIdentifier: String) {\n  CameraRequestImageCapture(giid: $giid, deviceLabel: $deviceLabel, deviceIdentifier: $deviceIdentifier) {\n    requestId\n  }\n}",
	"variables": {
		"giid": "1234567890",
		"deviceLabel": "ABCD 1234",
		"deviceIdentifier": "iPhone a344052b-b425-4d25-96fe-04d62d4bda8f"
	},
	"operationName": "CaptureImageRequest"
}]

Response:

{
	"data": {
		"CameraRequestImageCapture": {
			"requestId": "12345678"
		}
	}
}

@Fjury
Copy link

Fjury commented Sep 3, 2023

WIthout any feedback, there isn't anything we can do for you

Hi @niro1987
hopefully you can find the missing needle in that heap used the iphone versiure app.

currently python-verisure is also not working for me.

https://pastebin.com/AhWM4yS0

@niro1987
Copy link
Contributor

niro1987 commented Sep 5, 2023

The python-verisure package sends a different request then stated above. I believe it should be updated to support the various camera type.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@rasmusbe
Copy link
Contributor

rasmusbe commented Dec 5, 2023

Still an issue

@github-actions github-actions bot removed the stale label Dec 5, 2023
@Fjury
Copy link

Fjury commented Feb 25, 2024

Still the same issue.

@niro1987 I have this model, and this worked in the end of 2022 with this integration.
Last year on 3. september I send a lot of information. Please let me know, if you need anything else.

image

@mangan01
Copy link

mangan01 commented Feb 25, 2024 via email

@niro1987
Copy link
Contributor

Sorry, I can't help. I no longer have a Verisure subscription. I have removed myself as code-owner.

@niro1987
Copy link
Contributor

Firstly, the device has to be supported by https://github.com/persandstrom/python-verisure, only then HomeAssistant can follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants