summaryrefslogtreecommitdiffstats
path: root/blueprints/script/camera
diff options
context:
space:
mode:
authorroot <root@smartpi.suren.me>2023-01-10 07:45:02 +0400
committerroot <root@smartpi.suren.me>2023-01-10 07:45:02 +0400
commit2c0c331eb7b7a03152309bbbd4e0fee157e8d86c (patch)
tree03391160212b39c4597ecc26010f2ba1235a65e3 /blueprints/script/camera
downloadhass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.gz
hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.bz2
hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.xz
hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.zip
Initial configuration
Diffstat (limited to 'blueprints/script/camera')
-rw-r--r--blueprints/script/camera/security_camera.yaml142
-rw-r--r--blueprints/script/camera/send_photo.yaml37
2 files changed, 179 insertions, 0 deletions
diff --git a/blueprints/script/camera/security_camera.yaml b/blueprints/script/camera/security_camera.yaml
new file mode 100644
index 0000000..0430266
--- /dev/null
+++ b/blueprints/script/camera/security_camera.yaml
@@ -0,0 +1,142 @@
+blueprint:
+ name: Security Camera Streamer
+ description: Stream photos from security camera
+ domain: script
+ input:
+ camera:
+ name: Camera
+ description: Camera
+ default: camera.192_168_50_51
+ selector:
+ entity:
+ domain: camera
+ motion_sensor:
+ name: Motion Sensor
+ description: Sensor detecting if there are motions to trigger the camera
+ selector:
+ entity:
+ domain: binary_sensor
+ device_class: motion
+ host:
+ name: Host
+ description: Host running camera server
+ default: http://127.0.0.1:8123
+ caption:
+ name: Caption
+ description: Caption to send in telegram message
+ default: 'Intusion Alert: '
+ lights_on:
+ name: Lights On
+ description: List of lights to turn on
+ default: []
+ selector:
+ entity:
+ multiple: true
+ domain: [light, switch]
+ lights_off:
+ name: Lights Off
+ description: List of lights to turn off
+ default: []
+ selector:
+ entity:
+ multiple: true
+ domain: [light, switch]
+ prepare:
+ name: prepare
+ description: Actions to perform before shooting photos
+ default: []
+ selector:
+ action:
+ delay:
+ name: Delay
+ description: Delay between shots (seconds)
+ default: 5
+ selector:
+ number:
+ min: 1
+ max: 3600
+ unit_of_measurement: s
+ fast_shots:
+ name: Fast Shots
+ description: Number of initial shots with short delay
+ default: 10
+ selector:
+ number:
+ min: 0
+ max: 50
+ fast_delay:
+ name: Fast Delay
+ description: Delay between fast shots (milliseconds)
+ default: 1000
+ selector:
+ number:
+ min: 100
+ max: 10000
+ unit_of_measurement: ms
+
+variables:
+ camera: !input camera
+ smartpi: !input host
+ caption: !input caption
+ delay: !input delay
+ fast_shots: !input fast_shots
+ fast_delay: !input fast_delay
+
+mode: restart
+sequence:
+ - parallel:
+ - service: homeassistant.turn_on
+ target:
+ entity_id: !input lights_on
+ - service: homeassistant.turn_off
+ target:
+ entity_id: !input lights_off
+ - choose: []
+ default: !input "prepare"
+ - sequence:
+ - service: telegram_bot.send_photo
+ data:
+ disable_notification: false
+ caption: '{{ caption }} at {{ states("sensor.date_time_iso")
+ }}'
+ url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
+ - repeat:
+ while:
+ - condition: template
+ value_template: '{{ repeat.index < fast_shots }}'
+ sequence:
+ - service: telegram_bot.send_photo
+ data:
+ disable_notification: true
+ caption: '{{ caption }} {{ repeat.index }} (fast)'
+ url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
+ - delay:
+ hours: 0
+ minutes: 0
+ seconds: 0
+ milliseconds: '{{ fast_delay }}'
+ - repeat:
+# About 30 seconds delay before occupancy clears (both ways via state or device)
+ until:
+ - condition: state
+ entity_id: !input motion_sensor
+ state: 'off'
+# for:
+# seconds: 2
+# - type: is_no_motion
+# condition: device
+# device_id: 6deb0a6fb7a4a849ba22afc166cf9919
+# device_id: '{{ device_id("binary_sensor.0x00158d0004485e0b_occupancy") }}'
+# entity_id: binary_sensor.0x00158d0004485e0b_occupancy
+# domain: binary_sensor
+ sequence:
+ - service: telegram_bot.send_photo
+ data:
+ disable_notification: true
+ caption: '{{ caption }} {{ repeat.index + fast_shots - 1 }}'
+ url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
+ - delay:
+ hours: 0
+ minutes: 0
+ seconds: '{{ delay }}'
+ milliseconds: 0
diff --git a/blueprints/script/camera/send_photo.yaml b/blueprints/script/camera/send_photo.yaml
new file mode 100644
index 0000000..2b14639
--- /dev/null
+++ b/blueprints/script/camera/send_photo.yaml
@@ -0,0 +1,37 @@
+blueprint:
+ name: Send Photo
+ description: Send a single photo from the camera
+ domain: script
+ input:
+ camera:
+ name: Camera
+ description: Camera
+ default: camera.192_168_50_51
+ selector:
+ entity:
+ domain: camera
+ host:
+ name: Host
+ description: Host running camera server
+ default: http://127.0.0.1:8123
+ caption:
+ name: Caption
+ description: Caption to send in telegram message
+ default: ''
+
+variables:
+ camera: !input camera
+ smartpi: !input host
+ caption: !input caption
+# caption: AubergineView
+# delay: 5
+# fast_shots: 15
+# fast_delay: 1000
+
+mode: single
+sequence:
+ - service: telegram_bot.send_photo
+ data:
+ disable_notification: false
+ caption: '{{ caption }} at {{ states("sensor.date_time_iso") }}'
+ url: '{{ smartpi + state_attr(camera, "entity_picture") }}'