-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdreame-vacuum-card.js
More file actions
4182 lines (3890 loc) · 167 KB
/
dreame-vacuum-card.js
File metadata and controls
4182 lines (3890 loc) · 167 KB
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
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Dreame Vacuum Card
* A custom Dashboard card for Home Assistant — built around the official
* dreame_vacuum integration. Designed for the Dreame X40 Ultra but works
* with any Dreame robot vacuum that the integration supports.
*
* Repository : https://github.com/hedegaard1/dreame-vacuum-card
* Author : Martin Fiil
* License : MIT
* Version : 1.0.3
*
* Configuration example (dashboard YAML):
*
* type: custom:dreame-vacuum-card
* entity: vacuum.dreame_x40_ultra # required — your Dreame vacuum
* title: Dreame X40 Ultra # optional — header title (defaults to friendly_name)
* image: /local/my-robot.png # optional — path to a robot image
*
* The card auto-discovers all related select / number / switch / sensor
* entities (suction level, mop humidity, CleanGenius, room settings, …)
* from the entity prefix, so no extra wiring is required when the
* dreame_vacuum integration is set up.
*
* Theming: the card respects HA theme variables (--primary-color,
* --primary-text-color, --card-background-color, --primary-background-color
* and --divider-color). Override them in your theme to recolor the card.
*/
// =============================================================================
// Dreame integration translation tables — extracted from the official
// dreame_vacuum HA integration's strings.json. These map raw sensor values
// (snake_case keys) to human-friendly labels exactly like the Dreame app uses.
// =============================================================================
// vacuum.<entity>.state values
const VACUUM_STATE_LABELS = {
unknown: "Unknown",
sweeping: "Sweeping",
charging: "Charging",
error: "Error",
idle: "Idle",
paused: "Paused",
returning: "Returning to dock",
mopping: "Mopping",
drying: "Drying",
washing: "Washing",
returning_to_wash: "Returning to wash",
building: "Building",
sweeping_and_mopping: "Sweeping and mopping",
charging_completed: "Charging completed",
upgrading: "Upgrading",
clean_summon: "Summon to clean",
station_reset: "Station reset",
returning_install_mop: "Returning to install mop",
returning_remove_mop: "Returning to remove mop",
water_check: "Water checking",
clean_add_water: "Cleaning and adding water",
washing_paused: "Washing paused",
auto_emptying: "Auto-emptying",
remote_control: "Remote controlling",
smart_charging: "Smart charging",
second_cleaning: "Second time cleaning",
human_following: "Human following",
spot_cleaning: "Spot cleaning",
returning_auto_empty: "Returning to auto-empty",
waiting_for_task: "Waiting for task",
station_cleaning: "Station cleaning",
returning_to_drain: "Returning to drain",
draining: "Draining",
auto_water_draining: "Auto water draining",
emptying: "Emptying",
dust_bag_drying: "Dust bag drying",
dust_bag_drying_paused: "Dust bag drying paused",
heading_to_extra_cleaning: "Heading to extra cleaning",
extra_cleaning: "Extra cleaning",
finding_pet_paused: "Finding pet paused",
finding_pet: "Finding pet",
shortcut: "Shortcut",
monitoring: "Monitoring",
monitoring_paused: "Monitoring paused",
initial_deep_cleaning: "Initial deep cleaning",
initial_deep_cleaning_paused: "Initial deep cleaning paused",
sanitizing: "Sanitizing",
sanitizing_with_dry: "Sanitizing with dry",
changing_mop: "Changing mop",
changing_mop_paused: "Changing mop paused",
floor_maintaining: "Floor maintaining",
floor_maintaining_paused: "Floor maintaining paused",
docked: "Docked",
sleeping: "Sleeping",
standby: "Standby",
};
// attributes.status values
const VACUUM_STATUS_LABELS = {
unknown: "Unknown",
idle: "Idle",
paused: "Paused",
cleaning: "Cleaning",
returning: "Returning to dock",
spot_cleaning: "Spot cleaning",
follow_wall_cleaning: "Follow wall cleaning",
charging: "Charging",
ota: "OTA update",
fct: "FCT",
wifi_set: "WiFi setup",
power_off: "Power off",
factory: "Factory",
error: "Error",
remote_control: "Remote control",
sleeping: "Sleeping",
self_repair: "Self repair",
factory_test: "Factory test",
standby: "Standby",
room_cleaning: "Room cleaning",
zone_cleaning: "Zone cleaning",
fast_mapping: "Fast mapping",
cruising_path: "Cruising on path",
cruising_point: "Cruising to a point",
summon_clean: "Summon to clean",
shortcut: "Shortcut",
person_follow: "Person follow",
water_check: "Water checking",
docked: "Docked",
};
// sensor.<...>_task_status values
const TASK_STATUS_LABELS = {
unknown: "Unknown",
completed: "Completed",
cleaning: "Cleaning",
zone_cleaning: "Zone cleaning",
room_cleaning: "Room cleaning",
spot_cleaning: "Spot cleaning",
fast_mapping: "Fast mapping",
cleaning_paused: "Cleaning paused",
room_cleaning_paused: "Room cleaning paused",
zone_cleaning_paused: "Zone cleaning paused",
spot_cleaning_paused: "Spot cleaning paused",
map_cleaning_paused: "Map cleaning paused",
docking_paused: "Docking paused",
mopping_paused: "Mopping paused",
cruising_path: "Cruising on path",
cruising_point: "Cruising to a point",
station_cleaning: "Station cleaning",
};
// sensor.<...>_self_wash_base_status values
const WASH_BASE_LABELS = {
unknown: null,
idle: null,
washing: "Mop washing",
drying: "Mop drying",
paused: "Mop wash paused",
returning: "Returning to wash",
clean_add_water: "Add water for self-clean",
adding_water: "Adding water",
};
// sensor.<...>_charging_status values
const CHARGING_STATUS_LABELS = {
unknown: null,
charging: "Charging",
not_charging: null,
return_to_charge: "Returning to charge",
charging_completed: "Charging completed",
};
// sensor.<...>_low_water_warning values (when not "no_warning", show as alert)
const LOW_WATER_LABELS = {
no_warning: null,
no_water_left_dismiss: "Check the clean water tank",
no_water_left: "Clean water tank empty",
no_water_left_after_clean: "Refill water + empty dirty water",
no_water_for_clean: "Low water — switched to vacuum-only",
low_water: "Water level low — refill soon",
tank_not_installed: "Clean water tank not installed",
};
// sensor.<...>_clean_water_tank_status values
const CLEAN_WATER_TANK_LABELS = {
unknown: null, not_available: null, installed: null,
not_installed: "Clean water tank missing",
low_water: "Refill clean water",
};
// sensor.<...>_dirty_water_tank_status values
const DIRTY_WATER_TANK_LABELS = {
unknown: null, installed: null,
not_installed_or_full: "Empty dirty water tank",
};
// sensor.<...>_dust_bag_status values
const DUST_BAG_LABELS = {
unknown: null, installed: null,
not_installed: "Dust bag missing",
check: "Check dust bag",
};
// sensor.<...>_detergent_status values
const DETERGENT_LABELS = {
unknown: null, installed: null, disabled: null,
low_detergent: "Refill detergent",
};
// sensor.<...>_dust_collection values
const DUST_COLLECTION_LABELS = {
unknown: null, available: null, not_available: null, never: null,
over_use: "Empty dust bin (overused)",
};
// sensor.<...>_drainage_status values
const DRAINAGE_LABELS = {
unknown: null, idle: null,
draining: "Station draining",
draining_successful: null,
draining_failed: "Drain failed",
};
// sensor.<...>_mop values
const MOP_STATUS_LABELS = {
unknown: null, installed: null, mop_installed: null, in_station: null,
not_installed: "Mop pad not installed",
};
// sensor.<...>_error values — most are already user-friendly
const ERROR_LABELS = {
no_error: null,
unknown: null,
// Movement / sensors
drop: "Wheels are suspended",
cliff: "Cliff sensor error",
bumper: "Collision sensor stuck",
gesture: "Robot is tilted",
bumper_repeat: "Collision sensor stuck",
drop_repeat: "Wheels are suspended",
optical_flow: "Optical flow sensor error",
// Hardware / installation
no_box: "Dust bin not installed",
no_tank_box: "Water tank not installed",
water_box_empty: "Water tank is empty",
box_full: "Filter blocked or wet",
brush: "Main brush wrapped",
side_brush: "Side brush wrapped",
fan: "Filter blocked or wet",
left_wheel_motor: "Left wheel blocked",
right_wheel_motor: "Right wheel blocked",
turn_suffocate: "Robot is stuck",
forward_suffocate: "Robot can't go forward",
charger_get: "Cannot find dock",
battery_low: "Low battery",
charge_fault: "Charging error",
battery_percentage: "Battery level error",
heart: "Internal error",
camera_occlusion: "Camera blocked",
// Mop & water
remove_mop: "Mopping done — please remove and clean mop pad",
mop_removed: "Mop pad came off",
mop_pad_stop_rotate: "Mop pad stopped rotating",
bin_full: "Dust collection bag full",
bin_open: "Auto-empty cover open",
water_tank: "Clean water tank not installed",
dirty_water_tank: "Dirty water tank full or missing",
water_tank_dry: "Refill clean water tank",
dirty_water_tank_blocked: "Dirty water tank blocked",
dirty_water_tank_pump: "Dirty water tank pump error",
mop_pad: "Washboard not installed properly",
wet_mop_pad: "Clean the washboard",
clean_mop_pad: "Cleaning task done — clean the washboard",
clean_tank_level: "Check and fill clean water tank",
station_disconnected: "Base station not powered on",
dirty_tank_level: "Dirty water tank too full",
washboard_level: "Washboard water too high",
no_mop_in_station: "Mop pad not in station",
dust_bag_full: "Dust bag full",
mop_install_failed: "Mop pad installation failed",
low_battery_turn_off: "Low battery — shutting down",
dirty_tank_not_installed: "Dirty water tank not installed",
// Robot stuck variants
robot_in_hidden_room: "Hidden area — move the robot",
robot_stuck: "Robot is stuck",
robot_stuck_repeat: "Robot stuck — move to open area",
robot_stuck_on_tables: "Robot stuck among tables/chairs",
robot_stuck_on_passage: "Robot stuck in narrow passage",
robot_stuck_on_threshold: "Robot stuck at step/threshold",
robot_stuck_on_low_lying_area: "Robot stuck under low furniture",
robot_stuck_on_ramp: "Robot detected dangerous ramp",
robot_stuck_on_obstacle: "Robot blocked by obstacle",
robot_stuck_on_pet: "Robot detected pet/person",
robot_stuck_on_slippery_surface: "Robot slipping",
robot_stuck_on_carpet: "Robot slipping on carpet",
robot_stuck_on_curtain: "Robot slipping in curtain",
// Misc
blocked: "Cleanup route blocked — returning to dock",
carpet: "Start the robot off the carpet",
laser: "3D obstacle sensor error",
ultrasonic: "Ultrasonic sensor error",
no_go_zone: "No-Go zone detected",
route: "Cleanup route blocked",
restricted: "Robot in restricted area",
drainage_failed: "Water drainage failed",
mop_not_detected: "Mop not detected",
mop_holder_error: "Mop holder error in dock",
dock_error: "Dock error",
wash_failed: "Failed to wash mop",
edge_mop_stop_rotate: "Edge mop stopped rotating",
edge_mop_detached: "Edge mop detached",
chassis_lift_malfunction: "Chassis lift malfunction",
mop_cover_error: "Check debris near roller mop",
roller_mop_error: "Check debris near roller mop",
onboard_water_tank_empty: "Robot's water box low",
onboard_dirty_water_tank_full: "Robot's used water box full",
mop_not_installed: "Mop not installed",
fluffing_roller_error: "Fluffing roller error",
blocked_by_obstacle: "Blocked by obstacle",
internal_error: "Internal error — try restarting",
// Catch-all for new errors
};
// Icon mapping for alerts/notifications
const ALERT_ICONS = {
// water
water: "mdi:water-off-outline",
clean_water: "mdi:water-off-outline",
dirty_water: "mdi:water-pump-off",
add_water: "mdi:water-plus-outline",
// dust / bin
dust: "mdi:delete-empty-outline",
bin: "mdi:delete-empty-outline",
// mop
mop: "mdi:water-outline",
remove_mop: "mdi:water-pump-off",
// brush
brush: "mdi:broom",
// detergent
detergent: "mdi:bottle-tonic-outline",
// generic
alert: "mdi:alert-circle-outline",
drying: "mdi:weather-sunny",
charging: "mdi:battery-charging",
default: "mdi:information-outline",
};
// =============================================================================
// UI translations. Card text follows the Home Assistant user's language
// (`hass.locale.language`) and falls back to English when a key is missing.
// To add a language, copy the `en` block, change the values, and submit a PR.
// =============================================================================
const TRANSLATIONS = {
en: {
// Hero
robot_vacuum: "Robot vacuum",
fallback_title: "Dreame Vacuum",
// Status pill states
state_idle: "Idle",
// Stats
stat_battery: "Battery",
stat_area: "Area",
stat_time: "Time",
stat_mode: "Mode",
// Rooms
section_rooms: "Rooms",
rooms_selected: "{count} selected",
room_state_selected: "Selected",
// Main buttons
btn_clean_selected: "Clean selected room/s",
btn_clean_all: "Clean all rooms",
btn_clear: "Clear all selection/s",
// Alert pill
alert_action_needed: "Action needed",
alert_more: "+{n} more",
// Cleaning overlay
overlay_paused: "PAUSED",
overlay_cleaning: "CLEANING",
overlay_label_present_location: "Present location:",
overlay_label_room_cleaning: "Room cleaning:",
overlay_pause: "Pause",
overlay_resume: "Resume",
overlay_self_clean: "Self-clean",
overlay_end_job: "End job",
job_badge_one_room: "{n} room",
job_badge_rooms: "{n} rooms",
job_badge_selected: "Selected",
job_badge_all_rooms: "All rooms",
fallback_task_cleaning: "Cleaning",
// Modal — header
modal_title: "ADVANCED",
modal_subtitle: "Cleaning profile and behaviour",
modal_close: "Close",
modal_locate: "Locate robot",
// Modal — tabs
tab_cleaning: "Cleaning",
tab_cleangenius: "CleanGenius",
tab_custom: "Custom",
tab_behavior: "Behavior",
tab_dock: "Dock",
// Behavior tab
section_schedule_audio: "SCHEDULE & AUDIO",
section_preferences: "PREFERENCES",
section_carpets: "CARPETS",
toggle_dnd_title: "Do Not Disturb",
toggle_dnd_sub: "Robot stays quiet during set hours",
label_dnd_start: "Start time",
label_dnd_end: "End time",
label_volume: "Volume",
toggle_resume_title: "Resume after pause",
toggle_resume_sub: "Continue cleaning after power loss",
toggle_child_lock_title: "Child lock",
toggle_child_lock_sub: "Lock controls on the dock",
toggle_carpet_boost_title: "Carpet boost",
toggle_carpet_boost_sub: "More suction on carpets",
toggle_carpet_avoid_title: "Avoid carpets when mopping",
toggle_carpet_avoid_sub: "Skip carpeted areas during mop tasks",
toggle_auto_mount_mop_title: "Auto-mount mop",
toggle_auto_mount_mop_sub: "Robot fits/removes mop pad automatically",
// Dock tab
section_auto_empty: "AUTO EMPTY",
section_mop_care: "MOP CARE",
toggle_auto_empty_title: "Auto empty",
toggle_auto_empty_sub: "Empty dust bin into dock automatically",
label_auto_empty_freq: "Empty frequency",
toggle_auto_detergent_title: "Auto-add detergent",
toggle_auto_detergent_sub: "Dispense detergent into mop water",
label_drying_time: "Drying time",
section_quick_actions: "QUICK ACTIONS",
action_base_station_cleaning: "Clean dock",
no_settings: "No matching entities are enabled in Home Assistant.",
// Modal — CleanGenius tab
section_cleangenius_mode: "MODE",
section_cleangenius_mode_info: "Pick how thorough CleanGenius should be",
section_cleangenius_behaviour: "CLEANGENIUS BEHAVIOUR",
// Modal — Custom tab
section_cleaning_mode: "CLEANING MODE",
section_cleaning_times: "CLEANING TIMES",
toggle_customized_title: "Customized cleaning",
toggle_customized_sub: "Use per-room settings instead of global ones",
section_per_room: "PER ROOM",
section_per_room_info: "Each room uses its own settings below",
section_suction: "SUCTION POWER",
toggle_maxplus_title: "Max+",
toggle_maxplus_sub: "Boost suction beyond turbo",
section_mop_humidity: "MOP HUMIDITY",
wetness_label_dry: "Lightly damp",
wetness_label_damp: "Damp",
wetness_label_wet: "Wet",
section_mop_washing: "MOP WASHING",
label_wash_every: "Wash every",
section_route: "ROUTE",
// Per-room accordion
sub_cleaning_times: "CLEANING TIMES",
sub_cleaning_times_disabled: "CLEANING TIMES — entity not enabled",
sub_suction: "SUCTION",
sub_wetness: "WETNESS LEVEL",
sub_wetness_disabled: "WETNESS — entity not enabled",
// Confirmations / alerts
confirm_warnings_one: "The robot has the following warning:\n\n{messages}\n\nStart cleaning anyway?",
confirm_warnings_many: "The robot has the following warnings:\n\n{messages}\n\nStart cleaning anyway?",
alert_select_room_first: "Select at least one room first.",
alert_missing_select: "Could not find \"{label}\" as a select entity.\n\nEnable it in Home Assistant:\nSettings → Devices & Services → Dreame Vacuum → click your robot → \"+x disabled entities\" → find and enable \"{label}\".",
alert_missing_entity: "Could not find \"{label}\".\n\nEnable it under Dreame Vacuum → click the robot → \"+x disabled entities\".",
alert_missing_self_clean_btn: "Could not find the \"Self Clean\" button. Enable \"{id}\" under the Dreame Vacuum integration.",
alert_missing_self_clean_freq: "Could not find \"Self Clean Frequency\". Enable it under Dreame Vacuum → \"+x disabled entities\".",
},
da: {
robot_vacuum: "Robotstøvsuger",
fallback_title: "Dreame Robotstøvsuger",
state_idle: "Inaktiv",
stat_battery: "Batteri",
stat_area: "Areal",
stat_time: "Tid",
stat_mode: "Tilstand",
section_rooms: "Rum",
rooms_selected: "{count} valgt",
room_state_selected: "Valgt",
btn_clean_selected: "Rengør valgte rum",
btn_clean_all: "Rengør alle rum",
btn_clear: "Ryd alle valg",
alert_action_needed: "Handling kræves",
alert_more: "+{n} flere",
overlay_paused: "PAUSE",
overlay_cleaning: "RENSER",
overlay_label_present_location: "Befinder sig i:",
overlay_label_room_cleaning: "Renser rum:",
overlay_pause: "Pause",
overlay_resume: "Fortsæt",
overlay_self_clean: "Selvrens",
overlay_end_job: "Afslut",
job_badge_one_room: "{n} rum",
job_badge_rooms: "{n} rum",
job_badge_selected: "Valgte",
job_badge_all_rooms: "Alle rum",
fallback_task_cleaning: "Renser",
modal_title: "AVANCERET",
modal_subtitle: "Rengøringsprofil og adfærd",
modal_close: "Luk",
modal_locate: "Find robotten",
tab_cleaning: "Rengøring",
tab_cleangenius: "CleanGenius",
tab_custom: "Brugerdefineret",
tab_behavior: "Adfærd",
tab_dock: "Dock",
section_schedule_audio: "TIDSPLAN & LYD",
section_preferences: "PRÆFERENCER",
section_carpets: "TÆPPER",
toggle_dnd_title: "Forstyr ikke",
toggle_dnd_sub: "Robotten er stille i indstillede timer",
label_dnd_start: "Starttid",
label_dnd_end: "Sluttid",
label_volume: "Lydstyrke",
toggle_resume_title: "Genoptag efter pause",
toggle_resume_sub: "Fortsæt rengøring efter strømafbrydelse",
toggle_child_lock_title: "Børnesikring",
toggle_child_lock_sub: "Lås kontroller på dock'en",
toggle_carpet_boost_title: "Tæppe-boost",
toggle_carpet_boost_sub: "Mere sug på tæpper",
toggle_carpet_avoid_title: "Undgå tæpper ved mop",
toggle_carpet_avoid_sub: "Spring tæpper over under mop-opgaver",
toggle_auto_mount_mop_title: "Auto-monter mop",
toggle_auto_mount_mop_sub: "Robotten på/afmonterer selv moppen",
section_auto_empty: "AUTO-TØMNING",
section_mop_care: "MOP-PLEJE",
toggle_auto_empty_title: "Auto-tømning",
toggle_auto_empty_sub: "Tøm støvbeholder ind i dock'en automatisk",
label_auto_empty_freq: "Tøm-hyppighed",
toggle_auto_detergent_title: "Auto-tilsæt sæbe",
toggle_auto_detergent_sub: "Tilsæt sæbe til mop-vand automatisk",
label_drying_time: "Tørretid",
section_quick_actions: "HURTIGE HANDLINGER",
action_base_station_cleaning: "Rens dock",
no_settings: "Ingen relevante entiteter er aktiveret i Home Assistant.",
section_cleangenius_mode: "TILSTAND",
section_cleangenius_mode_info: "Vælg hvor grundigt CleanGenius skal arbejde",
section_cleangenius_behaviour: "CLEANGENIUS ADFÆRD",
section_cleaning_mode: "RENGØRINGSTILSTAND",
section_cleaning_times: "ANTAL GANGE",
toggle_customized_title: "Tilpasset rengøring",
toggle_customized_sub: "Brug indstillinger pr. rum i stedet for globale",
section_per_room: "PR. RUM",
section_per_room_info: "Hvert rum bruger sine egne indstillinger nedenfor",
section_suction: "SUGEEFFEKT",
toggle_maxplus_title: "Max+",
toggle_maxplus_sub: "Boost sugeeffekten ud over turbo",
section_mop_humidity: "MOP-FUGT",
wetness_label_dry: "Let tør",
wetness_label_damp: "Fugtig",
wetness_label_wet: "Våd",
section_mop_washing: "MOP-VASK",
label_wash_every: "Vask hver",
section_route: "RUTE",
sub_cleaning_times: "ANTAL GANGE",
sub_cleaning_times_disabled: "ANTAL GANGE — entitet ikke aktiveret",
sub_suction: "SUGEEFFEKT",
sub_wetness: "FUGTNIVEAU",
sub_wetness_disabled: "FUGT — entitet ikke aktiveret",
confirm_warnings_one: "Robotten har følgende advarsel:\n\n{messages}\n\nVil du starte rengøring alligevel?",
confirm_warnings_many: "Robotten har følgende advarsler:\n\n{messages}\n\nVil du starte rengøring alligevel?",
alert_select_room_first: "Vælg mindst ét rum først.",
alert_missing_select: "Kunne ikke finde \"{label}\" som select-entitet.\n\nAktiver den i Home Assistant:\nIndstillinger → Enheder og tjenester → Dreame Vacuum → klik på din robot → \"+x deaktiverede enheder\" → find og aktivér \"{label}\".",
alert_missing_entity: "Kunne ikke finde \"{label}\".\n\nAktiver den under Dreame Vacuum → klik på robotten → \"+x deaktiverede enheder\".",
alert_missing_self_clean_btn: "Kunne ikke finde \"Self Clean\"-knappen. Aktivér \"{id}\" under Dreame Vacuum-integrationen.",
alert_missing_self_clean_freq: "Kunne ikke finde \"Self Clean Frequency\". Aktivér den under Dreame Vacuum → \"+x deaktiverede enheder\".",
},
// -------------------------------------------------------------------------
// Stubs for the remaining languages that the dreame_vacuum integration
// ships translations for. Empty objects fall through to English at runtime.
// Contributors: copy any key from TRANSLATIONS.en or TRANSLATIONS.da, paste
// it into the language you want to fill in, and translate the value.
// (pt covers pt-BR; zh covers both zh-Hans and zh-Hant, since `hass.locale`
// is sliced to 2 chars in `_t()`.)
// -------------------------------------------------------------------------
ca: {}, cs: {}, de: {}, el: {}, es: {}, fr: {}, hu: {}, it: {},
ko: {}, nl: {}, pl: {}, pt: {}, ro: {}, ru: {}, sl: {}, sv: {},
uk: {}, zh: {},
};
// =============================================================================
// Localized Dreame labels — Danish translations of the English dictionaries
// above. Looked up by name (so the original English consts don't need to be
// modified). Add new languages by mirroring the structure here.
// =============================================================================
const LABEL_NAMES = new Map();
const LOCALIZED_LABELS = {
da: {
vacuum_state: {
unknown: "Ukendt", sweeping: "Støvsuger", charging: "Oplader", error: "Fejl",
idle: "Inaktiv", paused: "Pause", returning: "Tilbage til dock", mopping: "Mopper",
drying: "Tørrer", washing: "Vasker", returning_to_wash: "Tilbage til vask",
building: "Kortlægger", sweeping_and_mopping: "Støvsuger og mopper",
charging_completed: "Opladet", upgrading: "Opdaterer", clean_summon: "Tilkaldt rengøring",
station_reset: "Station nulstilles", returning_install_mop: "Tilbage for at montere mop",
returning_remove_mop: "Tilbage for at afmontere mop", water_check: "Vandkontrol",
clean_add_water: "Renser og tilsætter vand", washing_paused: "Vask pauseret",
auto_emptying: "Auto-tømmer", remote_control: "Fjernstyret", smart_charging: "Smart-oplader",
second_cleaning: "Anden rengøring", human_following: "Følger person",
spot_cleaning: "Pletrengøring", returning_auto_empty: "Tilbage til auto-tømning",
waiting_for_task: "Venter på opgave", station_cleaning: "Station-rengøring",
returning_to_drain: "Tilbage for at tømme", draining: "Tømmer",
auto_water_draining: "Auto-vandtømning", emptying: "Tømmer",
dust_bag_drying: "Støvpose tørrer", dust_bag_drying_paused: "Støvpose-tørring pauseret",
heading_to_extra_cleaning: "På vej til ekstra rengøring", extra_cleaning: "Ekstra rengøring",
finding_pet_paused: "Finder kæledyr pauseret", finding_pet: "Finder kæledyr",
shortcut: "Genvej", monitoring: "Overvåger", monitoring_paused: "Overvågning pauseret",
initial_deep_cleaning: "Første dyb rengøring",
initial_deep_cleaning_paused: "Første dyb rengøring pauseret",
sanitizing: "Desinficerer", sanitizing_with_dry: "Desinficerer med tørring",
changing_mop: "Skifter mop", changing_mop_paused: "Mopskifte pauseret",
floor_maintaining: "Vedligeholder gulv", floor_maintaining_paused: "Gulvvedligehold pauseret",
docked: "I dock", sleeping: "Sover", standby: "Standby",
},
vacuum_status: {
unknown: "Ukendt", idle: "Inaktiv", paused: "Pause", cleaning: "Rengør",
returning: "Tilbage til dock", spot_cleaning: "Pletrengøring",
follow_wall_cleaning: "Følger væg", charging: "Oplader", ota: "OTA-opdatering",
fct: "FCT", wifi_set: "WiFi-opsætning", power_off: "Slukket", factory: "Fabrik",
error: "Fejl", remote_control: "Fjernstyret", sleeping: "Sover",
self_repair: "Selvreparation", factory_test: "Fabrikstest", standby: "Standby",
room_cleaning: "Rum-rengøring", zone_cleaning: "Zone-rengøring",
fast_mapping: "Hurtig kortlægning", cruising_path: "Patruljerer rute",
cruising_point: "Patruljerer punkt", summon_clean: "Tilkaldt rengøring",
shortcut: "Genvej", person_follow: "Følger person", water_check: "Vandkontrol",
docked: "I dock",
},
task_status: {
unknown: "Ukendt", completed: "Færdig", cleaning: "Rengør",
zone_cleaning: "Zone-rengøring", room_cleaning: "Rum-rengøring",
spot_cleaning: "Pletrengøring", fast_mapping: "Hurtig kortlægning",
cleaning_paused: "Rengøring pauseret", room_cleaning_paused: "Rum-rengøring pauseret",
zone_cleaning_paused: "Zone-rengøring pauseret",
spot_cleaning_paused: "Pletrengøring pauseret",
map_cleaning_paused: "Kort-rengøring pauseret", docking_paused: "Dock pauseret",
mopping_paused: "Mop pauseret", cruising_path: "Patruljerer rute",
cruising_point: "Patruljerer punkt", station_cleaning: "Station-rengøring",
},
wash_base: {
washing: "Mop vaskes", drying: "Mop tørres", paused: "Mop-vask pauseret",
returning: "Tilbage til vask", clean_add_water: "Tilsæt vand til selvrens",
adding_water: "Tilsætter vand",
},
charging_status: {
charging: "Oplader", return_to_charge: "Tilbage til opladning",
charging_completed: "Opladet",
},
low_water: {
no_water_left_dismiss: "Tjek rentvandstanken", no_water_left: "Rentvandstank tom",
no_water_left_after_clean: "Fyld vand + tøm beskidt vand",
no_water_for_clean: "Lavt vand — skiftet til kun støvsugning",
low_water: "Vandniveau lavt — fyld snart",
tank_not_installed: "Rentvandstank ikke installeret",
},
clean_water_tank: {
not_installed: "Rentvandstank mangler", low_water: "Genopfyld rent vand",
},
dirty_water_tank: {
not_installed_or_full: "Tøm beskidt vandtank",
},
dust_bag: {
not_installed: "Støvpose mangler", check: "Tjek støvpose",
},
detergent: {
low_detergent: "Genopfyld sæbe",
},
dust_collection: {
over_use: "Tøm støvbeholder (overbrugt)",
},
drainage: {
draining: "Station tømmer", draining_failed: "Tømning fejlede",
},
mop_status: {
not_installed: "Moppude ikke installeret",
},
// ---- Display-only translations of option values served by HA's Dreame
// integration. The `data-...` attributes keep the original English value
// (used in service calls); only the on-screen label is replaced. ----
suction_level_opt: {
quiet: "Stille", silent: "Stille",
standard: "Standard", normal: "Standard",
strong: "Stærk", turbo: "Turbo", max: "Maks",
},
cleaning_mode_opt: {
sweeping: "Støvsugning", mopping: "Mop",
sweeping_and_mopping: "Støvsug og mop",
mopping_after_sweeping: "Mop efter støvsug",
custom: "Brugerdefineret",
},
cleaning_route_opt: {
quick: "Hurtig", fast: "Hurtig",
standard: "Standard",
deep: "Grundig", thorough: "Grundig",
},
cleangenius_opt: {
off: "Fra", on: "Til",
routine: "Rutine", daily: "Daglig",
deep: "Grundig",
},
cleangenius_mode_opt: {
standard: "Standard", daily: "Daglig",
quick: "Hurtig", deep: "Grundig",
},
mop_pad_humidity_opt: {
low: "Lav", medium: "Mellem", high: "Høj",
max: "Maks", dry: "Tør", wet: "Våd",
},
self_clean_frequency_opt: {
by_area: "Pr. areal", by_time: "Pr. tid", by_room: "Pr. rum",
off: "Fra",
},
auto_empty_freq_opt: {
smart: "Smart", auto: "Auto",
always: "Altid", never: "Aldrig", off: "Fra", on: "Til",
low: "Lav", high: "Høj",
},
error: {
drop: "Hjul hænger", cliff: "Klippesensor-fejl", bumper: "Stødsensor sidder fast",
gesture: "Robotten er skæv", bumper_repeat: "Stødsensor sidder fast",
drop_repeat: "Hjul hænger", optical_flow: "Optisk flow-sensor fejl",
no_box: "Støvbeholder ikke installeret", no_tank_box: "Vandtank ikke installeret",
water_box_empty: "Vandtank er tom", box_full: "Filter blokeret eller vådt",
brush: "Hovedbørste viklet", side_brush: "Sidebørste viklet",
fan: "Filter blokeret eller vådt", left_wheel_motor: "Venstre hjul blokeret",
right_wheel_motor: "Højre hjul blokeret", turn_suffocate: "Robotten sidder fast",
forward_suffocate: "Robotten kan ikke køre frem", charger_get: "Kan ikke finde dock",
battery_low: "Lavt batteri", charge_fault: "Opladningsfejl",
battery_percentage: "Batteri-niveau-fejl", heart: "Intern fejl",
camera_occlusion: "Kamera blokeret", remove_mop: "Mop færdig — fjern og rengør moppude",
mop_removed: "Moppude faldt af", mop_pad_stop_rotate: "Moppude stoppede med at rotere",
bin_full: "Støvopsamlings-pose fuld", bin_open: "Auto-tømnings-låg åbent",
water_tank: "Rentvandstank ikke installeret",
dirty_water_tank: "Beskidt vandtank fuld eller mangler",
water_tank_dry: "Genopfyld rentvandstank",
dirty_water_tank_blocked: "Beskidt vandtank blokeret",
dirty_water_tank_pump: "Beskidt vandtank pumpefejl",
mop_pad: "Vaskebræt ikke installeret korrekt", wet_mop_pad: "Rens vaskebrættet",
clean_mop_pad: "Rengøring færdig — rens vaskebrættet",
clean_tank_level: "Tjek og fyld rentvandstank",
station_disconnected: "Basestation ikke tændt",
dirty_tank_level: "Beskidt vandtank for fuld",
washboard_level: "Vaskebræt-vand for højt", no_mop_in_station: "Moppude ikke i station",
dust_bag_full: "Støvpose fuld", mop_install_failed: "Moppude-installation mislykkedes",
low_battery_turn_off: "Lavt batteri — slukker",
dirty_tank_not_installed: "Beskidt vandtank ikke installeret",
robot_in_hidden_room: "Skjult område — flyt robotten",
robot_stuck: "Robotten sidder fast",
robot_stuck_repeat: "Robot fast — flyt til åbent område",
robot_stuck_on_tables: "Robot fast blandt borde/stole",
robot_stuck_on_passage: "Robot fast i smal passage",
robot_stuck_on_threshold: "Robot fast ved tærskel/trin",
robot_stuck_on_low_lying_area: "Robot fast under lavt møbel",
robot_stuck_on_ramp: "Robot fandt farlig rampe",
robot_stuck_on_obstacle: "Robot blokeret af forhindring",
robot_stuck_on_pet: "Robot opdagede kæledyr/person",
robot_stuck_on_slippery_surface: "Robot glider",
robot_stuck_on_carpet: "Robot glider på tæppe",
robot_stuck_on_curtain: "Robot glider i gardiner",
blocked: "Rute blokeret — tilbage til dock",
carpet: "Start robotten uden for tæppet",
laser: "3D-forhindringssensor-fejl", ultrasonic: "Ultralyd-sensor-fejl",
no_go_zone: "No-Go-zone fundet", route: "Rute blokeret",
restricted: "Robot i begrænset område", drainage_failed: "Vandtømning fejlede",
mop_not_detected: "Mop ikke fundet", mop_holder_error: "Mopholder-fejl i dock",
dock_error: "Dock-fejl", wash_failed: "Mop-vask fejlede",
edge_mop_stop_rotate: "Kantmop stoppede med at rotere",
edge_mop_detached: "Kantmop faldt af", chassis_lift_malfunction: "Chassis-løft fejler",
mop_cover_error: "Tjek aflejringer ved rulle-mop",
roller_mop_error: "Tjek aflejringer ved rulle-mop",
onboard_water_tank_empty: "Robotens vandbeholder lavt",
onboard_dirty_water_tank_full: "Robotens brugte vandbeholder fuld",
mop_not_installed: "Mop ikke installeret", fluffing_roller_error: "Fluff-rulle-fejl",
blocked_by_obstacle: "Blokeret af forhindring",
internal_error: "Intern fejl — prøv at genstarte",
},
},
// -------------------------------------------------------------------------
// Stubs for the remaining languages that the dreame_vacuum integration
// supports. Empty objects fall through to the English source dicts.
// Contributors: mirror the structure of `da` above to add a translation.
// -------------------------------------------------------------------------
ca: {}, cs: {}, de: {}, el: {}, es: {}, fr: {}, hu: {}, it: {},
ko: {}, nl: {}, pl: {}, pt: {}, ro: {}, ru: {}, sl: {}, sv: {},
uk: {}, zh: {},
};
LABEL_NAMES.set(VACUUM_STATE_LABELS, "vacuum_state");
LABEL_NAMES.set(VACUUM_STATUS_LABELS, "vacuum_status");
LABEL_NAMES.set(TASK_STATUS_LABELS, "task_status");
LABEL_NAMES.set(WASH_BASE_LABELS, "wash_base");
LABEL_NAMES.set(CHARGING_STATUS_LABELS, "charging_status");
LABEL_NAMES.set(LOW_WATER_LABELS, "low_water");
LABEL_NAMES.set(CLEAN_WATER_TANK_LABELS,"clean_water_tank");
LABEL_NAMES.set(DIRTY_WATER_TANK_LABELS,"dirty_water_tank");
LABEL_NAMES.set(DUST_BAG_LABELS, "dust_bag");
LABEL_NAMES.set(DETERGENT_LABELS, "detergent");
LABEL_NAMES.set(DUST_COLLECTION_LABELS, "dust_collection");
LABEL_NAMES.set(DRAINAGE_LABELS, "drainage");
LABEL_NAMES.set(MOP_STATUS_LABELS, "mop_status");
LABEL_NAMES.set(ERROR_LABELS, "error");
class DreameVacuumCard extends HTMLElement {
setConfig(config) {
if (!config.entity) throw new Error("You must define an entity");
this.config = {
// title: defaults to the entity's friendly_name at render-time
// image: optional path to a robot image (e.g. "/local/my-robot.png").
// Falls back to a built-in icon when not set.
...config,
};
this.selectedRooms = new Set();
this.advancedOpen = false;
this.activeAdvancedTab = "cleaning"; // default: Cleaning (CleanGenius/Custom)
this.expandedRooms = new Set(); // tracks which rooms are expanded in the per-room accordion
this._globalCleaningTimes = this._loadCleaningTimes(); // 1, 2 or 3 — passed as `repeats` to the clean service
}
// Persist the user's "Cleaning times" choice (1x / 2x / 3x) per entity.
_cleaningTimesKey() {
return `dreamecard:${this.config?.entity || "default"}:cleaning-times`;
}
_loadCleaningTimes() {
try {
const v = parseInt(localStorage.getItem(this._cleaningTimesKey()), 10);
return v >= 1 && v <= 3 ? v : 1;
} catch (e) { return 1; }
}
_saveCleaningTimes(v) {
try { localStorage.setItem(this._cleaningTimesKey(), String(v)); } catch (e) {}
}
// Look up a translation by key. Substitutes `{name}` placeholders from `vars`.
// Falls back to English when the active language is missing a key, and to
// the key itself if even English has no entry.
_t(key, vars) {
const lang = String(
this._hass?.locale?.language || this._hass?.language || "en"
).slice(0, 2);
const dict = TRANSLATIONS[lang] || TRANSLATIONS.en;
let str = dict[key] != null ? dict[key] : (TRANSLATIONS.en[key] != null ? TRANSLATIONS.en[key] : key);
if (vars) {
for (const k in vars) {
str = str.split("{" + k + "}").join(String(vars[k]));
}
}
return str;
}
// Persistent storage for the last selected CleanGenius mode (per-entity).
// Stored in localStorage so it survives page reloads within the same browser.
get _lastCleanGeniusMode() {
if (this._memLastCG !== undefined) return this._memLastCG;
try {
const key = `dreamecard:${this.config?.entity || "default"}:last-cleangenius`;
const stored = localStorage.getItem(key);
this._memLastCG = stored || null;
return this._memLastCG;
} catch (e) {
return null;
}
}
set _lastCleanGeniusMode(value) {
this._memLastCG = value || null;
try {
const key = `dreamecard:${this.config?.entity || "default"}:last-cleangenius`;
if (value) localStorage.setItem(key, value);
} catch (e) {}
}
// Track which button started the currently-running job ("selected" / "all")
_activeJobKey() {
return `dreamecard:${this.config?.entity || "default"}:active-job`;
}
_setActiveJob(type) {
try { localStorage.setItem(this._activeJobKey(), type); } catch (e) {}
}
_getActiveJob() {
try { return localStorage.getItem(this._activeJobKey()) || null; } catch (e) { return null; }
}
_clearActiveJob() {
try { localStorage.removeItem(this._activeJobKey()); } catch (e) {}
}
// Helpers for persisting the active job's selected rooms across navigation/reload
_segmentsKey() {
return `dreamecard:${this.config?.entity || "default"}:active-segments`;
}
_saveSelectedRooms() {
try {
const arr = Array.from(this.selectedRooms);
if (arr.length) localStorage.setItem(this._segmentsKey(), JSON.stringify(arr));
} catch (e) {}
}
_loadSelectedRooms() {
try {
// Only restore stored selection if there's a known active job. Otherwise the data
// is stale from a previous session — wipe it so we don't show ghost checkmarks.
if (!this._getActiveJob()) {
this._clearSavedSelection();
return;
}
const stored = localStorage.getItem(this._segmentsKey());
if (!stored) return;
const arr = JSON.parse(stored);
if (Array.isArray(arr)) arr.forEach(s => this.selectedRooms.add(Number(s)));
} catch (e) {}
}
_clearSavedSelection() {
try { localStorage.removeItem(this._segmentsKey()); } catch (e) {}
}
// Wipe both the active-job tracker AND any room selection. Called when a job
// transitions to "fully done" so the front-page room checkmarks reset.
_clearJobAndSelection() {
this._clearActiveJob();
this.selectedRooms.clear();
this._clearSavedSelection();
}
// Classify the robot's current overall situation. Used both for the overlay
// visibility and for selection/active-job persistence.
_getRobotStatus() {
const e = this._hass?.states[this.config?.entity];
if (!e) return "truly_idle";
const stateStr = String(e.state).toLowerCase();
const statusStr = String(e.attributes?.status || "").toLowerCase().trim();
const inactiveStates = new Set(["docked", "idle", "charging", "error", "unavailable", "unknown", "sleeping", "standby", "off", ""]);
// Use Dreame's task_status sensor as the most authoritative signal of whether
// the cleaning task is still running. This survives state transitions to
// "docked" mid-job (e.g. during a mid-cleaning mop wash) so we don't close
// the overlay prematurely.
const prefix = this.getEntityPrefix();
const taskStatusEntity = prefix ? this._hass.states[`sensor.${prefix}_task_status`] : null;
const taskStatusValue = String(taskStatusEntity?.state || "").toLowerCase().trim();
const isTaskCompleted = /^(completed|finished|done|stopped|terminated|idle)$/.test(taskStatusValue);
const isTaskInProgress = /^(in[\s_-]?progress|cleaning|running|active|paused)$/.test(taskStatusValue);
// Patterns that mean "the dock is actively doing something for the robot right now"
const isActiveDockWork = /^(washing|drying|self.?clean(ing)?|mop[\s_-]?(wash|dry)(ing)?)$/i.test(statusStr);
const hasActiveJob = !!this._getActiveJob();
// ===== State is an ACTIVE value (cleaning/mopping/returning/sweeping/paused) =====
if (!inactiveStates.has(stateStr)) {
const isDockMaint = /charg|self.?clean|self.?wash|wash|dry/.test(statusStr);
if (!isDockMaint) return "in_room_cleaning";
if (hasActiveJob || isTaskInProgress) return "mid_job_dock";
return "dock_idle_maintenance";
}
// ===== State is INACTIVE (docked/idle/charging/sleeping/etc.) =====
// Dreame says task is fully completed → close overlay
if (isTaskCompleted) return "truly_idle";
// task_status sensor says the task is still in progress — likely a mid-job
// dock visit (mop wash / drying). Keep overlay open if the dock is actively
// doing work; otherwise treat as idle.
if (isTaskInProgress) {
if (isActiveDockWork) return "mid_job_dock";
return "truly_idle";
}
// No task_status sensor available — fall back to local active-job tracker
// combined with status text. Only keep overlay if the dock is clearly working.
if (hasActiveJob && isActiveDockWork) return "mid_job_dock";
return "truly_idle";
}
_isVacuumActive() {
const s = this._getRobotStatus();
return s === "in_room_cleaning" || s === "mid_job_dock";
}
set hass(hass) {
const isFirstHass = !this._hass;
this._hass = hass;
const currentRobotStatus = this._getRobotStatus();
if (isFirstHass) {
this._loadSelectedRooms();
// If we were navigated away during a job and the robot has finished while we were
// gone, clean up the leftover selection now.
if (currentRobotStatus === "truly_idle" && this._getActiveJob()) {
this._clearJobAndSelection();
}
} else {
// Detect transition from active → truly_idle = the job just ended.
// Clear room selection + active-job tracker so the front-page checkmarks disappear.
const wasActive = this._lastRobotStatus && this._lastRobotStatus !== "truly_idle";
if (currentRobotStatus === "truly_idle") {
if (wasActive) {
this._clearJobAndSelection();
} else {
// Robot has been idle the whole time — just make sure tracker is clear
this._clearActiveJob();
}
}
}
this._lastRobotStatus = currentRobotStatus;
// Skip the render entirely while a CSS animation (e.g. the CleanGenius