From 272b433a8b6feba19131ca29cb8b5385ac7cd358 Mon Sep 17 00:00:00 2001 From: Sparrow Lara <235718721+OdynBrouwer@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:45:57 +0200 Subject: [PATCH] fix: correct tuple except syntax in sensor modules --- custom_components/tibber_prices/sensor/attributes/future.py | 2 +- custom_components/tibber_prices/sensor/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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: