diff --git a/custom_components/tibber_prices/sensor/attributes/future.py b/custom_components/tibber_prices/sensor/attributes/future.py index e36854b..342adfc 100644 --- a/custom_components/tibber_prices/sensor/attributes/future.py +++ b/custom_components/tibber_prices/sensor/attributes/future.py @@ -47,7 +47,7 @@ def add_next_avg_attributes( # noqa: PLR0913 # Extract hours from sensor key (e.g., "next_avg_3h" -> 3) try: hours = int(key.rsplit("_", maxsplit=1)[-1].replace("h", "")) - except ValueError, AttributeError: + except (ValueError, AttributeError): return # Use TimeService to get the N-hour window starting from next interval diff --git a/custom_components/tibber_prices/sensor/core.py b/custom_components/tibber_prices/sensor/core.py index 0e98fb2..b797681 100644 --- a/custom_components/tibber_prices/sensor/core.py +++ b/custom_components/tibber_prices/sensor/core.py @@ -903,7 +903,7 @@ class TibberPricesSensor(TibberPricesEntity, RestoreSensor): if self.entity_description.entity_category == EntityCategory.DIAGNOSTIC: try: value = self.native_value - except KeyError, ValueError, TypeError: + except (KeyError, ValueError, TypeError): # If we can't get the value, hide the sensor return False else: