Skip to content

Commit

Permalink
Various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Nov 17, 2022
1 parent 9e9472e commit 1c1854d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 54 deletions.
12 changes: 0 additions & 12 deletions homeassistant/components/xiaomi_miio/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@ class SetupException(Exception):

# Model lists
MODELS_GATEWAY = ["lumi.gateway", "lumi.acpartner"]
MODELS_SWITCH = [
"chuangmi.plug.v1",
"chuangmi.plug.v3",
"chuangmi.plug.hmi208",
"qmi.powerstrip.v1",
"zimi.powerstrip.v2",
"chuangmi.plug.m1",
"chuangmi.plug.m3",
"chuangmi.plug.v2",
"chuangmi.plug.hmi205",
"chuangmi.plug.hmi206",
]
MODELS_FAN = (
MODELS_PURIFIER_MIIO + MODELS_PURIFIER_MIOT + MODELS_FAN_MIIO + MODELS_FAN_MIOT
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/xiaomi_miio/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import logging

from miio.descriptors import SettingType

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand All @@ -26,8 +28,6 @@ async def async_setup_entry(
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
coordinator = hass.data[DOMAIN][config_entry.entry_id][KEY_COORDINATOR]

from miio.descriptors import SettingType

for setting in device.settings().values():
if setting.type == SettingType.Enum:
_LOGGER.debug("Adding new select: %s", setting)
Expand Down
19 changes: 0 additions & 19 deletions homeassistant/components/xiaomi_miio/strings.select.json

This file was deleted.

2 changes: 2 additions & 0 deletions homeassistant/components/xiaomi_miio/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ async def async_setup_entry(
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}

# TODO: special handling for switch devices

switches = filter(
lambda x: x.type == SettingType.Boolean, device.settings().values()
)
Expand Down
23 changes: 2 additions & 21 deletions homeassistant/components/xiaomi_miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,9 @@ async def async_setup_entry(
)
entities.append(vacuum)

async_add_entities(entities, update_before_add=True)
# TODO: add support for custom services (based on actions taking inputs) when implemented in python-miio

"""
TODO: this platform previously exported the following services that are very specific
to specific vacuum integrations supported by python-miio.
rather than hardcoding these, python-miio should be improved to expose enough information
for homeassistant to expose these services dynamically:
* vacuum_remote_control_move
* vacuum_remote_control_move_step
* vacuum_remote_control_start
* vacuum_remote_control_stop
* vacuum_clean_segment
* vacuum_clean_zone
* vacuum_goto
platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service(
SERVICE_START_REMOTE_CONTROL,
{},
XiaomiVacuum.async_remote_control_start.__name__,
)
"""
async_add_entities(entities, update_before_add=True)


class XiaomiVacuum(
Expand Down

0 comments on commit 1c1854d

Please sign in to comment.