AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.45k stars 171 forks source link

PTZ control throws error #433

Closed baurmatt closed 1 year ago

baurmatt commented 1 year ago

Hey,

I've got a Amcrest IP2M-841 and use the following lovelace card configuration:

  - type: custom:webrtc-camera
    entity: camera.amcrest_camera
    muted: true
    ptz:
      service: amcrest.ptz_control
      data_left:
        entity_id: camera.amcrest_camera
        pan: left
      data_right:
        entity_id: camera.amcrest_camera
        pan: right
      data_up:
        entity_id: camera.amcrest_camera
        tilt: up
      data_down:
        entity_id: camera.amcrest_camera
        tilt: down
      data_zoom_in:
        entity_id: camera.amcrest_camera
        zoom: zoom_in
      data_zoom_out:
        entity_id: camera.amcrest_camera
        zoom: zoom_out

Webcam streaming works flawlessly, only the PTZ control strikes. Clicking on any of the PTZ buttons leads to the following error message:

Failed to call service amcrest/ptz_control. extra keys not allowed @ data['pan']

I've enabled debug log of this extension, but nothing is logged.

I've confirmed that PTZ works by using the example from the integration page -> https://www.home-assistant.io/integrations/amcrest/#example-card-with-controls

Using v3.1.0 of the WebRTC custom component.

stplatt commented 1 year ago

For amcrest cameras with the amcrest integration it should look like this:

ptz:
  opacity: 0.4
  service: amcrest.ptz_control
  data_left:
    entity_id: camera.nursery
    movement: left
  data_right:
    entity_id: camera.nursery
    movement: right
  data_up:
    entity_id: camera.nursery
    movement: up
  data_down:
    entity_id: camera.nursery
    movement: down
  data_zoom_in:
    entity_id: camera.nursery
    movement: zoom_in
  data_zoom_out:
    entity_id: camera.nursery
    movement: zoom_out
baurmatt commented 1 year ago

Yep, that works! Thanks! :)

StevenTheChief commented 7 months ago

Hello, I tried this Lovelace card configuration and got the following: Service amcrest.ptz_control not found. Has anyone else experienced this?

stplatt commented 7 months ago

Hello, I tried this Lovelace card configuration and got the following: Service amcrest.ptz_control not found. Has anyone else experienced this?

This only works for cameras with the Amcrest integration ( https://www.home-assistant.io/integrations/amcrest/ ). Do you have the Amcrest integration set up in your home assistant config.yaml?