-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathespresense_detection.yaml
69 lines (69 loc) · 2.13 KB
/
espresense_detection.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
blueprint:
name: "ESPresense: Tolerance Update"
description: "**Version: 1.0**\n\nESPresense Detection Blueprint"
author: fixtse
domain: automation
input:
person_ble_tracker:
name: ESPresense BLE Tracker
description: The ESPresense BLE tracker for the person
selector:
entity:
domain: sensor
person_input_select:
name: Input select
description: This is the input select that tracks the person's status
selector:
entity:
domain: input_select
espresense_tolerance_time:
name: ESPresense Tolerance Time
description: How long to wait before consider someone in a diferent room
default: 2
selector:
number:
min: 0.0
max: 10.0
unit_of_measurement: minutes
step: 1.0
mode: slider
source_url: https://github.com/fixtse/blueprints/blob/main/espresense_detection.yaml
variables:
espresense_tolerance_time: !input espresense_tolerance_time
trigger:
- platform: state
entity_id: !input "person_ble_tracker"
id: ble_tracker
condition: []
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input "person_input_select"
state: Away
- condition: template
value_template: >-
{{ ((as_timestamp(now()) -
as_timestamp(trigger.to_state.last_changed)) / 60) | round(0)
>= espresense_tolerance_time }}
enabled: true
sequence:
- service: input_select.select_option
target:
entity_id: !input "person_input_select"
data:
option: >-
{{ trigger.to_state.state | replace("_", " ") | title }}
- conditions:
- condition: state
entity_id: !input "person_ble_tracker"
state: not_home
sequence:
- service: input_select.select_option
target:
entity_id: !input "person_input_select"
data:
option: Away
mode: queued