hass-config/packages/cameras.yaml

84 lines
2.2 KiB
YAML

homeassistant:
customize:
package.node_anchors:
common: &common
package: "cameras"
camera.kontor:
<<: *common
camera.vardagsrum:
<<: *common
camera.barnrum:
<<: *common
host: !secret camera_barnrum_host
switch.barnrum_ptz_left:
<<: *common
hidden: true
icon: mdi:chevron-left
switch.barnrum_ptz_right:
<<: *common
hidden: true
icon: mdi:chevron-right
switch.barnrum_ptz_up:
<<: *common
hidden: true
icon: mdi:chevron-up
switch.barnrum_ptz_down:
<<: *common
hidden: true
icon: mdi:chevron-down
script.camera_ptz:
<<: *common
ffmpeg:
camera:
- name: Kontor
platform: mjpeg
mjpeg_url: !secret camera_kontor_mjpeg
still_image_url: !secret camera_kontor_still
username: !secret camera_kontor_username
password: !secret camera_kontor_password
- name: Vardagsrum
platform: mjpeg
mjpeg_url: !secret camera_vardagsrum_mjpeg
still_image_url: !secret camera_vardagsrum_still
username: !secret camera_vardagsrum_username
password: !secret camera_vardagsrum_password
- name: Barnrum
platform: onvif
host: !secret camera_barnrum_host
port: !secret camera_barnrum_port
username: !secret camera_barnrum_username
password: !secret camera_barnrum_password
# Script to step an onvif camera in the given direction.
# Parameters:
# entity_id - camera entity
# dir - direction (left, right, up, down)
script:
camera_ptz:
sequence:
- service: camera.onvif_ptz
data_template:
entity_id: "{{ entity_id }}"
pan: >
{{ {"left":"LEFT", "right":"RIGHT", "up":"NONE", "down":"NONE"}[dir] }}
tilt: >
{{ {"left":"NONE", "right":"NONE", "up":"UP", "down":"DOWN"}[dir] }}
- delay:
milliseconds: 100
- service: camera.onvif_ptz
data_template:
entity_id: "{{ entity_id }}"
rest_command:
camera_position:
url: http://{{ state_attr(entity_id, 'host')}}/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-number={{ position }}
username: !secret camera_barnrum_username
password: !secret camera_barnrum_password