updating configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import os
|
||||
|
||||
#
|
||||
# App to send notification when doorbell is ringing
|
||||
@@ -36,14 +37,15 @@ 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()
|
||||
self.send_video()
|
||||
result = self.send_video()
|
||||
|
||||
def send_video(self):
|
||||
def send_video(self):
|
||||
file = '/config/www/doorbell_video.mp4'
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
||||
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)
|
||||
self.timer = self.run_in(self.run_in_send_video, 20, file=file)
|
||||
|
||||
def run_in_send_video(self, args):
|
||||
extra_data = {'video': {'file': args['file'], 'caption': 'Видео звонившего.'}}
|
||||
@@ -53,4 +55,4 @@ class Doorbell(hass.Hass):
|
||||
def send_image(self):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user