fix: correct tuple except syntax in sensor modules

This commit is contained in:
Sparrow Lara 2026-04-14 12:45:57 +02:00
parent 406656c9d0
commit 272b433a8b
2 changed files with 2 additions and 2 deletions

View file

@ -47,7 +47,7 @@ def add_next_avg_attributes( # noqa: PLR0913
# Extract hours from sensor key (e.g., "next_avg_3h" -> 3) # Extract hours from sensor key (e.g., "next_avg_3h" -> 3)
try: try:
hours = int(key.rsplit("_", maxsplit=1)[-1].replace("h", "")) hours = int(key.rsplit("_", maxsplit=1)[-1].replace("h", ""))
except ValueError, AttributeError: except (ValueError, AttributeError):
return return
# Use TimeService to get the N-hour window starting from next interval # Use TimeService to get the N-hour window starting from next interval

View file

@ -903,7 +903,7 @@ class TibberPricesSensor(TibberPricesEntity, RestoreSensor):
if self.entity_description.entity_category == EntityCategory.DIAGNOSTIC: if self.entity_description.entity_category == EntityCategory.DIAGNOSTIC:
try: try:
value = self.native_value value = self.native_value
except KeyError, ValueError, TypeError: except (KeyError, ValueError, TypeError):
# If we can't get the value, hide the sensor # If we can't get the value, hide the sensor
return False return False
else: else: