mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Fix on/off button (#42443)
This commit is contained in:
parent
251d8286e0
commit
f9208634bd
@ -26,7 +26,7 @@ from homeassistant.components.remote import (
|
|||||||
SUPPORT_LEARN_COMMAND,
|
SUPPORT_LEARN_COMMAND,
|
||||||
RemoteEntity,
|
RemoteEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, STATE_ON
|
from homeassistant.const import CONF_HOST, STATE_OFF
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -202,7 +202,7 @@ class BroadlinkRemote(RemoteEntity, RestoreEntity):
|
|||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Call when the remote is added to hass."""
|
"""Call when the remote is added to hass."""
|
||||||
state = await self.async_get_last_state()
|
state = await self.async_get_last_state()
|
||||||
self._state = state is None or state.state == STATE_ON
|
self._state = state is None or state.state != STATE_OFF
|
||||||
|
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
self._coordinator.async_add_listener(self.async_write_ha_state)
|
self._coordinator.async_add_listener(self.async_write_ha_state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user