Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions homeassistant/components/ecovacs/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
}
},
"sensor": {
"auto_empty": {
"default": "mdi:delete-empty"
},
"error": {
"default": "mdi:alert-circle"
},
Expand Down
9 changes: 9 additions & 0 deletions homeassistant/components/ecovacs/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
NetworkInfoEvent,
StatsEvent,
TotalStatsEvent,
auto_empty,
station,
)
from sucks import VacBot
Expand Down Expand Up @@ -158,6 +159,14 @@ def get_area_native_unit_of_measurement(device_type: DeviceType) -> str | None:
device_class=SensorDeviceClass.ENUM,
options=get_options(station.State),
),
EcovacsSensorEntityDescription[auto_empty.AutoEmptyEvent](
capability_fn=lambda caps: caps.station.auto_empty if caps.station else None,
value_fn=lambda e: get_name_key(e.frequency) if e.frequency else None,
key="auto_empty",
translation_key="auto_empty",
device_class=SensorDeviceClass.ENUM,
options=get_options(auto_empty.Frequency),
),
)


Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/ecovacs/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@
}
},
"sensor": {
"auto_empty": {
"name": "Auto-empty frequency",
"state": {
"auto": "Auto",
"smart": "Smart"
}
},
"error": {
"name": "Error",
"state_attributes": {
Expand Down
64 changes: 64 additions & 0 deletions tests/components/ecovacs/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,70 @@
'state': 'Testnetwork',
})
# ---
# name: test_sensors[qhe2o2][sensor.dusty_auto_empty_frequency:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Dusty Auto-empty frequency',
'options': list([
'min_10',
'min_15',
'min_25',
'auto',
'smart',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.dusty_auto_empty_frequency',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'auto',
})
# ---
# name: test_sensors[qhe2o2][sensor.dusty_auto_empty_frequency:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'min_10',
'min_15',
'min_25',
'auto',
'smart',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.dusty_auto_empty_frequency',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Auto-empty frequency',
'platform': 'ecovacs',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'auto_empty',
'unique_id': '8516fbb1-17f1-4194-0000001_auto_empty',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[yna5x1][sensor.ozmo_950_area_cleaned:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
Expand Down
3 changes: 3 additions & 0 deletions tests/components/ecovacs/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
NetworkInfoEvent,
StatsEvent,
TotalStatsEvent,
auto_empty,
station,
)
import pytest
Expand Down Expand Up @@ -47,6 +48,7 @@ async def notify_events(hass: HomeAssistant, event_bus: EventBus):
event_bus.notify(LifeSpanEvent(LifeSpan.SIDE_BRUSH, 40, 20 * 60))
event_bus.notify(ErrorEvent(0, "NoError: Robot is operational"))
event_bus.notify(station.StationEvent(station.State.EMPTYING_DUSTBIN))
event_bus.notify(auto_empty.AutoEmptyEvent(True, auto_empty.Frequency.AUTO))
await block_till_done(hass, event_bus)


Expand Down Expand Up @@ -102,6 +104,7 @@ async def notify_events(hass: HomeAssistant, event_bus: EventBus):
"sensor.dusty_wi_fi_rssi",
"sensor.dusty_wi_fi_ssid",
"sensor.dusty_station_state",
"sensor.dusty_auto_empty_frequency",
"sensor.dusty_main_brush_lifespan",
"sensor.dusty_filter_lifespan",
"sensor.dusty_round_mop_lifespan",
Expand Down
Loading