-
Notifications
You must be signed in to change notification settings - Fork 43
/
mop.yaml
720 lines (689 loc) · 23.4 KB
/
mop.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
###################################
# iRobot Mop Package
###################################
###################################
# Sensor
###################################
sensor:
# Braava via Rest980_2 Docker Image
- platform: rest
name: rest980_2
json_attributes:
- batPct
- cleanMissionStatus
- dock
- pose
- signal
- bbmssn
- bbrun
- name
- pmaps
- openOnly
- twoPass
- softwareVer
- detectedPad
- padWetness
- rankOverlap
- runtimeStats
- tankPresent
- lidOpen
resource: !secret mop_state
value_template: 'OK'
scan_interval: 10
- platform: template
sensors:
mop:
friendly_name_template: >-
{{ state_attr('sensor.rest980_2', 'name') }}
value_template: >-
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980_2', 'cleanMissionStatus')['notReady'] == 39 %}
Pending
{% elif state_attr('sensor.rest980_2', 'cleanMissionStatus')['notReady'] > 0 %}
Not Ready
{% else %}
{% set mapper = {
'clean' : 'Clean',
'quick' : 'Clean',
'spot' : 'Spot',
'dock' : 'Dock',
'train' : 'Train',
'none' : 'Ready' } %}
{% set state = state_attr('sensor.rest980_2', 'cleanMissionStatus')['cycle'] %}
{{ mapper[state] if state in mapper else state }}
{% endif %}
icon_template: mdi:robot-vacuum
attribute_templates:
notready_msg: >-
{% set mapper = {
0 : 'n-a',
2 : 'Uneven Ground',
15 : 'Low Battery',
31 : 'Fill Tank',
39 : 'Pending',
48 : 'Path Blocked' } %}
{% set state = state_attr('sensor.rest980_2', 'cleanMissionStatus')['notReady'] %}
{{ mapper[state] if state in mapper else state }}
error_msg: >-
{% set mapper = {
0 : 'n-a',
18 : 'Docking Issue'} %}
{% set state = state_attr('sensor.rest980_2', 'cleanMissionStatus')['error'] %}
{{ mapper[state] if state in mapper else state }}
battery: >-
{{ state_attr('sensor.rest980_2', 'batPct') }} %
software_ver: >-
{% if state_attr('sensor.rest980_2', 'softwareVer') is defined %}
{% set version = state_attr('sensor.rest980_2', 'softwareVer') %}
{{ version.split('+')[1] }}
{% else %}
n-a
{% endif %}
phase: >-
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['phase'] == 'charge' and state_attr('sensor.rest980_2', 'batPct') == 100 %}
Idle
{% elif state_attr('sensor.rest980_2', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980_2', 'cleanMissionStatus')['phase'] == 'stop' %}
Stopped
{% else %}
{% set mapper = {
'charge' : 'Charge',
'run' : 'Run',
'stop' : 'Paused',
'stuck' : 'Stuck',
'hmUsrDock' : 'Sent Home',
'hmMidMsn' : 'Mid Dock',
'hmPostMsn' : 'Final Dock' } %}
{% set state = state_attr('sensor.rest980_2', 'cleanMissionStatus')['phase'] %}
{{ mapper[state] if state in mapper else state }}
{% endif %}
location: >-
{% if state_attr('sensor.rest980_2', 'pose')['theta'] is defined %}
({{ state_attr('sensor.rest980_2', 'pose')['point']['x'] }}, {{ state_attr('sensor.rest980_2', 'pose')['point']['y'] }}, {{ state_attr('sensor.rest980_2', 'pose')['theta'] }})
{% else %}
n-a
{% endif %}
clean_mode: >-
{{ state_attr('sensor.rest980_2', 'padWetness')['disposable'] }}
mop_behavior: >-
{% if state_attr('sensor.rest980_2', 'rankOverlap') is defined %}
{% set mapper = {
25 : 'Extended',
67 : 'Standard',
85 : 'Deep' } %}
{% set state = state_attr('sensor.rest980_2', 'rankOverlap') %}
{{ mapper[state] if state in mapper else state }}
{% else %}
n-a
{% endif %}
pad: >-
{% if state_attr('sensor.rest980_2', 'detectedPad') is defined %}
{% set mapper = {
'reusableDry' : 'Dry',
'reusableWet' : 'Wet',
'dispDry' : 'Single Dry',
'dispWet' : 'Single Wet',
'invalid' : 'No Pad'
} %}
{% set state = state_attr('sensor.rest980_2', 'detectedPad') %}
{{ mapper[state] if state in mapper else state}}
{% else %}
n-a
{% endif %}
tank: >-
{% if state_attr('sensor.rest980_2', 'tankPresent') is defined %}
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['notReady'] == 31 %}
Fill Tank
{% elif state_attr('sensor.rest980_2', 'tankPresent') and state_attr('sensor.rest980_2', 'lidOpen') == false %}
Ready
{% elif state_attr('sensor.rest980_2', 'tankPresent') and (state_attr('sensor.rest980_2', 'lidOpen')) %}
Lid Open
{% else %}
Tank Missing
{% endif %}
{% else %}
n-a
{% endif %}
rssi: >-
{% if state_attr('sensor.rest980_2', 'signal')['rssi'] is defined %}
{{ state_attr('sensor.rest980_2', 'signal')['rssi'] }}
{% else %}
n-a
{% endif %}
total_area: >-
{% if state_attr('sensor.rest980_2', 'runtimeStats')['sqft'] is defined %}
{{ (state_attr('sensor.rest980_2', 'runtimeStats')['sqft'] / 10.764 * 100)| round() }}m²
{% else %}
n-a
{% endif %}
# {{ (state_attr('sensor.rest980_2', 'runtimeStats')['sqft'] }}ft²
total_time: >-
{% if state_attr('sensor.rest980_2', 'runtimeStats')['hr'] is defined %}
{{ state_attr('sensor.rest980_2', 'runtimeStats')['hr'] }}h {{ state_attr('sensor.rest980_2', 'runtimeStats')['min'] }}m
{% else %}
n-a
{% endif %}
total_jobs: >-
{% if state_attr('sensor.rest980_2', 'bbmssn')['nMssn'] is defined %}
{{ state_attr('sensor.rest980_2', 'bbmssn')['nMssn'] }}
{% else %}
n-a
{% endif %}
job_initiator: >-
{% set mapper = {
'schedule' : 'Scheduler',
'rmtApp' : 'App',
'manual' : 'Robot',
'localApp' : 'HA' } %}
{% set state = state_attr('sensor.rest980_2', 'cleanMissionStatus')['initiator'] %}
{{ mapper[state] if state in mapper else state }}
job_time: >-
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['mssnStrtTm'] is defined %}
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['mssnStrtTm'] != 0 %}
{% set time = state_attr('sensor.rest980_2', 'cleanMissionStatus')['mssnStrtTm'] | timestamp_local %}
{% set elapsed = ((as_timestamp(now()) - as_timestamp(time)) / 60) | round(0) %}
{% if elapsed > 60 %}
{{ elapsed // 60 }}h {{ '{:0>2d}'.format(elapsed%60) }}m
{% else %}
{{elapsed}}m
{% endif %}
{% else %}
n-a
{% endif %}
{% else %}
n-a
{% endif %}
job_recharge: >-
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['rechrgTm'] is defined %}
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['rechrgTm'] != 0 %}
{% set time = state_attr('sensor.rest980_2', 'cleanMissionStatus')['rechrgTm'] | timestamp_local %}
{% set resume = ((as_timestamp(time) - as_timestamp(now())) / 60) | round(0) %}
{% if resume > 60 %}
{{ resume // 60 }}h {{ '{:0>2d}'.format(resume%60) }}m
{% else %}
{{resume}}m
{% endif %}
{% else %}
n-a
{% endif %}
{% else %}
n-a
{% endif %}
job_expires: >-
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['expireTm'] is defined %}
{% if state_attr('sensor.rest980_2', 'cleanMissionStatus')['expireTm'] != 0 %}
{% set time = state_attr('sensor.rest980_2', 'cleanMissionStatus')['expireTm'] | timestamp_local %}
{% set resume = ((as_timestamp(time) - as_timestamp(now())) / 60) | round(0) %}
{% if resume > 60 %}
{{ resume // 60 }}h {{ '{:0>2d}'.format(resume%60) }}m
{% else %}
{{resume}}m
{% endif %}
{% else %}
n-a
{% endif %}
{% else %}
n-a
{% endif %}
clean_edges: >-
{% if state_attr('sensor.rest980_2', 'openOnly') is defined %}
{% if state_attr('sensor.rest980_2', 'openOnly') == 'true' %}
False
{% else %}
True
{% endif %}
{% else %}
n-a
{% endif %}
maint_due: >-
{% if is_state('input_boolean.mop_maint_due', 'on') %}
True
{% else %}
False
{% endif %}
# Floor Plan 0
pmap0_id: >-
{{ state_attr('sensor.rest980_2', 'pmaps')[0] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
# Floor Plan 1 (Optional, if relevant)
pmap1_id: >-
{{ state_attr('sensor.rest980_2', 'pmaps')[1] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
# Floor Plan 2 (Optional, if relevant)
pmap2_id: >-
{{ state_attr('sensor.rest980_2', 'pmaps')[2] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
# Floor Plan 3 (Optional, if relevant)
pmap3_id: >-
{{ state_attr('sensor.rest980_2', 'pmaps')[3] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
mop_location:
friendly_name_template: >-
{{ state_attr('sensor.rest980_2', 'name') }} Location
value_template: >-
{{ state_attr('sensor.mop', 'location') }}
icon_template: mdi:home-map-marker
###################################
# Rest Command
###################################
rest_command:
mop_action:
url: >-
{{ states('input_text.mop_action') }}{{ command }}
verify_ssl: !secret mop_verify_ssl
method: 'get'
timeout: 20
mop_clean:
url: >-
{{ states('input_text.mop_action') }}cleanRoom
verify_ssl: !secret mop_verify_ssl
method: POST
content_type: 'application/json'
payload: '{{ payload }}'
###################################
# Input Boolean
###################################
input_boolean:
mop_clean_kitchen:
name: Kitchen
icon: mdi:silverware-fork-knife
mop_clean_entry:
name: Entry
icon: mdi:coat-rack
mop_clean_bathroom:
name: Bathroom
icon: mdi:shower
mop_clean_master_ensuite:
name: Master Ensuite
icon: mdi:shower
mop_maint_due:
name: Mop Maintenance
icon: mdi:wrench
mop_schedule_1:
name: Mop Schedule 1
icon: mdi:timetable
mop_schedule_2:
name: Mop Schedule 2
icon: mdi:timetable
###################################
# Input Text
###################################
input_text:
mop_action:
name: Mop Action URL
initial: !secret mop_action
mop_map:
name: Mop Map URL
initial: !secret mop_map
mop_log:
name: Mop Log Path
initial: !secret mop_log
mop_dir:
name: Mop Dir Path
initial: !secret mop_dir
mop_rooms:
name: Mop Rooms
max: 255
mop_pmap_id:
name: Mop PMap
mop_clean_kitchen:
name: Kitchen
initial: !secret mop_kitchen
mop_clean_entry:
name: Entry
initial: !secret mop_entry
mop_clean_bathroom:
name: Bathroom
initial: !secret mop_bathroom
mop_clean_master_ensuite:
name: Master Ensuite
initial: !secret mop_master_ensuite
###################################
# Group
###################################
group:
mop_rooms:
entities:
- input_boolean.mop_clean_kitchen
- input_boolean.mop_clean_entry
- input_boolean.mop_clean_bathroom
- input_boolean.mop_clean_master_ensuite
###################################
# Automation
###################################
automation:
# Initiate Selective Room Clean
- alias: Mop Clean Rooms
trigger:
- platform: event
event_type: initiate_mop_clean
condition:
condition: not
conditions:
- condition: state
entity_id: input_text.mop_rooms
state: ''
action:
- service: rest_command.mop_clean
data_template:
payload: >
{% set rooms = states('input_text.mop_rooms') %}
{% if rooms[-1:] == ',' %}
{% set rooms = rooms[:-1] %}
{% endif %}
{% set rooms = rooms.split(",") %}
{
"ordered": 1,
"pmap_id": "{{ states('input_text.mop_pmap_id') | string }}",
"regions": [{% for id in rooms %}
{% set room = 'input_text.mop_clean_' + id %} {{ states(room) | string }} {%- if not loop.last %},{%- endif %}
{%- endfor %}
]
}
# Replace pmap_id line above with the following, if not using multi-floors
# "pmap_id": "{{ state_attr('sensor.mop', 'pmap0_id') | string }}",
- service: input_text.set_value
data:
entity_id: input_text.mop_rooms
value: ''
- service: input_boolean.turn_off
data:
entity_id: group.mop_rooms
# Update Mop REST Sensor for Location Details
- alias: Mop Update Location
initial_state: true
trigger:
- platform: time_pattern
seconds: /2
- platform: event
event_type: call_service
event_data:
domain: rest_command
service: mop_clean
condition:
condition: or
conditions:
- condition: template
value_template: "{{ is_state_attr('sensor.mop', 'phase', 'Run') }}"
- condition: template
value_template: "{{ is_state_attr('sensor.mop', 'phase', 'Sent Home') }}"
- condition: template
value_template: "{{ is_state_attr('sensor.mop', 'phase', 'Mid Dock') }}"
- condition: template
value_template: "{{ is_state_attr('sensor.mop', 'phase', 'Final Dock') }}"
action:
- service: homeassistant.update_entity
entity_id: sensor.rest980_2
# Log Mop Location to File
- alias: Mop Log Position
initial_state: true
trigger:
platform: state
entity_id: sensor.mop_location
condition:
condition: or
conditions:
- condition: state
entity_id: sensor.mop
state: 'Clean'
- condition: state
entity_id: sensor.mop
state: 'Train'
action:
- service: notify.mopfile
data_template:
message: "{{ states('sensor.mop_location') }}"
# Initialize Blank Mop Log File
- alias: Mop Clean Log
initial_state: true
trigger:
- platform: state
entity_id: sensor.mop
from: 'Ready'
to: 'Clean'
- platform: state
entity_id: sensor.mop
from: 'Ready'
to: 'Train'
action:
- service: shell_command.mop_clear_log
- service: shell_command.mop_clear_image
# Update Mop Log File with Finished Status
- alias: Mop Notify on Finished Cleaning
initial_state: true
trigger:
- platform: state
entity_id: sensor.mop
from: 'Clean'
to: 'Ready'
- platform: state
entity_id: sensor.mop
from: 'Train'
to: 'Ready'
- platform: state
entity_id: sensor.mop
from: 'Pending'
to: 'Ready'
action:
- service: notify.mopfile
data_template:
message: "Finished"
# Update Mop Log File with Stuck Status
- alias: Mop Notify on Stuck Status
initial_state: true
trigger:
platform: template
value_template: "{{ is_state_attr('sensor.mop', 'phase', 'Stuck') }}"
action:
- service: notify.mopfile
data_template:
message: "Stuck"
# DELETE BELOW SECTION IF YOU DONT WANT NOTIFICATIONS
- delay: 5
- service: !secret mop_notify
data_template:
title: "{{ state_attr('sensor.rest980_2', 'name') }} requires your attention"
message: "{{ state_attr('sensor.rest980_2', 'name') }} is stuck."
# =============
# NOTICE THIS SECTION IS VALID FOR IOS USERS ONLY!
data:
attachment:
content-type: jpeg
push:
category: camera
entity_id: camera.braava
# =============
# Generate Complete Mop Map
- alias: Mop Generate Image after Cleaning
initial_state: true
trigger:
- platform: state
entity_id: sensor.mop
from: 'Clean'
to: 'Ready'
for:
seconds: 10
- platform: state
entity_id: sensor.mop
from: 'Train'
to: 'Ready'
for:
seconds: 10
- platform: state
entity_id: sensor.mop
from: 'Pending'
to: 'Ready'
for:
seconds: 10
action:
- service: shell_command.mop_generate_image
# DELETE BELOW SECTION IF YOU DONT WANT NOTIFICATIONS
- delay: 5
- service: !secret mop_notify
data_template:
title: "{{ state_attr('sensor.rest980_2', 'name') }}"
message: "{{ state_attr('sensor.rest980_2', 'name') }} successfully completed a job!"
# =============
# NOTICE THIS SECTION IS VALID FOR IOS USERS ONLY!
data:
attachment:
content-type: jpeg
push:
category: camera
entity_id: camera.braava
# =============
# Maintenance Check
- alias: Mop Maintenance Check
initial_state: true
trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: [
'sensor.mop_maint_clean_contacts',
'sensor.mop_maint_clean_pad',
'sensor.mop_maint_clean_wheels',
'sensor.mop_maint_replace_pad'
]
action:
- service: >-
{% set ns = namespace(count = 0) %}
{% for item in states.sensor if 'sensor.mop_maint' in item.entity_id and (state_attr(item.entity_id, 'timeout_timestamp') < as_timestamp(now())) %}
{% set ns.count = loop.index %}
{% endfor %}
{% if ns.count > 0 %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
entity_id: input_boolean.mop_maint_due
# Add Rooms for Ordered Cleaning
- alias: Mop Add Rooms for Cleaning
initial_state: true
trigger:
platform: state
entity_id: [
'input_boolean.mop_clean_kitchen',
'input_boolean.mop_clean_entry',
'input_boolean.mop_clean_bathroom',
'input_boolean.mop_clean_master_ensuite'
]
to: 'on'
action:
service: input_text.set_value
data_template:
entity_id: input_text.mop_rooms
value: |
{% set room = trigger.entity_id %}
{% set room = room.replace("input_boolean.mop_clean_","") %}
{% if ((states('input_text.mop_rooms') == "unknown") or (states('input_text.mop_rooms') == "")) %}
{{ room }},
{% else %}
{{ states('input_text.mop_rooms') }}{{ room }},
{% endif %}
# Remove Rooms for Ordered Cleaning
- alias: Mop Remove Rooms for Cleaning
initial_state: true
trigger:
platform: state
entity_id: [
'input_boolean.mop_clean_kitchen',
'input_boolean.mop_clean_entry',
'input_boolean.mop_clean_bathroom',
'input_boolean.mop_clean_master_ensuite'
]
to: 'off'
action:
service: input_text.set_value
data_template:
entity_id: input_text.mop_rooms
value: |
{% set room = trigger.entity_id %}
{% set room = room.replace("input_boolean.mop_clean_","") %}
{% set result = states('input_text.mop_rooms') %}
{% set result = result.replace(room + ",","") %}
{{ result }}
# Mop Cleaning Schedule 1
- alias: Mop Cleaning Schedule 1
initial_state: true
trigger:
platform: time_pattern
hours: "11"
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.mop_schedule_1
state: 'on'
- condition: state
entity_id: input_boolean.vacation
state: 'off'
- condition: time
weekday:
- mon
- wed
- fri
action:
- service: input_select.select_option
data:
option: 'Master Ensuite'
entity_id: input_select.mop_maps
- service: input_text.set_value
entity_id: input_text.mop_rooms
data_template:
entity_id: input_text.mop_rooms
value: "master_ensuite"
- service: automation.trigger
entity_id: automation.mop_clean_rooms
# Mop Cleaning Schedule 2
- alias: Mop Cleaning Schedule 2
initial_state: true
trigger:
platform: time_pattern
hours: "12"
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.mop_schedule_2
state: 'on'
- condition: state
entity_id: input_boolean.vacation
state: 'off'
- condition: time
weekday:
- sun
action:
- service: input_text.set_value
entity_id: input_text.mop_rooms
data_template:
entity_id: input_text.mop_rooms
value: "kitchen,entry,bathroom,master_ensuite"
- service: automation.trigger
entity_id: automation.mop_clean_rooms
# Delete Old Mop Image Files
- alias: Mop Delete Images
initial_state: true
trigger:
platform: time_pattern
hours: "00"
action:
- service: shell_command.mop_delete_images
###################################
# Notify
###################################
notify:
- name: MopFile
platform: file
filename: !secret mop_log
###################################
# Camera
###################################
camera:
- platform: generic
still_image_url: >-
{{ states('input_text.mop_map') }}
content_type: image/png
name: Braava
###################################
# Shell Command
###################################
shell_command:
mop_clear_log: cp /dev/null {{ states('input_text.mop_log') }}
mop_clear_image: curl -X GET -s -O /dev/null '{{ states("input_text.mop_map") }}?clear=true'
mop_generate_image: curl -X GET -s -O /dev/null '{{ states("input_text.mop_map") }}?last=true'
mop_delete_images: find {{ states('input_text.mop_dir') }} -regex ".*[0-9]\.png" -type f -mtime +20 -exec rm -f {} \;