Ultima attività 1753703697

Revisione 2e5e01d22d567bf49df42ff912900e5060e808b2

YAMA.yaml Raw
1blueprint:
2 name: Yet Another Motion Automation (Custom)
3 description: "# YAMA V11\n\nTurn on lights or scenes when motion is detected optional with lumiance sensor. \nFour
4 different scenes can be defined depending on time of day.\n\nFor Details see this
5 forum post:\nhttps://community.home-assistant.io/t/yama-yet-another-motion-automation-scenes-ambient-light-and-some-conditions/257062?u=networkingcat\n\nCapabilitys:\n\n
6 - Trigger on motion (in fact can be triggered by anything that switches between
7 “on” and off\")\n - Wait time for turning off\n - Only run if entity is in desired
8 state (optional)\n - Sun elevation check (optional)\n - 4 Scenes for different
9 times of day (optional)\n - Ambient support with time frame (optional)\n - Default
10 scene when motion stops (optional)\n - “no motion blocker” with user choosable
11 state (optional)\n - As option one or more illumiance sensors can be used\n"
12 domain: automation
13 source_url: https://gist.github.com/Stephan-4711/0bd3af042ac2ed2805403749b652dfe8
14 input:
15 motion_entity:
16 name: Motion Sensor
17 description: Motion Sensor or a group with Motion Sensors (But can be anything
18 switching between "on" and "off")
19 selector:
20 entity:
21 multiple: true
22 light_target:
23 name: Light
24 selector:
25 target:
26 entity:
27 - domain:
28 - light
29 luminance_sensor:
30 name: Lux Sensor
31 description: Lux Sensor
32 selector:
33 entity:
34 luminance_required:
35 name: Required Lux Level
36 description: Lux level below which the automation will run.
37 default: 100
38 selector:
39 number:
40 min: 0.0
41 max: 10000.0
42 unit_of_measurement: lx
43 step: 1.0
44 mode: slider
45 no_motion_wait:
46 name: Wait time
47 description: Time to leave the light on after last motion is detected.
48 default: 120
49 selector:
50 number:
51 min: 0.0
52 max: 3600.0
53 unit_of_measurement: seconds
54 step: 1.0
55 mode: slider
56 automation_blocker:
57 name: Automation Blocker (Optional)
58 description: Only run if this boolean is in desired state (see next input)
59 default:
60 selector:
61 entity: {}
62 automation_blocker_boolean:
63 name: Automation Blocker Chooser (Optional)
64 description: Desired state of automation blocker, choose on for on and off for
65 off
66 default: false
67 selector:
68 boolean: {}
69 no_motion_blocker:
70 name: No Motion Blocker (Optional)
71 description: No motion sequence is not run if this boolean is in desired state
72 (see next input)
73 default:
74 selector:
75 entity: {}
76 no_motion_blocker_boolean:
77 name: No Motion Chooser (Optional)
78 description: Desired state of no motion blocker, choose on for on and off for
79 off
80 default: false
81 selector:
82 boolean: {}
83 elevation_check:
84 name: Sun elevation check (Optional)
85 description: This is the angle between the sun and the horizon. Negative values
86 mean the sun is BELOW the horizon.
87 default: none
88 selector:
89 number:
90 min: -90.0
91 max: 90.0
92 unit_of_measurement: degrees
93 step: 1.0
94 mode: slider
95 scene_ambient:
96 name: Ambient Scene (Optional)
97 description: Scene for ambient state. Will be activated when no motion is detected.
98 default: scene.none
99 selector:
100 entity:
101 domain:
102 - scene
103 multiple: false
104 time_scene_ambient_start:
105 name: Ambient time frame start (Optional)
106 description: Time from which on ambient scene will be activated
107 default: 00:00:00
108 selector:
109 time: {}
110 time_scene_ambient_end:
111 name: Ambient time frame end (Optional)
112 description: Time from which on ambient scene will be not activated
113 default: 00:00:00
114 selector:
115 time: {}
116 scene_morning:
117 name: Scene for the morning (Optional)
118 default: scene.none
119 selector:
120 entity:
121 domain:
122 - scene
123 multiple: false
124 time_scene_morning:
125 name: Time for the morning scene (Optional)
126 description: A time input which defines the time from which on the scene will
127 be activated if motion is detected.
128 default: 00:00:00
129 selector:
130 time: {}
131 scene_day:
132 name: Scene for the bright day (Optional)
133 default: scene.none
134 selector:
135 entity:
136 domain:
137 - scene
138 multiple: false
139 time_scene_day:
140 name: Time for the day scene (Optional)
141 description: A time input which defines the time from which on the scene will
142 be activated if motion is detected.
143 default: 00:00:00
144 selector:
145 time: {}
146 scene_evening:
147 name: Scene for the evening (Optional)
148 default: scene.none
149 selector:
150 entity:
151 domain:
152 - scene
153 multiple: false
154 time_scene_evening:
155 name: Time for the evening scene (Optional)
156 description: A time input which defines the time from which on the scene will
157 be activated if motion is detected.
158 default: 00:00:00
159 selector:
160 time: {}
161 scene_night:
162 name: Scene for the dark night (Optional)
163 default: scene.none
164 selector:
165 entity:
166 domain:
167 - scene
168 multiple: false
169 time_scene_night:
170 name: Time for the night scene (Optional)
171 description: A time input which defines the time from which on the scene will
172 be activated if motion is detectedd.
173 default: 00:00:00
174 selector:
175 time: {}
176 scene_no_motion:
177 name: Default scene for no motion (Optional)
178 description: Set this Scene if you want to activate a scene if motion stops
179 default: scene.none
180 selector:
181 entity:
182 domain:
183 - scene
184 multiple: false
185mode: restart
186max_exceeded: silent
187variables:
188 scene_ambient: !input scene_ambient
189 scene_morning: !input scene_morning
190 scene_day: !input scene_day
191 scene_evening: !input scene_evening
192 scene_night: !input scene_night
193 automation_blocker: !input automation_blocker
194 automation_blocker_boolean: !input automation_blocker_boolean
195 no_motion_blocker: !input no_motion_blocker
196 no_motion_blocker_boolean: !input no_motion_blocker_boolean
197 elevation_check: !input elevation_check
198 scene_no_motion: !input scene_no_motion
199 motion_entity: !input motion_entity
200 luminance_sensor: !input luminance_sensor
201 luminance_required: !input luminance_required
202trigger:
203- platform: state
204 entity_id: !input motion_entity
205 from: 'off'
206 to: 'on'
207- platform: state
208 entity_id: !input motion_entity
209 from: 'on'
210 to: 'off'
211 for: !input no_motion_wait
212condition:
213- condition: or
214 conditions:
215 - '{{ automation_blocker == none }}'
216 - '{{ automation_blocker_boolean and states[automation_blocker].state == ''off''
217 }}'
218 - '{{ not automation_blocker_boolean and states[automation_blocker].state == ''on''
219 }}'
220 - '{{ trigger.to_state.state == ''off'' }}'
221- condition: template
222 value_template: '{{ (trigger.to_state.state == ''off'') or (elevation_check is none)
223 or (state_attr(''sun.sun'', ''elevation'') <= elevation_check | float(90)) }}'
224action:
225- choose:
226 - conditions:
227 - condition: template
228 value_template: '{{ trigger.to_state.state == ''on'' }}'
229 - condition: numeric_state
230 entity_id: !input luminance_sensor
231 below: !input luminance_required
232 sequence:
233 - choose:
234 - conditions:
235 - '{{ scene_morning != ''scene.none''}}'
236 - condition: time
237 after: !input time_scene_morning
238 before: !input time_scene_day
239 sequence:
240 - scene: !input scene_morning
241 - conditions:
242 - '{{ scene_day != ''scene.none''}}'
243 - condition: time
244 after: !input time_scene_day
245 before: !input time_scene_evening
246 sequence:
247 - scene: !input scene_day
248 - conditions:
249 - '{{ scene_evening != ''scene.none''}}'
250 - condition: time
251 after: !input time_scene_evening
252 before: !input time_scene_night
253 sequence:
254 - scene: !input scene_evening
255 - conditions:
256 - '{{ scene_night != ''scene.none''}}'
257 - condition: time
258 after: !input time_scene_night
259 before: !input time_scene_morning
260 sequence:
261 - scene: !input scene_night
262 default:
263 - service: light.turn_on
264 target: !input light_target
265 - conditions:
266 - condition: template
267 value_template: '{{ trigger.to_state.state == ''off'' }}'
268 - condition: or
269 conditions:
270 - '{{ no_motion_blocker is none }}'
271 - '{{ no_motion_blocker_boolean and states[no_motion_blocker].state == ''off''
272 }}'
273 - '{{ not no_motion_blocker_boolean and states[no_motion_blocker].state == ''on''
274 }}'
275 sequence:
276 - choose:
277 - conditions:
278 - '{{ scene_ambient != ''scene.none'' }}'
279 - condition: time
280 after: !input time_scene_ambient_start
281 before: !input time_scene_ambient_end
282 sequence:
283 - scene: !input scene_ambient
284 - conditions:
285 - '{{ scene_no_motion != ''scene.none'' }}'
286 sequence:
287 - scene: !input scene_no_motion
288 default:
289 - service: light.turn_off
290 target: !input light_target