-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfixed_notification_samples.yaml
123 lines (114 loc) · 4.55 KB
/
fixed_notification_samples.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Generic home assistant SCRIPT to send a fixed notification
alias: Rest fixed notification test
sequence:
- service: notify.tvoverlaysamplefixed
data:
data:
id: "fixed_notification_sample" # optional id string - if a fixed notification with this id exist, it will be updated
icon: mdi:unicorn # optional - accepts mdi icons, image urls and Bitmap encoded to Base64
textColor: "#FFF000" # optional - accepts 6 or 8 digit color hex. the '#' is optional
iconColor: "#FFF000" # optional - accepts 6 or 8 digit color hex. the '#' is optional
borderColor: "#FFF000" # optional - accepts 6 or 8 digit color hex. the '#' is optional
backgroundColor: "#FFF000" # optional - accepts 6 or 8 digit color hex. the '#' is optional
shape: "circle" # optional - values: circle, rounded, rectangular
expiration: "7m" # optional - valid formats: 1695693410 (Epoch time), 1y2w3d4h5m6s (duration format) or 123 (for seconds)
visible: true # optional - if false it deletes the fixed notification with matching id
message: "Sample" # REQUIRED: this is a required field for home assistant, but it can be 'null' if not needed
mode: single
# Use Case 1: Phone Battery mirror
alias: Phone battery Fixed Notification
trigger:
- platform: state
entity_id:
- sensor.phone_battery_level # using home assistant android app battery sensor
condition: []
action:
- service: notify.tvoverlaysamplefixed
data:
message: "{{ states.sensor.phone_battery_level.state }}%"
data:
id: "phone_battery"
expiration: "15m" #optinal, but this avoids showing outdated info if phone cannot comunicate for some reason, as leaving wifi
icon: "{{ state_attr('sensor.phone_battery_level', 'icon') }}"
mode: single
# Use Case 2: Display indicator when a light is on:
alias: Light on indicator
trigger:
- platform: state
entity_id:
- group.[all_lights] # thats a group with all home lights
condition: []
action:
- service: notify.tvoverlaysamplefixed
data:
message: "null"
data:
id: "light_indicator"
icon: mdi:lightbulb
iconColor: "#ff9800"
borderColor: "#ff9800"
shape: circle
visible: |-
{% if 'on' in trigger.to_state.state %}
true
{% else %}
false
{% endif %}
mode: single
# Use Case 3: Display indicator when a channel is online on Twitch
alias: Twitch channel indicator
trigger:
- platform: state
entity_id:
- sensor.[twitch_streamer] # to create this sensor I used https://www.home-assistant.io/integrations/twitch/
id: "true"
condition: []
action:
- service: notify.tvoverlaysamplefixed
data:
message: "null"
data:
id: "twitch_indicator"
icon: >-
https://static-cdn.jtvnw.net/jtv_user_pictures/b840f303-1c0b-461b-9a7b-6557b56d03c8-profile_image-70x70.png # url for twitch avatar
visible: |-
{% if is_state('sensor.[twitch_streamer]', 'streaming')%}
true
{% else %}
false
{% endif %}
mode: single
# Use Case 4: Display indicator for weather
alias: Weather indicator
trigger:
- platform: state
entity_id:
- weather.home
condition: []
action:
- service: notify.tvoverlaysamplefixed
data:
data:
id: fixed_weather
icon: >-
{% if is_state("weather.home","clear-day") %} mdi:weather-sunny {%
elif is_state("weather.homeweather.home","clear-night") %}
mdi:weather-night {% elif is_state("weather.home","rain") %}
mdi:weather-rainy {% elif is_state("weather.home","snow") %}
mdi:weather-snowy {% elif is_state("weather.home","fog") %}
mdi:weather-fog {% elif is_state("weather.home","sleet") %}
mdi:weather-partly-snowy-rainy {% elif
is_state("weather.home","wind") %} mdi:weather-windy {% elif
is_state("weather.home","cloudy") %} mdi:weather-cloudy {% elif
is_state("weather.home","partly-cloudy-day") %}
mdi:weather-partly-cloudy {% elif
is_state("weather.home","partly-cloudy-night") %}
mdi:weather-night-partly-cloudy {% elif
is_state("weather.home","hail") %} mdi:weather-hail {% elif
is_state("weather.home","lightning") %} mdi:weather-lightning {% elif
is_state("weather.home","thunderstorm") %}
mdi:weather-lightning-rainy {% endif %}
expiration: 12h
shape: circle
message: "{{ state_attr('weather.home', 'temperature') | round }}°"
mode: single