mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-07-28 01:26:49 +00:00
fix: correct tuple except syntax in sensor modules
This commit is contained in:
parent
406656c9d0
commit
272b433a8b
2 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue