Skip to content

Commit e9c07ca

Browse files
committed
Shorten method removing NodeFeature.ENERGY/POWER
1 parent a7e3c68 commit e9c07ca

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
@@ -1272,7 +1272,7 @@ async def _check_for_energy_and_power_features(
12721272
If both are present, execute the related functions in a specific order
12731273
to assure a proper response to the hourly pulses-rollovers.
12741274
"""
1275-
if {NodeFeature.ENERGY, NodeFeature.POWER} <= features:
1275+
if {NodeFeature.ENERGY, NodeFeature.POWER} <= set(features):
12761276
states[NodeFeature.POWER] = await self.power_update()
12771277
_LOGGER.debug(
12781278
"async_get_state %s - power: %s",
@@ -1285,10 +1285,9 @@ async def _check_for_energy_and_power_features(
12851285
self._mac_in_str,
12861286
states[NodeFeature.ENERGY],
12871287
)
1288-
remaining_features = tuple(
1289-
f for f in features if f not in {NodeFeature.ENERGY, NodeFeature.POWER}
1290-
)
1291-
return remaining_features, states
1288+
return tuple(
1289+
set(features).difference({NodeFeature.ENERGY, NodeFeature.POWER})
1290+
), states
12921291

12931292
return features, states
12941293

0 commit comments

Comments
 (0)