Skip to content

Commit 72905dd

Browse files
committed
Cleaning up
1 parent c82f09e commit 72905dd

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
_LOGGER = logging.getLogger(__name__)
2424

2525
UPDATE_TOPIC = f"{DOMAIN}_update"
26-
SCAN_INTERVAL = timedelta(seconds=10)
27-
ERROR_INTERVAL = timedelta(seconds=300)
2826
ERROR_ITERVAL_MAPPING = [10, 60, 300, 600, 3000, 6000]
2927
NOTIFICATION_ID = "ph803w_device_notification"
3028
NOTIFICATION_TITLE = "PH-803W Device status"

lib/device.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,12 @@ async def run_async(self, once: bool = True) -> bool:
4141

4242
def run(self, once: bool = True) -> bool:
4343
self._loop = True
44+
if self._socket.fileno() == -1:
45+
self.reset_socket()
46+
self._connect()
4447
if once:
45-
if self._socket.fileno() == -1:
46-
self.reset_socket()
47-
self._connect()
4848
return self._run(once)
4949
else:
50-
if self._socket.fileno() == -1:
51-
self.reset_socket()
52-
self._connect()
5350
self._run(once)
5451
return not self._loop
5552

0 commit comments

Comments
 (0)