Skip to content

Commit dd8a151

Browse files
committed
Implement reset-improvement suggestion
1 parent 7b962b1 commit dd8a151

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def pulse_counter_reset(self) -> bool:
167167
def reset(self) -> None:
168168
"""Reset PulseCollection after an energy-logs reset."""
169169
# Keep mac, wipe every other attribute.
170-
self.__dict__.update(PulseCollection(self._mac).__dict__)
170+
fresh_state = PulseCollection(self._mac).__dict__
171+
self.__dict__.clear() # remove *all* existing keys first
172+
self.__dict__.update(fresh_state)
171173

172174
def collected_pulses(
173175
self, from_timestamp: datetime, is_consumption: bool

0 commit comments

Comments
 (0)