Skip to content

Commit

Permalink
feat: removing calendar entity and creating new time and switch entities
Browse files Browse the repository at this point in the history
  • Loading branch information
humbertogontijo committed Jun 14, 2023
1 parent f929300 commit 4da168f
Show file tree
Hide file tree
Showing 22 changed files with 717 additions and 356 deletions.
274 changes: 0 additions & 274 deletions custom_components/roborock/calendar.py

This file was deleted.

8 changes: 5 additions & 3 deletions custom_components/roborock/const.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Constants for Roborock."""
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
from homeassistant.components.calendar import DOMAIN as CALENDAR_DOMAIN
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.time import DOMAIN as TIME_DOMAIN
from homeassistant.components.vacuum import DOMAIN as VACUUM_DOMAIN

DOMAIN = "roborock"
Expand All @@ -21,13 +22,14 @@

BINARY_SENSOR = BINARY_SENSOR_DOMAIN
BUTTON = BUTTON_DOMAIN
CALENDAR = CALENDAR_DOMAIN
CAMERA = CAMERA_DOMAIN
NUMBER = NUMBER_DOMAIN
SELECT = SELECT_DOMAIN
SENSOR = SENSOR_DOMAIN
SWITCH = SWITCH_DOMAIN
TIME = TIME_DOMAIN
VACUUM = VACUUM_DOMAIN
PLATFORMS = [BINARY_SENSOR, BUTTON, CAMERA, CALENDAR, NUMBER, SELECT, SENSOR, VACUUM]
PLATFORMS = [BINARY_SENSOR, BUTTON, CAMERA, NUMBER, SELECT, SENSOR, SWITCH, TIME, VACUUM]

ROCKROBO_V1 = "rockrobo.vacuum.v1"
ROCKROBO_S4 = "roborock.vacuum.s4"
Expand Down
14 changes: 13 additions & 1 deletion custom_components/roborock/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,26 @@ async def fill_sound_volume(self, device_info: RoborockHassDeviceInfo) -> None:
sound_volume = await self.api.get_sound_volume()
device_info.sound_volume = sound_volume

async def fill_flow_led_status(self, device_info: RoborockHassDeviceInfo) -> None:
"""Fetch current sound volume."""
flow_led_status = await self.api.get_flow_led_status()
device_info.flow_led_status = flow_led_status

async def fill_child_lock_status(self, device_info: RoborockHassDeviceInfo) -> None:
"""Fetch current sound volume."""
child_lock_status = await self.api.get_child_lock_status()
device_info.child_lock_status = child_lock_status

async def fill_device_info(self, device_info: RoborockHassDeviceInfo):
"""Merge device information."""
await asyncio.gather(
*([
self.fill_device_prop(device_info),
self.fill_device_multi_maps_list(device_info),
self.fill_room_mapping(device_info),
self.fill_sound_volume(device_info)
self.fill_sound_volume(device_info),
self.fill_flow_led_status(device_info),
self.fill_child_lock_status(device_info),
])
)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/roborock/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"roborock"
],
"requirements": [
"python-roborock==0.23.4"
"python-roborock==0.24.1"
],
"version": "1.0.5"
}
4 changes: 3 additions & 1 deletion custom_components/roborock/roborock_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import dataclass
from typing import Optional, TypedDict

from roborock import DeviceData, DeviceProp
from roborock import ChildLockStatus, DeviceData, DeviceProp, FlowLedStatus


class DeviceNetwork(TypedDict):
Expand Down Expand Up @@ -32,3 +32,5 @@ class RoborockHassDeviceInfo(DeviceData):
room_mapping: Optional[dict[int, str]] = None
current_room: Optional[int] = None
sound_volume: Optional[int] = None
flow_led_status: Optional[FlowLedStatus] = None
child_lock_status: Optional[ChildLockStatus] = None
Loading

0 comments on commit 4da168f

Please sign in to comment.