Minor final fixes

This commit is contained in:
Pierre Ståhl
2020-10-14 12:39:00 +02:00
committed by rospogrigio
parent b0603313ff
commit 136e44c549
2 changed files with 6 additions and 7 deletions

View File

@@ -150,12 +150,12 @@ class TuyaDevice(pytuya.TuyaListener):
_LOGGER.debug("Retrieving initial state") _LOGGER.debug("Retrieving initial state")
status = await self._interface.status() status = await self._interface.status()
if status is None: if status is None:
raise Exception("failed to retrieve status") raise Exception("Failed to retrieve status")
self.status_updated(status) self.status_updated(status)
self._connection_attempts = 0 self._connection_attempts = 0
except Exception: except Exception:
_LOGGER.exception("connect failed") _LOGGER.exception(f"Connect to {self._config_entry[CONF_HOST]} failed")
self._connection_attempts += 1 self._connection_attempts += 1
if self._interface is not None: if self._interface is not None:
self._interface.close() self._interface.close()

View File

@@ -7,7 +7,7 @@ Mostly derived from Shenzhen Xenon ESP8266MOD WiFi smart devices
E.g. https://wikidevi.com/wiki/Xenon_SM-PW701U E.g. https://wikidevi.com/wiki/Xenon_SM-PW701U
Author: clach04 Author: clach04
Maintained by: rospogrigio Maintained by: postlund
For more information see https://github.com/clach04/python-tuya For more information see https://github.com/clach04/python-tuya
@@ -24,7 +24,6 @@ Functions
add_dps_to_request(dps_index) # adds dps_index to the list of dps used by the add_dps_to_request(dps_index) # adds dps_index to the list of dps used by the
# device (to be queried in the payload) # device (to be queried in the payload)
set_dps(on, dps_index) # Set value of any dps index. set_dps(on, dps_index) # Set value of any dps index.
set_timer(num_secs):
Credits Credits
@@ -51,9 +50,9 @@ from abc import ABC, abstractmethod
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
version_tuple = (8, 1, 0) version_tuple = (9, 0, 0)
version = version_string = __version__ = "%d.%d.%d" % version_tuple version = version_string = __version__ = "%d.%d.%d" % version_tuple
__author__ = "rospogrigio" __author__ = "postlund"
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@@ -351,7 +350,7 @@ class TuyaProtocol(asyncio.Protocol):
def connection_lost(self, exc): def connection_lost(self, exc):
"""Disconnected from device.""" """Disconnected from device."""
self.log.debug("connection_lost: %s", exc) self.log.debug("Connection lost: %s", exc)
try: try:
self.close() self.close()
except Exception: except Exception: