Skip to content

Commit 1381e91

Browse files
committed
An attempt remove the async set...tests are broken right now
1 parent e5f9e8a commit 1381e91

File tree

6 files changed

+8
-305
lines changed

6 files changed

+8
-305
lines changed

custom_components/powersensor/AsyncSet.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

custom_components/powersensor/PowersensorMessageDispatcher.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
async_dispatcher_send,
1919
)
2020

21-
from .AsyncSet import AsyncSet
2221
from .const import (
2322
# Used config entry fields
2423
CFG_ROLES,
@@ -98,13 +97,13 @@ def __init__(
9897

9998
self._monitor_add_plug_queue = None
10099
self._stop_task = False
101-
self._plug_added_queue: AsyncSet = AsyncSet()
100+
self._plug_added_queue: set = set()
102101
self._safe_to_process_plug_queue = False
103102

104103
async def enqueue_plug_for_adding(self, network_info: dict):
105104
"""On receiving zeroconf data this info is added to processing buffer to await creation of entity and api."""
106105
_LOGGER.debug("Adding to plug processing queue: %s", network_info)
107-
await self._plug_added_queue.add(
106+
self._plug_added_queue.add(
108107
(
109108
network_info["mac"],
110109
network_info["host"],
@@ -162,7 +161,7 @@ async def _monitor_plug_queue(self):
162161
" Skipping and flushing from queue. ",
163162
mac_address,
164163
)
165-
await self._plug_added_queue.remove(
164+
self._plug_added_queue.remove(
166165
(mac_address, host, port, name)
167166
)
168167

@@ -327,7 +326,7 @@ async def _acknowledge_plug_added_to_homeassistant(
327326
self, mac_address, host, port, name
328327
):
329328
self._create_api(mac_address, host, port, name)
330-
await self._plug_added_queue.remove((mac_address, host, port, name))
329+
self._plug_added_queue.remove((mac_address, host, port, name))
331330

332331
async def _plug_added(self, info):
333332
_LOGGER.debug(" Request to add plug received: %s", info)

custom_components/powersensor/sensor/PlugMeasurements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Enum determining what measurements a Powersensor plug can report."""
2+
23
from enum import Enum
34

5+
46
class PlugMeasurements(Enum):
57
"""Enum to keep track of what measurements plugs can report."""
68

custom_components/powersensor/sensor/PowersensorHouseholdEntity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PowersensorVirtualHouseholdSensorEntityDescription(SensorEntityDescription
4242
FMT_WS_TO_KWH = lambda f: float(f)/3600000
4343

4444
class PowersensorHouseholdEntity(SensorEntity):
45-
"""Powersensor Virtual Household entity"""
45+
"""Powersensor Virtual Household entity."""
4646

4747
should_poll = False
4848
_attr_has_entity_name = True

custom_components/powersensor/sensor/SensorMeasurements.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Enum determining what measurements a Powersensor sensor can report."""
2+
23
from enum import Enum
34

45

tests/test_async_set.py

Lines changed: 0 additions & 244 deletions
This file was deleted.

0 commit comments

Comments
 (0)