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.35k stars 161 forks source link

Uncaught TypeError: Cannot read property 'callService' of undefined #90

Open gomble opened 3 years ago

gomble commented 3 years ago

If i add onvif ptz i get the following error if i click left right etc.:

Logger: frontend.js.latest.202106030
Source: components/system_log/__init__.py:190
First occurred: 11:54:32 (14 occurrences)
Last logged: 11:59:29

https://---:8123/webrtc/webrtc-camera.js?v2.0.2:332:22 Uncaught TypeError: Cannot read property 'callService' of undefined

my card:

type: custom:webrtc-camera
url: ---
ui: true
background: true
ptz:
  service: onvif.ptz
  data_left:
    entity_id: camera.onvif_camera_profile_001
    pan: LEFT
  data_right:
    entity_id: camera.onvif_camera_profile_001
    pan: RIGHT
  data_up:
    entity_id: camera.onvif_camera_profile_001
    tilt: UP
  data_down:
    entity_id: camera.onvif_camera_profile_001
    tilt: DOWN
  data_zoom_in:
    entity_id: camera.onvif_camera_profile_001
    zoom: ZOOM_IN
  data_zoom_out:
    entity_id: camera.onvif_camera_profile_001
    zoom: ZOOM_OUT

PTZ works with manual service call like this:

   tap_action:
      action: call-service
      service: onvif.ptz
      service_data:
        entity_id: camera.onvif_camera_profile_001
        pan: RIGHT
        distance: 0.41
        speed: 0.5
        continuous_duration: 0.5
        move_mode: ContinuousMove
gomble commented 3 years ago
type: custom:webrtc-camera
url: ---
background: true
ptz:
  service: onvif.ptz
  data_left:
    entity_id: camera.onvif_camera_profile_001
    pan: LEFT
    speed: 1
    distance: 0.41
    move_mode: ContinuousMove
  data_right:
    entity_id: camera.onvif_camera_profile_001
    pan: RIGHT
    speed: 1
    distance: 0.41
    move_mode: ContinuousMove
  data_up:
    entity_id: camera.onvif_camera_profile_001
    tilt: UP
    speed: 1
    distance: 0.41
    move_mode: ContinuousMove
  data_down:
    entity_id: camera.onvif_camera_profile_001
    tilt: DOWN
    speed: 1
    distance: 0.41
    move_mode: ContinuousMove
  data_zoom_in:
    entity_id: camera.onvif_camera_profile_001
    distance: 0.41
    speed: 0.5
    continuous_duration: 0.5
    move_mode: ContinuousMove
    zoom: ZOOM_IN
  data_zoom_out:
    entity_id: camera.onvif_camera_profile_001
    distance: 0.41
    speed: 0.5
    continuous_duration: 0.5
    move_mode: ContinuousMove
    zoom: ZOOM_OUT

this worked now, you should update your wiki/documentation

hairypotta commented 3 years ago

@gomble I have the exact same issue, but your .yaml file doesn't solve the problem in my case. Could you tell me what exactly you have changed, and how the working configuration looks like? The ptz controls were working just fine for a while, when suddenly that error appeared.

gomble commented 3 years ago

@gomble I have the exact same issue, but your .yaml file doesn't solve the problem in my case. Could you tell me what exactly you have changed, and how the working configuration looks like? The ptz controls were working just fine for a while, when suddenly that error appeared.

It worked 2-3 times, then no more. I give up and did solve another way. Created some rest scripts to move the camera.

AlexxIT commented 2 years ago

Maybe fixed by https://github.com/AlexxIT/WebRTC/pull/115

wowgamr commented 2 years ago

Yes, this fixed the problem (tested on Tapo C200).