Hi folks I have this code to control cameras…
camera_view: live
type: picture-glance
hold_action:
action: none
title: Camera 1
camera_image: camera.192_168_10_11
entities:
- entity: camera.cam_2_mainstreamprofile
icon: mdi:arrow-left-drop-circle-outline
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
pan: LEFT
move_mode: ContinuousMove
double_tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
move_mode: ContinuousMove
hold_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
pan: LEFT
move_mode: AbsoluteMove
- entity: camera.cam_1_mainstreamprofile
icon: mdi:arrow-down-drop-circle-outline
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
tilt: DOWN
move_mode: ContinuousMove
double_tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
move_mode: ContinuousMove
hold_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
tilt: DOWN
move_mode: AbsoluteMove
- entity: camera.cam_2_mainstreamprofile
icon: mdi:arrow-up-drop-circle-outline
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
tilt: UP
move_mode: ContinuousMove
double_tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
move_mode: ContinuousMove
hold_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
tilt: UP
move_mode: AbsoluteMove
- entity: camera.cam_2_mainstreamprofile
icon: mdi:arrow-right-drop-circle-outline
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
pan: RIGHT
move_mode: ContinuousMove
double_tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
move_mode: ContinuousMove
hold_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
pan: RIGHT
move_mode: AbsoluteMove
- entity: camera.cam_2_mainstreamprofile
icon: mdi:numeric-1-box
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
preset: Preset001
move_mode: GotoPreset
- entity: camera.cam_1_mainstreamprofile
icon: mdi:numeric-2-box
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
preset: Preset002
move_mode: GotoPreset
- entity: camera.cam_2_mainstreamprofile
icon: mdi:numeric-3-box
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
preset: Preset003
move_mode: GotoPreset
- entity: camera.cam_2_mainstreamprofile
icon: mdi:numeric-4-box
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
preset: Preset004
move_mode: GotoPreset
- entity: camera.cam_2_mainstreamprofile
icon: mdi:numeric-5-box
tap_action:
action: call-service
service: onvif.ptz
service_data:
entity_id: camera.cam_2_mainstreamprofile
preset: Preset005
move_mode: GotoPreset
I will be reusing the code in several cards and I wondered if there is any way to define the two entities at the top of the file and then refrence them using a common name as required.
It would make editing so much easier.
BTW the code works OK as is, bar for the iegeek cams not responding to all ONVIF commands.
That will be another thread though.
The streame is ageneric camera enhanced with WebToRTC. Testing so just using IP’s right now.
The move controls use ONVIF, hence the two entities.
Thanks for lookig,
Al