-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautomation_telegram_command_camera_still.yaml
executable file
·75 lines (68 loc) · 2.46 KB
/
automation_telegram_command_camera_still.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
automation:
- id: telegram_callback_camera_still
alias: 'Show a camera still'
description: >
Show a camera still
trigger:
- platform: event
event_type: telegram_callback
event_data:
command: '/still_drive'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_patio'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_bins'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_gazebo'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_hall'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_lounge'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_kitchen'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_kitchen_2'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_landing'
- platform: event
event_type: telegram_callback
event_data:
command: '/still_bar'
variables:
pic_file: "{{ trigger.event.data.command[7:] + '_' + now().strftime('%d%m%y%H%M%S') }}"
action:
- service: camera.snapshot
target:
entity_id: "camera.{{ trigger.event.data.command[7:]}}"
data:
filename: "/config/www/cam_snaps/{{ pic_file }}.jpg"
- service: telegram_bot.send_photo
data:
file: "/config/www/cam_snaps/{{ pic_file }}.jpg"
caption: "{{ trigger.event.data.command[7:]}} @ {{ now().strftime('%H:%M:%S') }}"
target: "{{trigger.event.data.chat_id}}"
- service: telegram_bot.answer_callback_query
data:
message: "{{ trigger.event.data.command[7:]}} @ {{ now().strftime('%H:%M:%S') }}"
callback_query_id: '{{ trigger.event.data.id }}'
- service: telegram_bot.edit_replymarkup
data:
message_id: "{{ trigger.event.data.message.message_id }}"
chat_id: "{{ trigger.event.data.chat_id }}"
inline_keyboard: []