Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 70238a6

Browse files
Add border spin switch to Ecovacs (home-assistant#155512)
1 parent 5b8d373 commit 70238a6

File tree

6 files changed

+315
-2
lines changed

6 files changed

+315
-2
lines changed

‎homeassistant/components/ecovacs/icons.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
"advanced_mode": {
161161
"default": "mdi:tune"
162162
},
163+
"border_spin": {
164+
"default": "mdi:rotate-right"
165+
},
163166
"border_switch": {
164167
"default": "mdi:land-fields"
165168
},

‎homeassistant/components/ecovacs/strings.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@
231231
"advanced_mode": {
232232
"name": "Advanced mode"
233233
},
234+
"border_spin": {
235+
"name": "Border spin"
236+
},
234237
"border_switch": {
235238
"name": "Border switch"
236239
},

‎homeassistant/components/ecovacs/switch.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ class EcovacsSwitchEntityDescription(
9999
entity_registry_enabled_default=False,
100100
entity_category=EntityCategory.CONFIG,
101101
),
102+
EcovacsSwitchEntityDescription(
103+
capability_fn=lambda c: c.settings.border_spin,
104+
key="border_spin",
105+
translation_key="border_spin",
106+
entity_registry_enabled_default=False,
107+
entity_category=EntityCategory.CONFIG,
108+
),
102109
)
103110

104111

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"did": "E1234567890000000002",
3+
"name": "E1234567890000000002",
4+
"class": "55uoqe",
5+
"resource": "upQ7",
6+
"company": "eco-ng",
7+
"service": {
8+
"jmq": "jmq-ngiot-eu.dc.ww.ecouser.net",
9+
"mqs": "api-ngiot.dc-as.ww.ecouser.net"
10+
},
11+
"deviceName": "DEEBOT Mini",
12+
"icon": "https://portal-ww.ecouser.net/api/pim/file/get/606278df4a84d700082b39f1",
13+
"UILogicId": "DX_9G",
14+
"materialNo": "110-1820-0102",
15+
"pid": "5c19a91ca1e6ee000178224b",
16+
"product_category": "DEEBOT",
17+
"model": "DX9H",
18+
"nick": "DBMini",
19+
"homeSort": 9999,
20+
"status": 1,
21+
"otaUpgrade": {}
22+
}

‎tests/components/ecovacs/snapshots/test_switch.ambr‎

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,243 @@
479479
'state': 'on',
480480
})
481481
# ---
482+
# name: test_switch_entities[55uoqe][switch.dbmini_continuous_cleaning:entity-registry]
483+
EntityRegistryEntrySnapshot({
484+
'aliases': set({
485+
}),
486+
'area_id': None,
487+
'capabilities': None,
488+
'config_entry_id': <ANY>,
489+
'config_subentry_id': <ANY>,
490+
'device_class': None,
491+
'device_id': <ANY>,
492+
'disabled_by': None,
493+
'domain': 'switch',
494+
'entity_category': <EntityCategory.CONFIG: 'config'>,
495+
'entity_id': 'switch.dbmini_continuous_cleaning',
496+
'has_entity_name': True,
497+
'hidden_by': None,
498+
'icon': None,
499+
'id': <ANY>,
500+
'labels': set({
501+
}),
502+
'name': None,
503+
'options': dict({
504+
}),
505+
'original_device_class': None,
506+
'original_icon': None,
507+
'original_name': 'Continuous cleaning',
508+
'platform': 'ecovacs',
509+
'previous_unique_id': None,
510+
'suggested_object_id': None,
511+
'supported_features': 0,
512+
'translation_key': 'continuous_cleaning',
513+
'unique_id': 'E1234567890000000002_continuous_cleaning',
514+
'unit_of_measurement': None,
515+
})
516+
# ---
517+
# name: test_switch_entities[55uoqe][switch.dbmini_carpet_auto_boost_suction:entity-registry]
518+
EntityRegistryEntrySnapshot({
519+
'aliases': set({
520+
}),
521+
'area_id': None,
522+
'capabilities': None,
523+
'config_entry_id': <ANY>,
524+
'config_subentry_id': <ANY>,
525+
'device_class': None,
526+
'device_id': <ANY>,
527+
'disabled_by': None,
528+
'domain': 'switch',
529+
'entity_category': <EntityCategory.CONFIG: 'config'>,
530+
'entity_id': 'switch.dbmini_carpet_auto_boost_suction',
531+
'has_entity_name': True,
532+
'hidden_by': None,
533+
'icon': None,
534+
'id': <ANY>,
535+
'labels': set({
536+
}),
537+
'name': None,
538+
'options': dict({
539+
}),
540+
'original_device_class': None,
541+
'original_icon': None,
542+
'original_name': 'Carpet auto-boost suction',
543+
'platform': 'ecovacs',
544+
'previous_unique_id': None,
545+
'suggested_object_id': None,
546+
'supported_features': 0,
547+
'translation_key': 'carpet_auto_fan_boost',
548+
'unique_id': 'E1234567890000000002_carpet_auto_fan_boost',
549+
'unit_of_measurement': None,
550+
})
551+
# ---
552+
# name: test_switch_entities[55uoqe][switch.dbmini_true_detect:entity-registry]
553+
EntityRegistryEntrySnapshot({
554+
'aliases': set({
555+
}),
556+
'area_id': None,
557+
'capabilities': None,
558+
'config_entry_id': <ANY>,
559+
'config_subentry_id': <ANY>,
560+
'device_class': None,
561+
'device_id': <ANY>,
562+
'disabled_by': None,
563+
'domain': 'switch',
564+
'entity_category': <EntityCategory.CONFIG: 'config'>,
565+
'entity_id': 'switch.dbmini_true_detect',
566+
'has_entity_name': True,
567+
'hidden_by': None,
568+
'icon': None,
569+
'id': <ANY>,
570+
'labels': set({
571+
}),
572+
'name': None,
573+
'options': dict({
574+
}),
575+
'original_device_class': None,
576+
'original_icon': None,
577+
'original_name': 'True detect',
578+
'platform': 'ecovacs',
579+
'previous_unique_id': None,
580+
'suggested_object_id': None,
581+
'supported_features': 0,
582+
'translation_key': 'true_detect',
583+
'unique_id': 'E1234567890000000002_true_detect',
584+
'unit_of_measurement': None,
585+
})
586+
# ---
587+
# name: test_switch_entities[55uoqe][switch.dbmini_child_lock:entity-registry]
588+
EntityRegistryEntrySnapshot({
589+
'aliases': set({
590+
}),
591+
'area_id': None,
592+
'capabilities': None,
593+
'config_entry_id': <ANY>,
594+
'config_subentry_id': <ANY>,
595+
'device_class': None,
596+
'device_id': <ANY>,
597+
'disabled_by': None,
598+
'domain': 'switch',
599+
'entity_category': <EntityCategory.CONFIG: 'config'>,
600+
'entity_id': 'switch.dbmini_child_lock',
601+
'has_entity_name': True,
602+
'hidden_by': None,
603+
'icon': None,
604+
'id': <ANY>,
605+
'labels': set({
606+
}),
607+
'name': None,
608+
'options': dict({
609+
}),
610+
'original_device_class': None,
611+
'original_icon': None,
612+
'original_name': 'Child lock',
613+
'platform': 'ecovacs',
614+
'previous_unique_id': None,
615+
'suggested_object_id': None,
616+
'supported_features': 0,
617+
'translation_key': 'child_lock',
618+
'unique_id': 'E1234567890000000002_child_lock',
619+
'unit_of_measurement': None,
620+
})
621+
# ---
622+
# name: test_switch_entities[55uoqe][switch.dbmini_border_spin:entity-registry]
623+
EntityRegistryEntrySnapshot({
624+
'aliases': set({
625+
}),
626+
'area_id': None,
627+
'capabilities': None,
628+
'config_entry_id': <ANY>,
629+
'config_subentry_id': <ANY>,
630+
'device_class': None,
631+
'device_id': <ANY>,
632+
'disabled_by': None,
633+
'domain': 'switch',
634+
'entity_category': <EntityCategory.CONFIG: 'config'>,
635+
'entity_id': 'switch.dbmini_border_spin',
636+
'has_entity_name': True,
637+
'hidden_by': None,
638+
'icon': None,
639+
'id': <ANY>,
640+
'labels': set({
641+
}),
642+
'name': None,
643+
'options': dict({
644+
}),
645+
'original_device_class': None,
646+
'original_icon': None,
647+
'original_name': 'Border spin',
648+
'platform': 'ecovacs',
649+
'previous_unique_id': None,
650+
'suggested_object_id': None,
651+
'supported_features': 0,
652+
'translation_key': 'border_spin',
653+
'unique_id': 'E1234567890000000002_border_spin',
654+
'unit_of_measurement': None,
655+
})
656+
# ---
657+
# name: test_switch_entities[55uoqe][switch.dbmini_continuous_cleaning:state]
658+
StateSnapshot({
659+
'attributes': ReadOnlyDict({
660+
'friendly_name': 'DBMini Continuous cleaning',
661+
}),
662+
'context': <ANY>,
663+
'entity_id': 'switch.dbmini_continuous_cleaning',
664+
'last_changed': <ANY>,
665+
'last_reported': <ANY>,
666+
'last_updated': <ANY>,
667+
'state': 'on',
668+
})
669+
# ---
670+
# name: test_switch_entities[55uoqe][switch.dbmini_carpet_auto_boost_suction:state]
671+
StateSnapshot({
672+
'attributes': ReadOnlyDict({
673+
'friendly_name': 'DBMini Carpet auto-boost suction',
674+
}),
675+
'context': <ANY>,
676+
'entity_id': 'switch.dbmini_carpet_auto_boost_suction',
677+
'last_changed': <ANY>,
678+
'last_reported': <ANY>,
679+
'last_updated': <ANY>,
680+
'state': 'on',
681+
})
682+
# ---
683+
# name: test_switch_entities[55uoqe][switch.dbmini_true_detect:state]
684+
StateSnapshot({
685+
'attributes': ReadOnlyDict({
686+
'friendly_name': 'DBMini True detect',
687+
}),
688+
'context': <ANY>,
689+
'entity_id': 'switch.dbmini_true_detect',
690+
'last_changed': <ANY>,
691+
'last_reported': <ANY>,
692+
'last_updated': <ANY>,
693+
'state': 'on',
694+
})
695+
# ---
696+
# name: test_switch_entities[55uoqe][switch.dbmini_child_lock:state]
697+
StateSnapshot({
698+
'attributes': ReadOnlyDict({
699+
'friendly_name': 'DBMini Child lock',
700+
}),
701+
'context': <ANY>,
702+
'entity_id': 'switch.dbmini_child_lock',
703+
'last_changed': <ANY>,
704+
'last_reported': <ANY>,
705+
'last_updated': <ANY>,
706+
'state': 'on',
707+
})
708+
# ---
709+
# name: test_switch_entities[55uoqe][switch.dbmini_border_spin:state]
710+
StateSnapshot({
711+
'attributes': ReadOnlyDict({
712+
'friendly_name': 'DBMini Border spin',
713+
}),
714+
'context': <ANY>,
715+
'entity_id': 'switch.dbmini_border_spin',
716+
'last_changed': <ANY>,
717+
'last_reported': <ANY>,
718+
'last_updated': <ANY>,
719+
'state': 'on',
720+
})
721+
# ---

‎tests/components/ecovacs/test_switch.py‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from deebot_client.command import Command
66
from deebot_client.commands.json import (
77
SetAdvancedMode,
8+
SetBorderSpin,
89
SetBorderSwitch,
910
SetCarpetAutoFanBoost,
1011
SetChildLock,
@@ -16,6 +17,7 @@
1617
)
1718
from deebot_client.events import (
1819
AdvancedModeEvent,
20+
BorderSpinEvent,
1921
BorderSwitchEvent,
2022
CarpetAutoFanBoostEvent,
2123
ChildLockEvent,
@@ -127,8 +129,38 @@ class SwitchTestCase:
127129
),
128130
],
129131
),
132+
(
133+
"55uoqe",
134+
[
135+
SwitchTestCase(
136+
"switch.dbmini_continuous_cleaning",
137+
ContinuousCleaningEvent(True),
138+
SetContinuousCleaning,
139+
),
140+
SwitchTestCase(
141+
"switch.dbmini_carpet_auto_boost_suction",
142+
CarpetAutoFanBoostEvent(True),
143+
SetCarpetAutoFanBoost,
144+
),
145+
SwitchTestCase(
146+
"switch.dbmini_true_detect",
147+
TrueDetectEvent(True),
148+
SetTrueDetect,
149+
),
150+
SwitchTestCase(
151+
"switch.dbmini_child_lock",
152+
ChildLockEvent(True),
153+
SetChildLock,
154+
),
155+
SwitchTestCase(
156+
"switch.dbmini_border_spin",
157+
BorderSpinEvent(True),
158+
SetBorderSpin,
159+
),
160+
],
161+
),
130162
],
131-
ids=["yna5x1", "5xu9h3"],
163+
ids=["yna5x1", "5xu9h3", "55uoqe"],
132164
)
133165
async def test_switch_entities(
134166
hass: HomeAssistant,
@@ -204,8 +236,14 @@ async def test_switch_entities(
204236
"switch.goat_g1_safe_protect",
205237
],
206238
),
239+
(
240+
"55uoqe",
241+
[
242+
"switch.dbmini_border_spin",
243+
],
244+
),
207245
],
208-
ids=["yna5x1", "5xu9h3"],
246+
ids=["yna5x1", "5xu9h3", "55uoqe"],
209247
)
210248
async def test_disabled_by_default_switch_entities(
211249
hass: HomeAssistant, entity_registry: er.EntityRegistry, entity_ids: list[str]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /