Skip to content

Commit

Permalink
Make ci pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
cereal2nd committed Feb 2, 2024
1 parent e69dfa5 commit dcdbfbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repos:
- id: codespell
args:
- --quiet-level=2
- --ignore-words-list=hass
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
Expand Down
26 changes: 11 additions & 15 deletions duotecno/controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Main interface to the duotecno bus."""
from __future__ import annotations
import asyncio
import socket
import logging
from collections import deque
from duotecno.exceptions import LoadFailure, InvalidPassword
Expand All @@ -14,9 +13,7 @@
)
from duotecno.node import Node
from duotecno.unit import BaseUnit
from homeassistant.config_entries import ConfigEntries
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant


class PyDuotecno:
"""Class that will will do the bus management.
Expand Down Expand Up @@ -44,9 +41,10 @@ def __init__(self, hass):
async def reload_integration(self):
self._log.debug("Reload the Duotecno integration.")
# Get all Duotecno config entries
entries = self.hass.config_entries.async_entries('duotecno')
entries = self.hass.config_entries.async_entries("duotecno")

# You may want to handle the case where the integration to reload has multiple entries (modules).
# You may want to handle the case where the integration
# to reload has multiple entries (modules).
for entry in entries:
# Reload the integration
await self.hass.config_entries.async_reload(entry.entry_id)
Expand Down Expand Up @@ -127,17 +125,17 @@ async def write(self, msg: str) -> None:
if not self.writer:
return
if self.writer.transport.is_closing():
#await self.disconnect()
#await self._do_connect()
# await self.disconnect()
# await self._do_connect()
return
self._log.debug(f"Send: {msg}")
msg = f"{msg}{chr(10)}"
try:
self.writer.write(msg.encode())
await self.writer.drain()
except ConnectionError:
#await self.disconnect()
#await self._do_connect()
# await self.disconnect()
# await self._do_connect()
return

async def _loadTask(self) -> None:
Expand Down Expand Up @@ -192,7 +190,6 @@ async def heartbeatTask(self) -> None:
self._log.warning("Timeout on heartbeat, reconnecting")
await self.disconnect()
await self.continuously_check_connection()

break
except asyncio.exceptions.CancelledError:
break
Expand All @@ -205,10 +202,9 @@ async def readTask(self) -> None:
try:
tmp2 = await self.reader.readline()
except ConnectionError:
#await self.disconnect()
#await self._do_connect()
# await self.disconnect()
# await self._do_connect()
return

if tmp2 == "":
return
tmp3 = tmp2.decode()
Expand Down Expand Up @@ -263,4 +259,4 @@ async def _handlePacket(self, packet: Packet) -> None:
if hasattr(packet.cls, "address") and packet.cls.address in self.nodes:
await self.nodes[packet.cls.address].handlePacket(packet.cls)
return
self._log.debug(f"Ignoring packet: {packet}")
self._log.debug(f"Ignoring packet: {packet}")

0 comments on commit dcdbfbc

Please sign in to comment.