Remove hidden property from xiaomi_miio.remote integration (#30727)
This commit is contained in:
parent
15645ab0c9
commit
56dc5298fc
1 changed files with 2 additions and 27 deletions
|
@ -16,7 +16,6 @@ from homeassistant.components.remote import (
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_HIDDEN,
|
|
||||||
CONF_COMMAND,
|
CONF_COMMAND,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -61,7 +60,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
vol.Optional(CONF_SLOT, default=DEFAULT_SLOT): vol.All(
|
vol.Optional(CONF_SLOT, default=DEFAULT_SLOT): vol.All(
|
||||||
int, vol.Range(min=1, max=1000000)
|
int, vol.Range(min=1, max=1000000)
|
||||||
),
|
),
|
||||||
vol.Optional(ATTR_HIDDEN, default=True): cv.boolean,
|
|
||||||
vol.Required(CONF_TOKEN): vol.All(str, vol.Length(min=32, max=32)),
|
vol.Required(CONF_TOKEN): vol.All(str, vol.Length(min=32, max=32)),
|
||||||
vol.Optional(CONF_COMMANDS, default={}): cv.schema_with_slug_keys(
|
vol.Optional(CONF_COMMANDS, default={}): cv.schema_with_slug_keys(
|
||||||
COMMAND_SCHEMA
|
COMMAND_SCHEMA
|
||||||
|
@ -106,16 +104,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
slot = config.get(CONF_SLOT)
|
slot = config.get(CONF_SLOT)
|
||||||
timeout = config.get(CONF_TIMEOUT)
|
timeout = config.get(CONF_TIMEOUT)
|
||||||
|
|
||||||
hidden = config.get(ATTR_HIDDEN)
|
|
||||||
|
|
||||||
xiaomi_miio_remote = XiaomiMiioRemote(
|
xiaomi_miio_remote = XiaomiMiioRemote(
|
||||||
friendly_name,
|
friendly_name, device, unique_id, slot, timeout, config.get(CONF_COMMANDS),
|
||||||
device,
|
|
||||||
unique_id,
|
|
||||||
slot,
|
|
||||||
timeout,
|
|
||||||
hidden,
|
|
||||||
config.get(CONF_COMMANDS),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
hass.data[DATA_KEY][host] = xiaomi_miio_remote
|
hass.data[DATA_KEY][host] = xiaomi_miio_remote
|
||||||
|
@ -178,14 +168,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
class XiaomiMiioRemote(RemoteDevice):
|
class XiaomiMiioRemote(RemoteDevice):
|
||||||
"""Representation of a Xiaomi Miio Remote device."""
|
"""Representation of a Xiaomi Miio Remote device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, friendly_name, device, unique_id, slot, timeout, commands):
|
||||||
self, friendly_name, device, unique_id, slot, timeout, hidden, commands
|
|
||||||
):
|
|
||||||
"""Initialize the remote."""
|
"""Initialize the remote."""
|
||||||
self._name = friendly_name
|
self._name = friendly_name
|
||||||
self._device = device
|
self._device = device
|
||||||
self._unique_id = unique_id
|
self._unique_id = unique_id
|
||||||
self._is_hidden = hidden
|
|
||||||
self._slot = slot
|
self._slot = slot
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
self._state = False
|
self._state = False
|
||||||
|
@ -206,11 +193,6 @@ class XiaomiMiioRemote(RemoteDevice):
|
||||||
"""Return the remote object."""
|
"""Return the remote object."""
|
||||||
return self._device
|
return self._device
|
||||||
|
|
||||||
@property
|
|
||||||
def hidden(self):
|
|
||||||
"""Return if we should hide entity."""
|
|
||||||
return self._is_hidden
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def slot(self):
|
def slot(self):
|
||||||
"""Return the slot to save learned command."""
|
"""Return the slot to save learned command."""
|
||||||
|
@ -235,13 +217,6 @@ class XiaomiMiioRemote(RemoteDevice):
|
||||||
"""We should not be polled for device up state."""
|
"""We should not be polled for device up state."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
|
||||||
def device_state_attributes(self):
|
|
||||||
"""Hide remote by default."""
|
|
||||||
if self._is_hidden:
|
|
||||||
return {"hidden": "true"}
|
|
||||||
return
|
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
"""Turn the device on."""
|
"""Turn the device on."""
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
|
|
Loading…
Add table
Reference in a new issue