Skip to content

Commit 5d97678

Browse files
committed
Shorten method removing NodeFeature.ENERGY/POWER
1 parent 8f07479 commit 5d97678

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ async def _check_for_energy_and_power_features(
12791279
If both are present, execute the related functions in a specific order
12801280
to assure a proper response to the hourly pulses-rollovers.
12811281
"""
1282-
if {NodeFeature.ENERGY, NodeFeature.POWER} <= features:
1282+
if {NodeFeature.ENERGY, NodeFeature.POWER} <= set(features):
12831283
states[NodeFeature.POWER] = await self.power_update()
12841284
_LOGGER.debug(
12851285
"async_get_state %s - power: %s",
@@ -1292,10 +1292,9 @@ async def _check_for_energy_and_power_features(
12921292
self._mac_in_str,
12931293
states[NodeFeature.ENERGY],
12941294
)
1295-
remaining_features = tuple(
1296-
f for f in features if f not in {NodeFeature.ENERGY, NodeFeature.POWER}
1297-
)
1298-
return remaining_features, states
1295+
return tuple(
1296+
set(features).difference({NodeFeature.ENERGY, NodeFeature.POWER})
1297+
), states
12991298

13001299
return features, states
13011300

0 commit comments

Comments
 (0)