@naitsimp wrote:
Hi,
I am trying to record a video from my hacked dafang camera and send it with Telegram.
The video gets recorded and saved but it never gets send because the video file only gets created after the recording is done and even than it takes around 1 second per recorded second to build up the file (the file gets bigger and bigger till it’s saved completely).This is my automation:
- alias: notify_1_dafang_1_get_current_video initial_state: true trigger: - platform: event event_type: telegram_callback event_data: command: '/dafang_1_get_video' action: - service: notify.notify_1 data_template: title: "VIDEO Recording is in Progress" message: "{{now().strftime('%Y-%m-%d %H:%M:%S')}}" - service: camera.record data_template: entity_id: camera.dafang_1_generic filename: '/config/www/dafang_1/test.mp4' duration: '{{trigger.event.data.args[1] | int}}' lookback: '{{trigger.event.data.args[0] | int}}' - service: notify.notify_1 data_template: message: "Front Door Video from Door open" data: video: file: "/config/www/dafang_1/test.mp4" caption: "{{now().strftime('%Y-%m-%d %H:%M:%S')}}" inline_keyboard: - 'Vid 5::/dafang_1_get_video 5 30, 5 30:/dafang_1_get_video 5 30, 5 60:/dafang_1_get_video 5 60, 5 120:/dafang_1_get_video 5 120' - 'Vid 10::/dafang_1_get_video 10 30,10 30:/dafang_1_get_video 10 30, 10 60:/dafang_1_get_video 10 60, 10 120:/dafang_1_get_video 10 120' - 'Home:/home'
I get this error:
2020-03-19 22:45:12 ERROR (SyncWorker_3) [homeassistant.components.telegram_bot] Can't load data into ByteIO: [Errno 2] No such file or directory: '/config/www/dafang_1/test.mp4' 2020-03-19 22:45:12 ERROR (SyncWorker_3) [homeassistant.components.telegram_bot] Can't send file with kwargs: {'message': 'Front Door Video from Door open', 'inline_keyboard': ['Vid 5::/dafang_1_get_video 5 30, 5 30:/dafang_1_get_video 5 30, 5 60:/dafang_1_get_video 5 60, 5 120:/dafang_1_get_video 5 120', 'Vid 10::/dafang_1_get_video 10 30,10 30:/dafang_1_get_video 10 30, 10 60:/dafang_1_get_video 10 60, 10 120:/dafang_1_get_video 10 120', 'Home:/home'], 'file': '/config/www/dafang_1/test.mp4', 'caption': '2020-03-19 22:45:12'}
I also tried to split the automation into two:
- records the video
- triggered with folder_watcher to send the video: Here I have the same problem because it triggers the second the file gets created, but it isn’t created completely.
I know I can use a delay between the recording and the sending but I record videos with variable lengths and would like a solution without a delay. I would like to give the video the current time as a filename and if I do so I have no chance to get the filename in order to send it.
Anyone has an idea how this is possible?
Posts: 1
Participants: 1