From 3e0fd631539eee0e7f53f1422d4af7a8af96ab54 Mon Sep 17 00:00:00 2001 From: Bram Date: Sat, 14 Sep 2024 10:52:28 +0200 Subject: [PATCH] fix: cleanup --- custom_components/powercalc/sensors/power.py | 13 ++++++------- tests/test_init.py | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/custom_components/powercalc/sensors/power.py b/custom_components/powercalc/sensors/power.py index 4ba7e584c..eff764d13 100644 --- a/custom_components/powercalc/sensors/power.py +++ b/custom_components/powercalc/sensors/power.py @@ -522,13 +522,12 @@ async def _handle_source_entity_state_change( if self._power is not None: self._power = round(self._power, self._rounding_digits) - if state: - _LOGGER.debug( - '%s: State changed to "%s". Power:%s', - state.entity_id, - state.state, - self._power, - ) + _LOGGER.debug( + '%s: State changed to "%s". Power:%s', + state.entity_id, + state.state, + self._power, + ) self.async_write_ha_state() diff --git a/tests/test_init.py b/tests/test_init.py index 465d67096..84e8d8f97 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -184,7 +184,7 @@ async def test_repair_issue_with_none_sensors(hass: HomeAssistant) -> None: power_entry = await create_mocked_virtual_power_sensor_entry(hass, "Power") none_entries = [] - for i in range(10): # noqa + for _ in range(10): none_entries.append( await setup_config_entry( hass,