Onvif camera platform - How to do PTZ?

I have a Sunba 405-ECO V2 PTZ and the below has worked for me with the addition of 2 presets. A short delay as the ONVIF feed is not truly live so avoid many button pushes.

RAW configuration fro HA

title: PTZ
views:
  - title: test
    path: test
    badges: []
    cards:
      - type: picture-glance
        title: Kitchen
        image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
        entities:
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                pan: LEFT
                speed: 0.5
                distance: 0.5
                move_mode: ContinuousMove
            name: Pan Left
            show_state: false
            icon: 'mdi:arrow-left'
            show_icon: true
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                tilt: UP
                speed: 0.5
                distance: 0.5
                move_mode: ContinuousMove
            name: Pan Up
            show_state: false
            icon: 'mdi:arrow-up'
            show_icon: true
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                tilt: DOWN
                speed: 0.5
                distance: 0.5
                move_mode: ContinuousMove
            name: Pan Down
            show_state: false
            icon: 'mdi:arrow-down'
            show_icon: true
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                pan: RIGHT
                speed: 0.5
                distance: 0.5
                move_mode: ContinuousMove
            name: Pan Right
            show_state: false
            icon: 'mdi:arrow-right'
            show_icon: true
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                preset: 1
                speed: 0.5
                distance: 0.5
                move_mode: GotoPreset
            name: Preset 1
            show_state: false
            icon: 'mdi:numeric-1-box'
            show_icon: true
          - entity: camera.ptz_profile_000
            tap_action:
              action: call-service
              service: onvif.ptz
              service_data:
                entity_id: camera.ptz_profile_000
                preset: 2
                speed: 0.5
                distance: 0.5
                move_mode: GotoPreset
            name: Preset 2
            show_state: false
            icon: 'mdi:numeric-2-box'
            show_icon: true
        camera_image: camera.ptz_profile_000
        camera_view: live

4 Likes