Doorbell video

This commit is contained in:
Your Name
2019-06-06 22:18:16 +03:00
parent 88c48eab6f
commit 2407ebce76
8 changed files with 30 additions and 15 deletions
+1 -2
View File
@@ -47,6 +47,7 @@ class Climate(hass.Hass):
self.turn_off("switch.plug_158d00010dd98d")
def split_on(self, mode, temp):
self.split_state = "on"
self.turn_on("switch.plug_158d00010dd98d")
if (self.timer != None):
self.cancel_timer(self.timer)
@@ -88,14 +89,12 @@ class Climate(hass.Hass):
if nest_y1 == "on":
if self.check_door('FAN'):
return
self.split_state = "on"
self.log("Turn on split for COOLING to {}.".format(nest_target_cool))
self.split_on("COOLING", 16)
elif nest_w1 == "on":
if self.check_door('OFF'):
return
self.split_state = "on"
self.log("Turn on split for HEATING to {}".format(nest_target_hot))
self.split_on("HEATING", 28)
+15 -7
View File
@@ -19,8 +19,8 @@ class Doorbell(hass.Hass):
ringtone = 10
gw_mac = ''
def initialize(self):
if "notify" not in self.args or "sensor" not in self.args:
self.error("Please provide notify, sensor in config!")
if "notify" not in self.args or "sensor" not in self.args or "camera" not in self.args:
self.error("Please provide notify, sensor, camera in config!")
return
if "gw_mac" in self.args:
self.gw_mac = self.args['gw_mac']
@@ -36,12 +36,20 @@ class Doorbell(hass.Hass):
self.log("doorbell call")
self.call_service("xiaomi_aqara/play_ringtone", gw_mac=self.gw_mac, ringtone_id=self.ringtone, ringtone_vol=100)
self.notify("Звонок в дверь!!!", name = self.args['notify'])
for x in range(3):
self.send_image()
# for x in range(3):
self.send_image()
def send_video(self):
file = '/config/www/doorbell_video.mp4'
self.call_service("stream/record", stream_source=self.args['rtsp'], filename=file, duration=10)
self.timer = self.run_in(self.run_in_send_video, 12, file=file)
def run_in_send_video(self, args):
extra_data = {'video': {'file': args['file'], 'caption': 'Видео звонившего.'}}
self.notify("Видео звонившего", name = self.args['notify'], data=extra_data)
def send_image(self):
self.call_service("camera/snapshot", entity_id="camera.enterance", filename="/config/www/camera_image.jpg")
self.call_service("camera/snapshot", entity_id=self.args['camera'], filename="/config/www/camera_image.jpg")
extra_data = {'photo': {'file':'/config/www/camera_image.jpg', 'capture': 'Фото звонившего.'}}
self.notify("Фото звонившего", name = self.args['notify'], data=extra_data)
self.notify("Видео звонившего", name = self.args['notify'], data=extra_data)
@@ -5,6 +5,8 @@ doorbell:
module: doorbell
class: Doorbell
sensor: binary_sensor.door_window_sensor_158d0001f34374
camera: camera.entrance
rtsp: !secret rtsp_entrance
notify: telegram
gw_mac: !secret aqara1_mac
global_dependencies:
+6 -2
View File
@@ -11,8 +11,8 @@ homeassistant:
logger:
default: info
# logs:
# custom_components.yandex_smart_home: debug
logs:
custom_components.yandex_smart_home: debug
api:
@@ -33,6 +33,10 @@ config:
discovery:
system_health:
#enables video recording
stream:
# Enables support for tracking state changes over time
recorder: !include configuration/recorder.yaml
history:
+1
View File
@@ -9,6 +9,7 @@ filter:
exclude_entities:
- switch.plug_158d00020f3a29
- switch.plug_158d00026ea017
- switch.plug_158d00010dd98d
- switch.xiaomi_miio_switch
- switch.domofon_mode
- switch.domofon_open
Submodule hass/settings/custom_components/yandex_smart_home updated: 7373db4978...19b012b1bb
+1
View File
@@ -95,6 +95,7 @@ work_longitude: 1.0
syno_url: xxxxxxxxx
syno_user: xxxxxxxxx
syno_pass: xxxxxxxxx
rtsp_entrance: xxxxxxxxx
###################################
# MOSENERGO SETTINGS #
+3 -3
View File
@@ -159,9 +159,9 @@ views:
icon: mdi:cctv
cards:
- type: picture-entity
title: enterance
entity: camera.enterance
camera_image: camera.enterance
title: entrance
entity: camera.entrance
camera_image: camera.entrance
show_info: true
tap_action: dialog
- title: "Будильники"