forked from jeremywillans/ha-rest980-roomba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mop_multifloor_example.yaml
109 lines (101 loc) · 3.28 KB
/
mop_multifloor_example.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
###################################
# iRobot Mop Package - Multi Floor
###################################
###################################
# Input Select
###################################
input_select:
mop_maps:
name: Mop Maps
initial: Kitchen
options:
- Kitchen
- Entry
- Bathroom
- Master Ensuite
###################################
# Input Text
###################################
input_text:
mop_map_kitchen:
name: Mop Map URL Kitchen
initial: !secret mop_map_kitchen
mop_map_entry:
name: Mop Map URL Entry
initial: !secret mop_map_entry
mop_map_bathroom:
name: Mop Map URL Bathroom
initial: !secret mop_map_bathroom
mop_map_ensuite:
name: Mop Map URL Ensuite
initial: !secret mop_map_ensuite
###################################
# Automation
###################################
automation:
# Map Selection on Change and Startup
- alias: Mop Map Selection
initial_state: true
trigger:
- platform: state
entity_id: input_select.mop_maps
- platform: homeassistant
event: start
action:
# Turn off all Mop Rooms
- service: input_boolean.turn_off
data:
entity_id: group.mop_rooms
# Reset Ordered Mop Rooms List
- service: input_text.set_value
data:
entity_id: input_text.mop_rooms
value: ''
# Set Correct PMap based on Room
- service: input_text.set_value
data_template:
entity_id: input_text.mop_pmap_id
value: >-
{% if states('input_select.mop_maps') == 'Kitchen' %}
{{ state_attr('sensor.mop', 'pmap3_id') }}
{% elif states('input_select.mop_maps') == 'Entry' %}
{{ state_attr('sensor.mop', 'pmap2_id') }}
{% elif states('input_select.mop_maps') == 'Bathroom' %}
{{ state_attr('sensor.mop', 'pmap1_id') }}
{% elif states('input_select.mop_maps') == 'Master Ensuite' %}
{{ state_attr('sensor.mop', 'pmap0_id') }}
{% endif %}
# Set Correct Map URL for Shell Commands and Camera
- service: input_text.set_value
data_template:
entity_id: input_text.mop_map
value: >-
{% if states('input_select.mop_maps') == 'Kitchen' %}
{{ states('input_text.mop_map_kitchen') }}
{% elif states('input_select.mop_maps') == 'Entry' %}
{{ states('input_text.mop_map_entry') }}
{% elif states('input_select.mop_maps') == 'Bathroom' %}
{{ states('input_text.mop_map_bathroom') }}
{% elif states('input_select.mop_maps') == 'Master Ensuite' %}
{{ states('input_text.mop_map_ensuite') }}
{% endif %}
###################################
# Camera
###################################
camera:
- platform: generic
still_image_url: !secret mop_map_kitchen
content_type: image/png
name: Braava Kitchen
- platform: generic
still_image_url: !secret mop_map_entry
content_type: image/png
name: Braava Entry
- platform: generic
still_image_url: !secret mop_map_bathroom
content_type: image/png
name: Braava Bathroom
- platform: generic
still_image_url: !secret mop_map_ensuite
content_type: image/png
name: Braava Ensuite