diff --git a/homeassistant/components/panasonic_viera/__init__.py b/homeassistant/components/panasonic_viera/__init__.py index 24b07835fbd..30b9190d4d1 100644 --- a/homeassistant/components/panasonic_viera/__init__.py +++ b/homeassistant/components/panasonic_viera/__init__.py @@ -178,9 +178,6 @@ class Remote: self.muted = self._control.get_mute() self.volume = self._control.get_volume() / 100 - self.state = STATE_ON - self.available = True - async def async_send_key(self, key): """Send a key to the TV and handle exceptions.""" try: @@ -231,7 +228,6 @@ class Remote: except (TimeoutError, URLError, SOAPError, OSError): self.state = STATE_OFF self.available = self._on_action is not None - await self.async_create_remote_control() except Exception as err: # pylint: disable=broad-except _LOGGER.exception("An unknown error occurred: %s", err) self.state = STATE_OFF diff --git a/homeassistant/components/panasonic_viera/config_flow.py b/homeassistant/components/panasonic_viera/config_flow.py index bcaa3bb090d..2416f01baf3 100644 --- a/homeassistant/components/panasonic_viera/config_flow.py +++ b/homeassistant/components/panasonic_viera/config_flow.py @@ -95,7 +95,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): if user_input is not None: pin = user_input[CONF_PIN] try: - self._remote.authorize_pin_code(pincode=pin) + await self.hass.async_add_executor_job( + partial(self._remote.authorize_pin_code, pincode=pin) + ) except SOAPError as err: _LOGGER.error("Invalid PIN code: %s", err) errors["base"] = ERROR_INVALID_PIN_CODE @@ -119,7 +121,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) try: - self._remote.request_pin_code(name="Home Assistant") + await self.hass.async_add_executor_job( + partial(self._remote.request_pin_code, name="Home Assistant") + ) except (TimeoutError, URLError, SOAPError, OSError) as err: _LOGGER.error("The remote connection was lost: %s", err) return self.async_abort(reason=REASON_NOT_CONNECTED)