mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Use switch instead of toggle entity (#55111)
This commit is contained in:
parent
a08f42e516
commit
9f4f38dbef
@ -8,10 +8,13 @@ from pythinkingcleaner import Discovery, ThinkingCleaner
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import util
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||
from homeassistant.components.switch import (
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchEntity,
|
||||
SwitchEntityDescription,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, STATE_OFF, STATE_ON
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription
|
||||
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
||||
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100)
|
||||
@ -19,16 +22,16 @@ MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100)
|
||||
MIN_TIME_TO_WAIT = timedelta(seconds=5)
|
||||
MIN_TIME_TO_LOCK_UPDATE = 5
|
||||
|
||||
SWITCH_TYPES: tuple[ToggleEntityDescription, ...] = (
|
||||
ToggleEntityDescription(
|
||||
SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = (
|
||||
SwitchEntityDescription(
|
||||
key="clean",
|
||||
name="Clean",
|
||||
),
|
||||
ToggleEntityDescription(
|
||||
SwitchEntityDescription(
|
||||
key="dock",
|
||||
name="Dock",
|
||||
),
|
||||
ToggleEntityDescription(
|
||||
SwitchEntityDescription(
|
||||
key="find",
|
||||
name="Find",
|
||||
),
|
||||
@ -61,10 +64,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(entities)
|
||||
|
||||
|
||||
class ThinkingCleanerSwitch(ToggleEntity):
|
||||
class ThinkingCleanerSwitch(SwitchEntity):
|
||||
"""ThinkingCleaner Switch (dock, clean, find me)."""
|
||||
|
||||
def __init__(self, tc_object, update_devices, description: ToggleEntityDescription):
|
||||
def __init__(self, tc_object, update_devices, description: SwitchEntityDescription):
|
||||
"""Initialize the ThinkingCleaner."""
|
||||
self.entity_description = description
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user