-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathha_config.yaml
96 lines (88 loc) · 2.72 KB
/
ha_config.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
## Telegram Voice / Audio
##################################################
## Sensors
##################################################
sensor:
- platform: mqtt
name: "telegram_msg_new"
state_topic: "telebot"
value_template: '{{ value_json.new }}'
- platform: mqtt
name: "telegram_msg_type"
state_topic: "telebot"
value_template: '{{ value_json.type }}'
- platform: mqtt
name: "telegram_msg_user"
state_topic: "telebot"
value_template: '{{ value_json.user }}'
- platform: mqtt
name: "telegram_msg_content"
state_topic: "telebot"
value_template: '{{ value_json.content }}'
- platform: mqtt
name: "telegram_msg_duration"
state_topic: "telebot"
value_template: '{{ value_json.duration }}'
##################################################
## Automations
##################################################
automation:
- alias: Play Telegram Voice Message on Kodi
trigger:
platform: state
entity_id: sensor.telegram_msg_new
to: "true"
condition:
- condition: state
entity_id: sensor.telegram_msg_type
state: 'voice'
action:
- service: media_player.play_media
data:
entity_id: media_player.kodi
media_content_type: audio
data_template:
media_content_id: >
{{states('sensor.telegram_msg_content')}}
##################################################
## Automation made for a yamaha reciever
##################################################
- alias: Play Telegram Voice Message on Kodi
trigger:
platform: state
entity_id: sensor.telegram_msg_new
to: "true"
condition:
- condition: state
entity_id: sensor.telegram_msg_type
state: 'voice'
action:
- variables:
time: "{{ int(states('sensor.telegram_msg_duration')) }}"
file: "{{states('sensor.telegram_msg_content')}}"
- service: scene.create
data:
scene_id: amplisalon_voice_revert
snapshot_entities: media_player.yamaha_reciever
- service: media_player.turn_on
target:
entity_id: media_player.yamaha_reciever
- delay: 8
- service: media_player.play_media
data:
entity_id: media_player.yamaha_reciever
#media_content_type: audio
media_content_type: music
data_template:
media_content_id: >
{{ file }}
- service: media_player.volume_set
data:
volume_level: 0.60
target:
entity_id: media_player.yamaha_reciever
- delay: "{{ time }}"
- delay: 2
- service: scene.turn_on
data:
entity_id: scene.amplisalon_voice_revert