Ultima attività 1753703697

Revisione 2993a3662151ce7cd183a3c1bf1063d19b03a44f

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: Illuminance sensor
31 description: This sensor will be used to determine the illumination.
32 default:
33 selector:
34 entity:
35 multiple: true
36 luminance_required:
37 name: Required Lux Level
38 description: Lux level below which the automation will run.
39 default: 100
40 selector:
41 number:
42 min: 0.0
43 max: 10000.0
44 unit_of_measurement: lx
45 step: 1.0
46 mode: slider
47 no_motion_wait:
48 name: Wait time
49 description: Time to leave the light on after last motion is detected.
50 default: 120
51 selector:
52 number:
53 min: 0.0
54 max: 3600.0
55 unit_of_measurement: seconds
56 step: 1.0
57 mode: slider
58 automation_blocker:
59 name: Automation Blocker (Optional)
60 description: Only run if this boolean is in desired state (see next input)
61 default:
62 selector:
63 entity: {}
64 automation_blocker_boolean:
65 name: Automation Blocker Chooser (Optional)
66 description: Desired state of automation blocker, choose on for on and off for
67 off
68 default: false
69 selector:
70 boolean: {}
71 no_motion_blocker:
72 name: No Motion Blocker (Optional)
73 description: No motion sequence is not run if this boolean is in desired state
74 (see next input)
75 default:
76 selector:
77 entity: {}
78 no_motion_blocker_boolean:
79 name: No Motion Chooser (Optional)
80 description: Desired state of no motion blocker, choose on for on and off for
81 off
82 default: false
83 selector:
84 boolean: {}
85 elevation_check:
86 name: Sun elevation check (Optional)
87 description: This is the angle between the sun and the horizon. Negative values
88 mean the sun is BELOW the horizon.
89 default: none
90 selector:
91 number:
92 min: -90.0
93 max: 90.0
94 unit_of_measurement: degrees
95 step: 1.0
96 mode: slider
97 scene_ambient:
98 name: Ambient Scene (Optional)
99 description: Scene for ambient state. Will be activated when no motion is detected.
100 default: scene.none
101 selector:
102 entity:
103 domain:
104 - scene
105 multiple: false
106 time_scene_ambient_start:
107 name: Ambient time frame start (Optional)
108 description: Time from which on ambient scene will be activated
109 default: 00:00:00
110 selector:
111 time: {}
112 time_scene_ambient_end:
113 name: Ambient time frame end (Optional)
114 description: Time from which on ambient scene will be not activated
115 default: 00:00:00
116 selector:
117 time: {}
118 scene_morning:
119 name: Scene for the morning (Optional)
120 default: scene.none
121 selector:
122 entity:
123 domain:
124 - scene
125 multiple: false
126 time_scene_morning:
127 name: Time for the morning scene (Optional)
128 description: A time input which defines the time from which on the scene will
129 be activated if motion is detected.
130 default: 00:00:00
131 selector:
132 time: {}
133 scene_day:
134 name: Scene for the bright day (Optional)
135 default: scene.none
136 selector:
137 entity:
138 domain:
139 - scene
140 multiple: false
141 time_scene_day:
142 name: Time for the day scene (Optional)
143 description: A time input which defines the time from which on the scene will
144 be activated if motion is detected.
145 default: 00:00:00
146 selector:
147 time: {}
148 scene_evening:
149 name: Scene for the evening (Optional)
150 default: scene.none
151 selector:
152 entity:
153 domain:
154 - scene
155 multiple: false
156 time_scene_evening:
157 name: Time for the evening scene (Optional)
158 description: A time input which defines the time from which on the scene will
159 be activated if motion is detected.
160 default: 00:00:00
161 selector:
162 time: {}
163 scene_night:
164 name: Scene for the dark night (Optional)
165 default: scene.none
166 selector:
167 entity:
168 domain:
169 - scene
170 multiple: false
171 time_scene_night:
172 name: Time for the night scene (Optional)
173 description: A time input which defines the time from which on the scene will
174 be activated if motion is detectedd.
175 default: 00:00:00
176 selector:
177 time: {}
178 scene_no_motion:
179 name: Default scene for no motion (Optional)
180 description: Set this Scene if you want to activate a scene if motion stops
181 default: scene.none
182 selector:
183 entity:
184 domain:
185 - scene
186 multiple: false
187mode: restart
188max_exceeded: silent
189variables:
190 scene_ambient: !input scene_ambient
191 scene_morning: !input scene_morning
192 scene_day: !input scene_day
193 scene_evening: !input scene_evening
194 scene_night: !input scene_night
195 automation_blocker: !input automation_blocker
196 automation_blocker_boolean: !input automation_blocker_boolean
197 no_motion_blocker: !input no_motion_blocker
198 no_motion_blocker_boolean: !input no_motion_blocker_boolean
199 elevation_check: !input elevation_check
200 scene_no_motion: !input scene_no_motion
201 motion_entity: !input motion_entity
202 luminance_sensor: !input luminance_sensor
203 luminance_required: !input luminance_required
204trigger:
205- platform: state
206 entity_id: !input motion_entity
207 from: 'off'
208 to: 'on'
209- platform: state
210 entity_id: !input motion_entity
211 from: 'on'
212 to: 'off'
213 for: !input no_motion_wait
214condition:
215- condition: or
216 conditions:
217 - '{{ automation_blocker == none }}'
218 - '{{ automation_blocker_boolean and states[automation_blocker].state == ''off''
219 }}'
220 - '{{ not automation_blocker_boolean and states[automation_blocker].state == ''on''
221 }}'
222 - '{{ trigger.to_state.state == ''off'' }}'
223- condition: template
224 value_template: '{{ (trigger.to_state.state == ''off'') or (elevation_check is none)
225 or (state_attr(''sun.sun'', ''elevation'') <= elevation_check | float(90)) }}'
226action:
227- choose:
228 - conditions:
229 - condition: template
230 value_template: '{{ trigger.to_state.state == ''on'' }}'
231 - condition: numeric_state
232 entity_id: !input luminance_sensor
233 below: !input luminance_required
234 sequence:
235 - choose:
236 - conditions:
237 - '{{ scene_morning != ''scene.none''}}'
238 - condition: time
239 after: !input time_scene_morning
240 before: !input time_scene_day
241 sequence:
242 - scene: !input scene_morning
243 - conditions:
244 - '{{ scene_day != ''scene.none''}}'
245 - condition: time
246 after: !input time_scene_day
247 before: !input time_scene_evening
248 sequence:
249 - scene: !input scene_day
250 - conditions:
251 - '{{ scene_evening != ''scene.none''}}'
252 - condition: time
253 after: !input time_scene_evening
254 before: !input time_scene_night
255 sequence:
256 - scene: !input scene_evening
257 - conditions:
258 - '{{ scene_night != ''scene.none''}}'
259 - condition: time
260 after: !input time_scene_night
261 before: !input time_scene_morning
262 sequence:
263 - scene: !input scene_night
264 default:
265 - service: light.turn_on
266 target: !input light_target
267 - conditions:
268 - condition: template
269 value_template: '{{ trigger.to_state.state == ''off'' }}'
270 - condition: or
271 conditions:
272 - '{{ no_motion_blocker is none }}'
273 - '{{ no_motion_blocker_boolean and states[no_motion_blocker].state == ''off''
274 }}'
275 - '{{ not no_motion_blocker_boolean and states[no_motion_blocker].state == ''on''
276 }}'
277 sequence:
278 - choose:
279 - conditions:
280 - '{{ scene_ambient != ''scene.none'' }}'
281 - condition: time
282 after: !input time_scene_ambient_start
283 before: !input time_scene_ambient_end
284 sequence:
285 - scene: !input scene_ambient
286 - conditions:
287 - '{{ scene_no_motion != ''scene.none'' }}'
288 sequence:
289 - scene: !input scene_no_motion
290 default:
291 - service: light.turn_off
292 target: !input light_target