lovelace - Camera card for baby monitor
This commit is contained in:
parent
68d533bd1c
commit
9dca6af9e7
63
lovelace/cameras/barnrum.yaml
Normal file
63
lovelace/cameras/barnrum.yaml
Normal file
@ -0,0 +1,63 @@
|
||||
{% set entity='"camera.barnrum"' %}
|
||||
type: picture-elements
|
||||
image: /local/images/placeholder-1280x720.png
|
||||
elements:
|
||||
- type: image
|
||||
camera_image: {{ entity }}
|
||||
style:
|
||||
left: 50%
|
||||
top: 50%
|
||||
height: 100%
|
||||
width: 100%
|
||||
|
||||
- type: icon
|
||||
icon: mdi:chevron-left
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: script.camera_ptz
|
||||
service_data:
|
||||
entity_id: {{ entity }}
|
||||
dir: left
|
||||
style:
|
||||
left: 10%
|
||||
top: 50%
|
||||
color: yellow
|
||||
|
||||
- type: icon
|
||||
icon: mdi:chevron-right
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: script.camera_ptz
|
||||
service_data:
|
||||
entity_id: {{ entity }}
|
||||
dir: right
|
||||
style:
|
||||
left: 90%
|
||||
top: 50%
|
||||
color: yellow
|
||||
|
||||
- type: icon
|
||||
icon: mdi:chevron-up
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: script.camera_ptz
|
||||
service_data:
|
||||
entity_id: {{ entity }}
|
||||
dir: up
|
||||
style:
|
||||
left: 50%
|
||||
top: 10%
|
||||
color: yellow
|
||||
|
||||
- type: icon
|
||||
icon: mdi:chevron-down
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: script.camera_ptz
|
||||
service_data:
|
||||
entity_id: {{ entity }}
|
||||
dir: down
|
||||
style:
|
||||
left: 50%
|
||||
top: 90%
|
||||
color: yellow
|
@ -13,6 +13,7 @@ views:
|
||||
cards:
|
||||
- !include floorplan.yaml
|
||||
- !include coffee_card.yaml
|
||||
- !include cameras/barnrum.yaml
|
||||
{{ dev_card }}
|
||||
|
||||
- title: Floorplan
|
||||
|
@ -1,26 +0,0 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
script.camera_ptz:
|
||||
package: "camera_ptz"
|
||||
|
||||
# TODO: Merge into cameras.yaml
|
||||
|
||||
# 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 }}"
|
@ -28,6 +28,9 @@ homeassistant:
|
||||
hidden: true
|
||||
icon: mdi:chevron-down
|
||||
|
||||
script.camera_ptz:
|
||||
<<: *common
|
||||
|
||||
ffmpeg:
|
||||
|
||||
camera:
|
||||
@ -52,37 +55,22 @@ camera:
|
||||
username: !secret camera_barnrum_username
|
||||
password: !secret camera_barnrum_password
|
||||
|
||||
# TODO: Move this to frontend
|
||||
switch:
|
||||
- platform: template
|
||||
switches:
|
||||
barnrum_ptz_left:
|
||||
<<: &ptz_switch
|
||||
value_template: "{{ True }}"
|
||||
turn_on:
|
||||
turn_off:
|
||||
- service: script.camera_ptz
|
||||
data:
|
||||
entity_id: camera.barnrum
|
||||
dir: left
|
||||
barnrum_ptz_right:
|
||||
<<: *ptz_switch
|
||||
turn_off:
|
||||
- service: script.camera_ptz
|
||||
data:
|
||||
entity_id: camera.barnrum
|
||||
dir: right
|
||||
barnrum_ptz_up:
|
||||
<<: *ptz_switch
|
||||
turn_off:
|
||||
- service: script.camera_ptz
|
||||
data:
|
||||
entity_id: camera.barnrum
|
||||
dir: up
|
||||
barnrum_ptz_down:
|
||||
<<: *ptz_switch
|
||||
turn_off:
|
||||
- service: script.camera_ptz
|
||||
data:
|
||||
entity_id: camera.barnrum
|
||||
dir: down
|
||||
# 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 }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user