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

Error service camera snapshot required width and height #86

Closed
maxoss opened this issue Sep 15, 2021 · 16 comments
Closed

Error service camera snapshot required width and height #86

maxoss opened this issue Sep 15, 2021 · 16 comments

Comments

@maxoss
Copy link

maxoss commented Sep 15, 2021

Version of the custom_component

0.9.23

Configuration

Describe the bug

When using service camera snapshot I get the an error.

Debug log

Logger: homeassistant.helpers.script.websocket_api_script
Source: components/camera/init.py:751
First occurred: 12:14:15 (1 occurrences)
Last logged: 12:14:15

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: async_camera_image() missing 2 required positional arguments: 'width' and 'height'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1492, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 751, in async_handle_snapshot_service
image = await camera.async_camera_image()
TypeError: async_camera_image() missing 2 required positional arguments: 'width' and 'height'

Logger: homeassistant.components.websocket_api.http.connection
Source: components/camera/init.py:751
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:14:15 (1 occurrences)
Last logged: 12:14:15

[547612669888] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 25, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 525, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1219, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 353, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1492, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 751, in async_handle_snapshot_service
image = await camera.async_camera_image()
TypeError: async_camera_image() missing 2 required positional arguments: 'width' and 'height'

@pepe59
Copy link

pepe59 commented Sep 16, 2021

The IPC-A26 does not take a picture. Error in log

Logger: homeassistant.components.automation.nova_automatizace_3
Source: components/camera/__init__.py:751
Integration: Automatizace (documentation, issues)
First occurred: 22:35:44 (2 occurrences)
Last logged: 22:35:44

Alarm aktivace/foto kamera: Error executing script. Unexpected error for call_service at pos 1: async_camera_image() missing 2 required positional arguments: 'width' and 'height'
While executing automation automation.nova_automatizace_3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1492, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 751, in async_handle_snapshot_service
    image = await camera.async_camera_image()
TypeError: async_camera_image() missing 2 required positional arguments: 'width' and 'height'

@JustinScott
Copy link

JustinScott commented Sep 19, 2021

A workaround for this error is to create a separate camera like this. Make sure you replace all the X's.

camera:
  - platform: generic
    name: XXX
    still_image_url: http://192.168.X.X/cgi-bin/snapshot.cgi
    stream_source: rtsp://XXX:XXX@192.168.X.X:554/cam/realmonitor?channel=1&subtype=0
    verify_ssl: false
    username: XXX
    password: XXX
    authentication: digest

@zuohaot
Copy link

zuohaot commented Sep 20, 2021

Same problem found after the latest update. It was working well in the previous release

Logger: homeassistant.components.websocket_api.http.connection
Source: components/camera/__init__.py:751
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:38:02 PM (3 occurrences)
Last logged: 9:40:48 PM

[140174619042864] async_camera_image() missing 2 required positional arguments: 'width' and 'height'
[140174501011856] async_camera_image() missing 2 required positional arguments: 'width' and 'height'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1492, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 751, in async_handle_snapshot_service
    image = await camera.async_camera_image()
TypeError: async_camera_image() missing 2 required positional arguments: 'width' and 'height'

@TheBisk
Copy link

TheBisk commented Sep 20, 2021

Same error here, started from HA version 2021.9.7.

TypeError: async_camera_image() missing 2 required positional arguments: 'width' and 'height'

@rroller
Copy link
Owner

rroller commented Sep 20, 2021

Sorry for the issues. How are you reproducing this? I'm having trouble trying to repo. Once I have a repo I can fix it rather easy.

@jgverweij
Copy link

jgverweij commented Sep 20, 2021

Sorry for the issues. How are you reproducing this? I'm having trouble trying to repo. Once I have a repo I can fix it rather easy.

Call service in action of automation:

service: camera.snapshot
target:
  entity_id: camera.dahua_sub
data:
  filename: /media/camera_snapshots/dahua.jpg

@Hrupek
Copy link

Hrupek commented Sep 22, 2021

same error for me new set up

@GeitjeG
Copy link

GeitjeG commented Sep 23, 2021

Check out here under breaking changes -> scroll down to -> custom integration: camera's
https://www.home-assistant.io/blog/2021/09/01/release-20219/#breaking-changes

I think this should be changed and it's working again?

@fokcuk
Copy link

fokcuk commented Sep 24, 2021

detailed here:
[https://github.com/home-assistant/core/pull/53835]

@theetron
Copy link

Would be nice if this can be fixed soon.

@rroller
Copy link
Owner

rroller commented Sep 24, 2021

My plan is to work on this over the weekend

@rroller
Copy link
Owner

rroller commented Sep 25, 2021

@GeitjeG Thanks for that. Now I can reproduce this. Digging deeper now for a fix.

@rroller
Copy link
Owner

rroller commented Sep 25, 2021

This should do it - 83c0930

Try 0.9.24

https://github.com/rroller/dahua/releases/tag/0.9.24

@theetron
Copy link

I can confirm the snapshot is working again with 0.9.24. Thanks!

@pansinmanteca
Copy link

it's working again. Thanks!

@GeitjeG
Copy link

GeitjeG commented Sep 26, 2021

Great, it's working again! Thanks for your efforts.

@maxoss maxoss closed this as completed Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests