From be33beb72d52813f77fc86008f9e988a02aa374c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sun, 13 Jan 2019 20:15:28 +0100 Subject: [PATCH] Add set positions to baby monitor --- lovelace/cameras/barnrum.yaml | 33 +++++++++++++++++++++++++++++---- packages/cameras.yaml | 7 +++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/lovelace/cameras/barnrum.yaml b/lovelace/cameras/barnrum.yaml index 1da81a0..0ecebd6 100644 --- a/lovelace/cameras/barnrum.yaml +++ b/lovelace/cameras/barnrum.yaml @@ -19,7 +19,7 @@ elements: entity_id: {{ entity }} dir: left style: - left: 10% + left: 30px top: 50% color: yellow @@ -32,7 +32,7 @@ elements: entity_id: {{ entity }} dir: right style: - left: 90% + right: 6px top: 50% color: yellow @@ -46,7 +46,7 @@ elements: dir: up style: left: 50% - top: 10% + top: 30px color: yellow - type: icon @@ -59,5 +59,30 @@ elements: dir: down style: left: 50% - top: 90% + bottom: 6px color: yellow + + - type: icon + icon: mdi:numeric-1-box-outline + tap_action: + action: call-service + service: rest_command.camera_position + service_data: + entity_id: camera.barnrum + position: 0 + style: + left: 30px + bottom: 0px + color: blue + - type: icon + icon: mdi:numeric-2-box-outline + tap_action: + action: call-service + service: rest_command.camera_position + service_data: + entity_id: camera.barnrum + position: 1 + style: + left: 66px + bottom: 0px + color: green diff --git a/packages/cameras.yaml b/packages/cameras.yaml index 412e035..3b31e56 100644 --- a/packages/cameras.yaml +++ b/packages/cameras.yaml @@ -10,6 +10,7 @@ homeassistant: <<: *common camera.barnrum: <<: *common + host: !secret camera_barnrum_host switch.barnrum_ptz_left: <<: *common @@ -74,3 +75,9 @@ script: - 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