mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 07:17:12 +00:00
Bump deebot-client to 13.0.0 (#143823)
This commit is contained in:
parent
f7c1a0c5e6
commit
9b1c6b07f5
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Generic
|
from typing import Generic
|
||||||
|
|
||||||
from deebot_client.capabilities import CapabilityEvent
|
from deebot_client.capabilities import CapabilityEvent
|
||||||
from deebot_client.events.water_info import WaterInfoEvent
|
from deebot_client.events.water_info import MopAttachedEvent
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
@ -32,9 +32,9 @@ class EcovacsBinarySensorEntityDescription(
|
|||||||
|
|
||||||
|
|
||||||
ENTITY_DESCRIPTIONS: tuple[EcovacsBinarySensorEntityDescription, ...] = (
|
ENTITY_DESCRIPTIONS: tuple[EcovacsBinarySensorEntityDescription, ...] = (
|
||||||
EcovacsBinarySensorEntityDescription[WaterInfoEvent](
|
EcovacsBinarySensorEntityDescription[MopAttachedEvent](
|
||||||
capability_fn=lambda caps: caps.water,
|
capability_fn=lambda caps: caps.water.mop_attached if caps.water else None,
|
||||||
value_fn=lambda e: e.mop_attached,
|
value_fn=lambda e: e.value,
|
||||||
key="water_mop_attached",
|
key="water_mop_attached",
|
||||||
translation_key="water_mop_attached",
|
translation_key="water_mop_attached",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
"""Ecovacs image entities."""
|
"""Ecovacs image entities."""
|
||||||
|
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
from deebot_client.capabilities import CapabilityMap
|
from deebot_client.capabilities import CapabilityMap
|
||||||
from deebot_client.device import Device
|
from deebot_client.device import Device
|
||||||
from deebot_client.events.map import CachedMapInfoEvent, MapChangedEvent
|
from deebot_client.events.map import CachedMapInfoEvent, MapChangedEvent
|
||||||
|
from deebot_client.map import Map
|
||||||
|
|
||||||
from homeassistant.components.image import ImageEntity
|
from homeassistant.components.image import ImageEntity
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -47,6 +50,7 @@ class EcovacsMap(
|
|||||||
"""Initialize entity."""
|
"""Initialize entity."""
|
||||||
super().__init__(device, capability, hass=hass)
|
super().__init__(device, capability, hass=hass)
|
||||||
self._attr_extra_state_attributes = {}
|
self._attr_extra_state_attributes = {}
|
||||||
|
self._map = cast(Map, self._device.map)
|
||||||
|
|
||||||
entity_description = EntityDescription(
|
entity_description = EntityDescription(
|
||||||
key="map",
|
key="map",
|
||||||
@ -55,7 +59,7 @@ class EcovacsMap(
|
|||||||
|
|
||||||
def image(self) -> bytes | None:
|
def image(self) -> bytes | None:
|
||||||
"""Return bytes of image or None."""
|
"""Return bytes of image or None."""
|
||||||
if svg := self._device.map.get_svg_map():
|
if svg := self._map.get_svg_map():
|
||||||
return svg.encode()
|
return svg.encode()
|
||||||
|
|
||||||
return None
|
return None
|
||||||
@ -80,4 +84,4 @@ class EcovacsMap(
|
|||||||
Only used by the generic entity update service.
|
Only used by the generic entity update service.
|
||||||
"""
|
"""
|
||||||
await super().async_update()
|
await super().async_update()
|
||||||
self._device.map.refresh()
|
self._map.refresh()
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/ecovacs",
|
"documentation": "https://www.home-assistant.io/integrations/ecovacs",
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["sleekxmppfs", "sucks", "deebot_client"],
|
"loggers": ["sleekxmppfs", "sucks", "deebot_client"],
|
||||||
"requirements": ["py-sucks==0.9.10", "deebot-client==12.5.0"]
|
"requirements": ["py-sucks==0.9.10", "deebot-client==13.0.1"]
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ from typing import Any, Generic
|
|||||||
|
|
||||||
from deebot_client.capabilities import CapabilitySetTypes
|
from deebot_client.capabilities import CapabilitySetTypes
|
||||||
from deebot_client.device import Device
|
from deebot_client.device import Device
|
||||||
from deebot_client.events import WaterInfoEvent, WorkModeEvent
|
from deebot_client.events import WorkModeEvent
|
||||||
|
from deebot_client.events.water_info import WaterAmountEvent
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||||
from homeassistant.const import EntityCategory
|
from homeassistant.const import EntityCategory
|
||||||
@ -31,9 +32,9 @@ class EcovacsSelectEntityDescription(
|
|||||||
|
|
||||||
|
|
||||||
ENTITY_DESCRIPTIONS: tuple[EcovacsSelectEntityDescription, ...] = (
|
ENTITY_DESCRIPTIONS: tuple[EcovacsSelectEntityDescription, ...] = (
|
||||||
EcovacsSelectEntityDescription[WaterInfoEvent](
|
EcovacsSelectEntityDescription[WaterAmountEvent](
|
||||||
capability_fn=lambda caps: caps.water,
|
capability_fn=lambda caps: caps.water.amount if caps.water else None,
|
||||||
current_option_fn=lambda e: get_name_key(e.amount),
|
current_option_fn=lambda e: get_name_key(e.value),
|
||||||
options_fn=lambda water: [get_name_key(amount) for amount in water.types],
|
options_fn=lambda water: [get_name_key(amount) for amount in water.types],
|
||||||
key="water_amount",
|
key="water_amount",
|
||||||
translation_key="water_amount",
|
translation_key="water_amount",
|
||||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -762,7 +762,7 @@ debugpy==1.8.13
|
|||||||
# decora==0.6
|
# decora==0.6
|
||||||
|
|
||||||
# homeassistant.components.ecovacs
|
# homeassistant.components.ecovacs
|
||||||
deebot-client==12.5.0
|
deebot-client==13.0.1
|
||||||
|
|
||||||
# homeassistant.components.ihc
|
# homeassistant.components.ihc
|
||||||
# homeassistant.components.namecheapdns
|
# homeassistant.components.namecheapdns
|
||||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -653,7 +653,7 @@ dbus-fast==2.43.0
|
|||||||
debugpy==1.8.13
|
debugpy==1.8.13
|
||||||
|
|
||||||
# homeassistant.components.ecovacs
|
# homeassistant.components.ecovacs
|
||||||
deebot-client==12.5.0
|
deebot-client==13.0.1
|
||||||
|
|
||||||
# homeassistant.components.ihc
|
# homeassistant.components.ihc
|
||||||
# homeassistant.components.namecheapdns
|
# homeassistant.components.namecheapdns
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Tests for Ecovacs binary sensors."""
|
"""Tests for Ecovacs binary sensors."""
|
||||||
|
|
||||||
from deebot_client.events import WaterAmount, WaterInfoEvent
|
from deebot_client.events.water_info import MopAttachedEvent
|
||||||
import pytest
|
import pytest
|
||||||
from syrupy import SnapshotAssertion
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
@ -43,16 +43,12 @@ async def test_mop_attached(
|
|||||||
assert device_entry.identifiers == {(DOMAIN, device.device_info["did"])}
|
assert device_entry.identifiers == {(DOMAIN, device.device_info["did"])}
|
||||||
|
|
||||||
event_bus = device.events
|
event_bus = device.events
|
||||||
await notify_and_wait(
|
await notify_and_wait(hass, event_bus, MopAttachedEvent(True))
|
||||||
hass, event_bus, WaterInfoEvent(WaterAmount.HIGH, mop_attached=True)
|
|
||||||
)
|
|
||||||
|
|
||||||
assert (state := hass.states.get(state.entity_id))
|
assert (state := hass.states.get(state.entity_id))
|
||||||
assert state == snapshot(name=f"{entity_id}-state")
|
assert state == snapshot(name=f"{entity_id}-state")
|
||||||
|
|
||||||
await notify_and_wait(
|
await notify_and_wait(hass, event_bus, MopAttachedEvent(False))
|
||||||
hass, event_bus, WaterInfoEvent(WaterAmount.HIGH, mop_attached=False)
|
|
||||||
)
|
|
||||||
|
|
||||||
assert (state := hass.states.get(state.entity_id))
|
assert (state := hass.states.get(state.entity_id))
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from deebot_client.command import Command
|
from deebot_client.command import Command
|
||||||
from deebot_client.commands.json import SetWaterInfo
|
from deebot_client.commands.json import SetWaterInfo
|
||||||
from deebot_client.event_bus import EventBus
|
from deebot_client.event_bus import EventBus
|
||||||
from deebot_client.events import WaterAmount, WaterInfoEvent
|
from deebot_client.events.water_info import WaterAmount, WaterAmountEvent
|
||||||
import pytest
|
import pytest
|
||||||
from syrupy import SnapshotAssertion
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ def platforms() -> Platform | list[Platform]:
|
|||||||
|
|
||||||
async def notify_events(hass: HomeAssistant, event_bus: EventBus):
|
async def notify_events(hass: HomeAssistant, event_bus: EventBus):
|
||||||
"""Notify events."""
|
"""Notify events."""
|
||||||
event_bus.notify(WaterInfoEvent(WaterAmount.ULTRAHIGH))
|
event_bus.notify(WaterAmountEvent(WaterAmount.ULTRAHIGH))
|
||||||
await block_till_done(hass, event_bus)
|
await block_till_done(hass, event_bus)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user