diff --git a/custom_components/tapo/sensors/__init__.py b/custom_components/tapo/sensors/__init__.py index bd360b5..a92a19f 100644 --- a/custom_components/tapo/sensors/__init__.py +++ b/custom_components/tapo/sensors/__init__.py @@ -23,7 +23,7 @@ def get_config(self) -> SensorConfig: def get_value(self, coordinator: TapoDataCoordinator) -> StateType: if energy := coordinator.device.get_component(EnergyComponent): - return energy.energy_info.today_energy / 1000 + return energy.energy_info.today_energy / 1000 if energy.energy_info else None return None @@ -38,7 +38,7 @@ def get_config(self) -> SensorConfig: def get_value(self, coordinator: TapoDataCoordinator) -> StateType: if energy := coordinator.device.get_component(EnergyComponent): - return energy.energy_info.month_energy / 1000 + return energy.energy_info.month_energy / 1000 if energy.energy_info else None return None